Commit dfc2fbd3 authored by Simon Morlat's avatar Simon Morlat

change ms_new calls to ms_new0, as a good practice to avoid facing unitialized...

change ms_new calls to ms_new0, as a good practice to avoid facing unitialized values in the future.
parent 26ff7a20
...@@ -27,7 +27,7 @@ typedef struct _AlawEncData{ ...@@ -27,7 +27,7 @@ typedef struct _AlawEncData{
} AlawEncData; } AlawEncData;
static AlawEncData * alaw_enc_data_new(){ static AlawEncData * alaw_enc_data_new(){
AlawEncData *obj=(AlawEncData *)ms_new(AlawEncData,1); AlawEncData *obj=(AlawEncData *)ms_new0(AlawEncData,1);
obj->bz=ms_bufferizer_new(); obj->bz=ms_bufferizer_new();
obj->ptime=0; obj->ptime=0;
obj->ts=0; obj->ts=0;
......
...@@ -766,7 +766,7 @@ struct _AlsaReadData{ ...@@ -766,7 +766,7 @@ struct _AlsaReadData{
typedef struct _AlsaReadData AlsaReadData; typedef struct _AlsaReadData AlsaReadData;
void alsa_read_init(MSFilter *obj){ void alsa_read_init(MSFilter *obj){
AlsaReadData *ad=ms_new(AlsaReadData,1); AlsaReadData *ad=ms_new0(AlsaReadData,1);
ad->pcmdev=NULL; ad->pcmdev=NULL;
ad->handle=NULL; ad->handle=NULL;
ad->rate=forced_rate!=-1 ? forced_rate : 8000; ad->rate=forced_rate!=-1 ? forced_rate : 8000;
...@@ -1025,7 +1025,7 @@ static MSFilter * ms_alsa_read_new(const char *dev){ ...@@ -1025,7 +1025,7 @@ static MSFilter * ms_alsa_read_new(const char *dev){
typedef struct _AlsaReadData AlsaWriteData; typedef struct _AlsaReadData AlsaWriteData;
void alsa_write_init(MSFilter *obj){ void alsa_write_init(MSFilter *obj){
AlsaWriteData *ad=ms_new(AlsaWriteData,1); AlsaWriteData *ad=ms_new0(AlsaWriteData,1);
ad->pcmdev=NULL; ad->pcmdev=NULL;
ad->handle=NULL; ad->handle=NULL;
ad->rate=forced_rate!=-1 ? forced_rate : 8000; ad->rate=forced_rate!=-1 ? forced_rate : 8000;
......
...@@ -30,7 +30,7 @@ typedef struct AdapterState{ ...@@ -30,7 +30,7 @@ typedef struct AdapterState{
}AdapterState; }AdapterState;
static void adapter_init(MSFilter *f){ static void adapter_init(MSFilter *f){
AdapterState *s=ms_new(AdapterState,1); AdapterState *s=ms_new0(AdapterState,1);
s->inputchans=1; s->inputchans=1;
s->outputchans=1; s->outputchans=1;
f->data=s; f->data=s;
......
...@@ -182,7 +182,7 @@ static SoundDeviceDescription *lookup_by_platform(const char *platform) { ...@@ -182,7 +182,7 @@ static SoundDeviceDescription *lookup_by_platform(const char *platform) {
} }
void ms_sound_device_description_add(const char *manufacturer, const char *model, const char *platform, unsigned int flags, int delay, int recommended_rate) { void ms_sound_device_description_add(const char *manufacturer, const char *model, const char *platform, unsigned int flags, int delay, int recommended_rate) {
SoundDeviceDescription *new_sound_device_description = ms_new(SoundDeviceDescription, 1); SoundDeviceDescription *new_sound_device_description = ms_new0(SoundDeviceDescription, 1);
new_sound_device_description->manufacturer = ms_strdup(manufacturer); new_sound_device_description->manufacturer = ms_strdup(manufacturer);
new_sound_device_description->model = ms_strdup(model); new_sound_device_description->model = ms_strdup(model);
new_sound_device_description->platform = ms_strdup(platform); new_sound_device_description->platform = ms_strdup(platform);
......
...@@ -72,7 +72,7 @@ static void equalizer_rate_update( EqualizerState* s, int rate ){ ...@@ -72,7 +72,7 @@ static void equalizer_rate_update( EqualizerState* s, int rate ){
equalizer_state_flatten(s); equalizer_state_flatten(s);
s->fir_len=s->nfft; s->fir_len=s->nfft;
if (s->fir != NULL) ms_free(s->fir); if (s->fir != NULL) ms_free(s->fir);
s->fir=(ms_word16_t*)ms_new(ms_word16_t,s->fir_len); s->fir=(ms_word16_t*)ms_new0(ms_word16_t,s->fir_len);
if (s->mem != NULL) ms_free(s->mem); if (s->mem != NULL) ms_free(s->mem);
s->mem=(ms_mem_t*)ms_new0(ms_mem_t,s->fir_len); s->mem=(ms_mem_t*)ms_new0(ms_mem_t,s->fir_len);
s->needs_update=TRUE; s->needs_update=TRUE;
......
...@@ -31,7 +31,7 @@ struct EncState { ...@@ -31,7 +31,7 @@ struct EncState {
static void enc_init(MSFilter *f) static void enc_init(MSFilter *f)
{ {
struct EncState *s=(struct EncState*)ms_new(struct EncState,1); struct EncState *s=ms_new0(struct EncState,1);
s->ts=0; s->ts=0;
s->bufferizer=ms_bufferizer_new(); s->bufferizer=ms_bufferizer_new();
s->ptime = 10; s->ptime = 10;
......
...@@ -36,7 +36,7 @@ typedef struct RecState{ ...@@ -36,7 +36,7 @@ typedef struct RecState{
} RecState; } RecState;
static void rec_init(MSFilter *f){ static void rec_init(MSFilter *f){
RecState *s=ms_new(RecState,1); RecState *s=ms_new0(RecState,1);
s->fd=-1; s->fd=-1;
s->rate=8000; s->rate=8000;
s->nchannels = 1; s->nchannels = 1;
......
...@@ -41,7 +41,7 @@ struct EncState { ...@@ -41,7 +41,7 @@ struct EncState {
static void enc_init(MSFilter *f) static void enc_init(MSFilter *f)
{ {
struct EncState *s=(struct EncState*)ms_new(struct EncState,1); struct EncState *s=ms_new0(struct EncState,1);
s->state = g722_encode_init(NULL, 64000, 0); s->state = g722_encode_init(NULL, 64000, 0);
s->ts=0; s->ts=0;
s->bufferizer=ms_bufferizer_new(); s->bufferizer=ms_bufferizer_new();
...@@ -184,7 +184,7 @@ struct DecState { ...@@ -184,7 +184,7 @@ struct DecState {
}; };
static void dec_init(MSFilter *f){ static void dec_init(MSFilter *f){
struct DecState *s=(struct DecState*)ms_new(struct DecState,1); struct DecState *s=ms_new0(struct DecState,1);
f->data=s; f->data=s;
s->state = g722_decode_init(NULL, 64000, 0); s->state = g722_decode_init(NULL, 64000, 0);
......
...@@ -42,7 +42,7 @@ typedef struct _ResampleData{ ...@@ -42,7 +42,7 @@ typedef struct _ResampleData{
} ResampleData; } ResampleData;
static ResampleData * resample_data_new(){ static ResampleData * resample_data_new(){
ResampleData *obj=(ResampleData *)ms_new(ResampleData,1); ResampleData *obj=ms_new0(ResampleData,1);
obj->bz=ms_bufferizer_new(); obj->bz=ms_bufferizer_new();
obj->ts=0; obj->ts=0;
obj->input_rate=8000; obj->input_rate=8000;
......
...@@ -46,9 +46,9 @@ typedef struct SpeexEncState{ ...@@ -46,9 +46,9 @@ typedef struct SpeexEncState{
} SpeexEncState; } SpeexEncState;
static void enc_init(MSFilter *f){ static void enc_init(MSFilter *f){
SpeexEncState *s=(SpeexEncState *)ms_new(SpeexEncState,1); SpeexEncState *s=ms_new0(SpeexEncState,1);
#ifdef SPEEX_LIB_SET_CPU_FEATURES #ifdef SPEEX_LIB_SET_CPU_FEATURES
int cpuFeatures = 0; int cpuFeatures = 0;
#endif #endif
s->rate=8000; s->rate=8000;
s->bitrate=-1; s->bitrate=-1;
...@@ -66,19 +66,19 @@ static void enc_init(MSFilter *f){ ...@@ -66,19 +66,19 @@ static void enc_init(MSFilter *f){
#ifdef SPEEX_LIB_SET_CPU_FEATURES #ifdef SPEEX_LIB_SET_CPU_FEATURES
#ifdef __ARM_NEON__ #ifdef __ARM_NEON__
#ifdef ANDROID #ifdef ANDROID
if (android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM if (android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM
&& (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0) { && (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0) {
cpuFeatures = SPEEX_LIB_CPU_FEATURE_NEON; cpuFeatures = SPEEX_LIB_CPU_FEATURE_NEON;
} }
#else #else
cpuFeatures = SPEEX_LIB_CPU_FEATURE_NEON; cpuFeatures = SPEEX_LIB_CPU_FEATURE_NEON;
#endif #endif
#endif #endif
ms_message("speex_lib_ctl init with neon ? %d", (cpuFeatures == SPEEX_LIB_CPU_FEATURE_NEON)); ms_message("speex_lib_ctl init with neon ? %d", (cpuFeatures == SPEEX_LIB_CPU_FEATURE_NEON));
speex_lib_ctl(SPEEX_LIB_SET_CPU_FEATURES, &cpuFeatures); speex_lib_ctl(SPEEX_LIB_SET_CPU_FEATURES, &cpuFeatures);
#else #else
ms_message("speex_lib_ctl does not support SPEEX_LIB_CPU_FEATURE_NEON"); ms_message("speex_lib_ctl does not support SPEEX_LIB_CPU_FEATURE_NEON");
#endif #endif
} }
...@@ -481,7 +481,7 @@ typedef struct DecState{ ...@@ -481,7 +481,7 @@ typedef struct DecState{
} DecState; } DecState;
static void dec_init(MSFilter *f){ static void dec_init(MSFilter *f){
DecState *s=(DecState *)ms_new(DecState,1); DecState *s=ms_new0(DecState,1);
s->rate=8000; s->rate=8000;
s->frsz=0; s->frsz=0;
s->state=NULL; s->state=NULL;
...@@ -494,9 +494,7 @@ static void dec_init(MSFilter *f){ ...@@ -494,9 +494,7 @@ static void dec_init(MSFilter *f){
static void dec_uninit(MSFilter *f){ static void dec_uninit(MSFilter *f){
DecState *s=(DecState*)f->data; DecState *s=(DecState*)f->data;
if (s==NULL) if (s->state!=NULL)
return;
if (s->state!=NULL)
speex_decoder_destroy(s->state); speex_decoder_destroy(s->state);
ms_free(s); ms_free(s);
} }
......
...@@ -253,7 +253,7 @@ static void oss_set_source(MSSndCard *card, MSSndCardCapture source) ...@@ -253,7 +253,7 @@ static void oss_set_source(MSSndCard *card, MSSndCardCapture source)
} }
static void oss_init(MSSndCard *card){ static void oss_init(MSSndCard *card){
OssData *d=ms_new(OssData,1); OssData *d=ms_new0(OssData,1);
d->pcmdev=NULL; d->pcmdev=NULL;
d->mixdev=NULL; d->mixdev=NULL;
d->pcmfd_read=-1; d->pcmfd_read=-1;
......
...@@ -78,7 +78,7 @@ typedef struct SpeexECState{ ...@@ -78,7 +78,7 @@ typedef struct SpeexECState{
}SpeexECState; }SpeexECState;
static void speex_ec_init(MSFilter *f){ static void speex_ec_init(MSFilter *f){
SpeexECState *s=(SpeexECState *)ms_new(SpeexECState,1); SpeexECState *s=ms_new0(SpeexECState,1);
s->samplerate=8000; s->samplerate=8000;
ms_bufferizer_init(&s->delayed_ref); ms_bufferizer_init(&s->delayed_ref);
......
...@@ -28,7 +28,7 @@ typedef struct _UlawEncData{ ...@@ -28,7 +28,7 @@ typedef struct _UlawEncData{
} UlawEncData; } UlawEncData;
static UlawEncData * ulaw_enc_data_new(){ static UlawEncData * ulaw_enc_data_new(){
UlawEncData *obj=(UlawEncData *)ms_new(UlawEncData,1); UlawEncData *obj=(UlawEncData *)ms_new0(UlawEncData,1);
obj->bz=ms_bufferizer_new(); obj->bz=ms_bufferizer_new();
obj->ptime=0; obj->ptime=0;
obj->ts=0; obj->ts=0;
......
...@@ -62,8 +62,7 @@ void ms_set_cpu_count(unsigned int c) { ...@@ -62,8 +62,7 @@ void ms_set_cpu_count(unsigned int c) {
} }
MSList *ms_list_new(void *data){ MSList *ms_list_new(void *data){
MSList *new_elem=(MSList *)ms_new(MSList,1); MSList *new_elem=(MSList *)ms_new0(MSList,1);
new_elem->prev=new_elem->next=NULL;
new_elem->data=data; new_elem->data=data;
return new_elem; return new_elem;
} }
...@@ -402,7 +401,7 @@ unsigned long ms_concealer_context_get_total_number_of_plc(MSConcealerContext* o ...@@ -402,7 +401,7 @@ unsigned long ms_concealer_context_get_total_number_of_plc(MSConcealerContext* o
} }
MSConcealerContext* ms_concealer_context_new(unsigned int max_plc_time){ MSConcealerContext* ms_concealer_context_new(unsigned int max_plc_time){
MSConcealerContext *obj=(MSConcealerContext *) ms_new(MSConcealerContext,1); MSConcealerContext *obj=(MSConcealerContext *) ms_new0(MSConcealerContext,1);
obj->sample_time=-1; obj->sample_time=-1;
obj->plc_start_time=-1; obj->plc_start_time=-1;
obj->total_number_for_plc=0; obj->total_number_for_plc=0;
...@@ -463,7 +462,7 @@ unsigned long ms_concealer_ts_context_get_total_number_of_plc(MSConcealerTsConte ...@@ -463,7 +462,7 @@ unsigned long ms_concealer_ts_context_get_total_number_of_plc(MSConcealerTsConte
} }
MSConcealerTsContext* ms_concealer_ts_context_new(unsigned int max_plc_ts){ MSConcealerTsContext* ms_concealer_ts_context_new(unsigned int max_plc_ts){
MSConcealerTsContext *obj=(MSConcealerTsContext *) ms_new(MSConcealerTsContext,1); MSConcealerTsContext *obj=(MSConcealerTsContext *) ms_new0(MSConcealerTsContext,1);
obj->sample_ts=-1; obj->sample_ts=-1;
obj->plc_start_ts=-1; obj->plc_start_ts=-1;
obj->total_number_for_plc=0; obj->total_number_for_plc=0;
......
...@@ -248,7 +248,7 @@ void ms_filter_postpone_task(MSFilter *f, MSFilterFunc taskfunc){ ...@@ -248,7 +248,7 @@ void ms_filter_postpone_task(MSFilter *f, MSFilterFunc taskfunc){
ms_error("ms_filter_postpone_task(): this method cannot be called outside of filter's process method."); ms_error("ms_filter_postpone_task(): this method cannot be called outside of filter's process method.");
return; return;
} }
task=ms_new(MSFilterTask,1); task=ms_new0(MSFilterTask,1);
task->f=f; task->f=f;
task->taskfunc=taskfunc; task->taskfunc=taskfunc;
ticker->task_list=ms_list_prepend(ticker->task_list,task); ticker->task_list=ms_list_prepend(ticker->task_list,task);
......
...@@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif #endif
MSQueue * ms_queue_new(struct _MSFilter *f1, int pin1, struct _MSFilter *f2, int pin2 ){ MSQueue * ms_queue_new(struct _MSFilter *f1, int pin1, struct _MSFilter *f2, int pin2 ){
MSQueue *q=(MSQueue*)ms_new(MSQueue,1); MSQueue *q=(MSQueue*)ms_new0(MSQueue,1);
qinit(&q->q); qinit(&q->q);
q->prev.filter=f1; q->prev.filter=f1;
q->prev.pin=pin1; q->prev.pin=pin1;
...@@ -63,7 +63,7 @@ void ms_bufferizer_init(MSBufferizer *obj){ ...@@ -63,7 +63,7 @@ void ms_bufferizer_init(MSBufferizer *obj){
} }
MSBufferizer * ms_bufferizer_new(){ MSBufferizer * ms_bufferizer_new(){
MSBufferizer *obj=(MSBufferizer *)ms_new(MSBufferizer,1); MSBufferizer *obj=(MSBufferizer *)ms_new0(MSBufferizer,1);
ms_bufferizer_init(obj); ms_bufferizer_init(obj);
return obj; return obj;
} }
......
...@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static MSSndCardManager *scm=NULL; static MSSndCardManager *scm=NULL;
static MSSndCardManager * create_manager(){ static MSSndCardManager * create_manager(){
MSSndCardManager *obj=(MSSndCardManager *)ms_new(MSSndCardManager,1); MSSndCardManager *obj=(MSSndCardManager *)ms_new0(MSSndCardManager,1);
obj->cards=NULL; obj->cards=NULL;
obj->descs=NULL; obj->descs=NULL;
return obj; return obj;
......
...@@ -574,7 +574,7 @@ static uint64_t get_wallclock_ms(void){ ...@@ -574,7 +574,7 @@ static uint64_t get_wallclock_ms(void){
static const double clock_coef = .01; static const double clock_coef = .01;
MSTickerSynchronizer* ms_ticker_synchronizer_new(void) { MSTickerSynchronizer* ms_ticker_synchronizer_new(void) {
MSTickerSynchronizer *obj=(MSTickerSynchronizer *)ms_new(MSTickerSynchronizer,1); MSTickerSynchronizer *obj=(MSTickerSynchronizer *)ms_new0(MSTickerSynchronizer,1);
obj->av_skew = 0; obj->av_skew = 0;
obj->offset = 0; obj->offset = 0;
return obj; return obj;
......
...@@ -27,9 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -27,9 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static MSWebCamManager *scm=NULL; static MSWebCamManager *scm=NULL;
static MSWebCamManager * create_manager(){ static MSWebCamManager * create_manager(){
MSWebCamManager *obj=(MSWebCamManager *)ms_new(MSWebCamManager,1); MSWebCamManager *obj=(MSWebCamManager *)ms_new0(MSWebCamManager,1);
obj->cams=NULL;
obj->descs=NULL;
return obj; return obj;
} }
...@@ -99,11 +97,8 @@ void ms_web_cam_manager_reload(MSWebCamManager *m){ ...@@ -99,11 +97,8 @@ void ms_web_cam_manager_reload(MSWebCamManager *m){
} }
MSWebCam * ms_web_cam_new(MSWebCamDesc *desc){ MSWebCam * ms_web_cam_new(MSWebCamDesc *desc){
MSWebCam *obj=(MSWebCam *)ms_new(MSWebCam,1); MSWebCam *obj=(MSWebCam *)ms_new0(MSWebCam,1);
obj->desc=desc; obj->desc=desc;
obj->name=NULL;
obj->data=NULL;
obj->id=NULL;
if (desc->init!=NULL) if (desc->init!=NULL)
desc->init(obj); desc->init(obj);
return obj; return obj;
......
...@@ -30,7 +30,7 @@ typedef struct VoidSourceState VoidSourceState; ...@@ -30,7 +30,7 @@ typedef struct VoidSourceState VoidSourceState;
static void void_source_init(MSFilter *f) { static void void_source_init(MSFilter *f) {
VoidSourceState *s = (VoidSourceState *)ms_new(VoidSourceState, 1); VoidSourceState *s = ms_new0(VoidSourceState, 1);
s->rate = 8000; s->rate = 8000;
s->nchannels = 1; s->nchannels = 1;
f->data = s; f->data = s;
......
...@@ -289,7 +289,7 @@ void mkv_track_reader_next_block(MKVTrackReader *reader, MKVBlock **block, bool_ ...@@ -289,7 +289,7 @@ void mkv_track_reader_next_block(MKVTrackReader *reader, MKVBlock **block, bool_
MATROSKA_BlockGetFrame(block_elt, 0, &m_frame, TRUE); MATROSKA_BlockGetFrame(block_elt, 0, &m_frame, TRUE);
(*block)->timestamp = MATROSKA_BlockTimecode(block_elt) / 1000000LL; (*block)->timestamp = MATROSKA_BlockTimecode(block_elt) / 1000000LL;
(*block)->data_length = m_frame.Size; (*block)->data_length = m_frame.Size;
(*block)->data = ms_new(uint8_t, m_frame.Size); (*block)->data = ms_new0(uint8_t, m_frame.Size);
memcpy((*block)->data, m_frame.Data, m_frame.Size); memcpy((*block)->data, m_frame.Data, m_frame.Size);
MATROSKA_BlockReleaseData(block_elt, TRUE); MATROSKA_BlockReleaseData(block_elt, TRUE);
} }
......
...@@ -68,7 +68,7 @@ static void dec_open(DecData *d){ ...@@ -68,7 +68,7 @@ static void dec_open(DecData *d){
} }
static void dec_init(MSFilter *f){ static void dec_init(MSFilter *f){
DecData *d=(DecData*)ms_new(DecData,1); DecData *d=ms_new0(DecData,1);
ffmpeg_init(); ffmpeg_init();
d->sps=NULL; d->sps=NULL;
d->pps=NULL; d->pps=NULL;
......
...@@ -38,7 +38,7 @@ typedef struct _MireData{ ...@@ -38,7 +38,7 @@ typedef struct _MireData{
}MireData; }MireData;
void mire_init(MSFilter *f){ void mire_init(MSFilter *f){
MireData *d=(MireData*)ms_new(MireData,1); MireData *d=ms_new0(MireData,1);
d->vsize.width=MS_VIDEO_SIZE_CIF_W; d->vsize.width=MS_VIDEO_SIZE_CIF_W;
d->vsize.height=MS_VIDEO_SIZE_CIF_H; d->vsize.height=MS_VIDEO_SIZE_CIF_H;
d->fps=15; d->fps=15;
......
...@@ -95,7 +95,7 @@ static void H264Private_uninit(H264Private *obj) { ...@@ -95,7 +95,7 @@ static void H264Private_uninit(H264Private *obj) {
} }
static H264Private *H264Private_new(const MSList *spsList, const MSList *ppsList) { static H264Private *H264Private_new(const MSList *spsList, const MSList *ppsList) {
H264Private *obj = (H264Private *)ms_new(H264Private, 1); H264Private *obj = (H264Private *)ms_new0(H264Private, 1);
H264Private_init(obj, spsList, ppsList); H264Private_init(obj, spsList, ppsList);
return obj; return obj;
} }
...@@ -549,7 +549,7 @@ static inline void opus_codec_private_load(OpusCodecPrivate *obj, const uint8_t ...@@ -549,7 +549,7 @@ static inline void opus_codec_private_load(OpusCodecPrivate *obj, const uint8_t
// OpusModule // OpusModule
static void *opus_module_new() { static void *opus_module_new() {
OpusCodecPrivate *obj = ms_new(OpusCodecPrivate, 1); OpusCodecPrivate *obj = ms_new0(OpusCodecPrivate, 1);
opus_codec_private_init(obj); opus_codec_private_init(obj);
return obj; return obj;
} }
......
...@@ -37,7 +37,7 @@ typedef struct PixConvState{ ...@@ -37,7 +37,7 @@ typedef struct PixConvState{
}PixConvState; }PixConvState;
static void pixconv_init(MSFilter *f){ static void pixconv_init(MSFilter *f){
PixConvState *s=(PixConvState *)ms_new(PixConvState,1); PixConvState *s=ms_new0(PixConvState,1);
s->yuv_msg=NULL; s->yuv_msg=NULL;
s->size.width = MS_VIDEO_SIZE_CIF_W; s->size.width = MS_VIDEO_SIZE_CIF_W;
s->size.height = MS_VIDEO_SIZE_CIF_H; s->size.height = MS_VIDEO_SIZE_CIF_H;
......
...@@ -43,7 +43,7 @@ typedef struct SizeConvState{ ...@@ -43,7 +43,7 @@ typedef struct SizeConvState{
For now it only supports QCIF->CIF, QVGA->CIF and CIF->CIF (does nothing in this case)*/ For now it only supports QCIF->CIF, QVGA->CIF and CIF->CIF (does nothing in this case)*/
static void size_conv_init(MSFilter *f){ static void size_conv_init(MSFilter *f){
SizeConvState *s=(SizeConvState *)ms_new(SizeConvState,1); SizeConvState *s=ms_new0(SizeConvState,1);
s->target_vsize.width = MS_VIDEO_SIZE_CIF_W; s->target_vsize.width = MS_VIDEO_SIZE_CIF_W;
s->target_vsize.height = MS_VIDEO_SIZE_CIF_H; s->target_vsize.height = MS_VIDEO_SIZE_CIF_H;
s->in_vsize.width=0; s->in_vsize.width=0;
......
...@@ -36,7 +36,7 @@ typedef struct EncState{ ...@@ -36,7 +36,7 @@ typedef struct EncState{
} EncState; } EncState;
static void enc_init(MSFilter *f){ static void enc_init(MSFilter *f){
EncState *s=(EncState *)ms_new(EncState,1); EncState *s=ms_new0(EncState,1);
theora_info_init(&s->tinfo); theora_info_init(&s->tinfo);
s->tinfo.width=MS_VIDEO_SIZE_CIF_W; s->tinfo.width=MS_VIDEO_SIZE_CIF_W;
s->tinfo.height=MS_VIDEO_SIZE_CIF_H; s->tinfo.height=MS_VIDEO_SIZE_CIF_H;
...@@ -407,7 +407,7 @@ typedef struct DecState{ ...@@ -407,7 +407,7 @@ typedef struct DecState{
}DecState; }DecState;
static void dec_init(MSFilter *f){ static void dec_init(MSFilter *f){
DecState *s=(DecState *)ms_new(DecState,1); DecState *s=ms_new0(DecState,1);
s->ready=FALSE; s->ready=FALSE;
theora_info_init(&s->tinfo); theora_info_init(&s->tinfo);
s->yuv=NULL; s->yuv=NULL;
......
...@@ -223,7 +223,7 @@ static const MSVideoConfiguration * get_vconf_list(EncState *s) { ...@@ -223,7 +223,7 @@ static const MSVideoConfiguration * get_vconf_list(EncState *s) {
static void enc_init(MSFilter *f, enum CodecID codec) static void enc_init(MSFilter *f, enum CodecID codec)
{ {
EncState *s=(EncState *)ms_new(EncState,1); EncState *s=ms_new0(EncState,1);
f->data=s; f->data=s;
ms_ffmpeg_check_init(); ms_ffmpeg_check_init();
s->profile=0;/*always default to profile 0*/ s->profile=0;/*always default to profile 0*/
......
...@@ -198,7 +198,6 @@ static char * generate_pwd(void) ...@@ -198,7 +198,6 @@ static char * generate_pwd(void)
static void ice_session_init(IceSession *session) static void ice_session_init(IceSession *session)
{ {
memset(&session->streams, 0, sizeof(session->streams));
session->state = IS_Stopped; session->state = IS_Stopped;
session->role = IR_Controlling; session->role = IR_Controlling;
session->tie_breaker = generate_tie_breaker(); session->tie_breaker = generate_tie_breaker();
...@@ -209,7 +208,6 @@ static void ice_session_init(IceSession *session) ...@@ -209,7 +208,6 @@ static void ice_session_init(IceSession *session)
session->local_pwd = generate_pwd(); session->local_pwd = generate_pwd();
session->remote_ufrag = NULL; session->remote_ufrag = NULL;
session->remote_pwd = NULL; session->remote_pwd = NULL;
memset(&session->event_time, 0, sizeof(session->event_time));
session->send_event = FALSE; session->send_event = FALSE;
session->gathering_start_ts.tv_sec = session->gathering_start_ts.tv_nsec = -1; session->gathering_start_ts.tv_sec = session->gathering_start_ts.tv_nsec = -1;
session->gathering_end_ts.tv_sec = session->gathering_end_ts.tv_nsec = -1; session->gathering_end_ts.tv_sec = session->gathering_end_ts.tv_nsec = -1;
...@@ -217,7 +215,7 @@ static void ice_session_init(IceSession *session) ...@@ -217,7 +215,7 @@ static void ice_session_init(IceSession *session)
IceSession * ice_session_new(void) IceSession * ice_session_new(void)
{ {
IceSession *session = ms_new(IceSession, 1); IceSession *session = ms_new0(IceSession, 1);
if (session == NULL) { if (session == NULL) {
ms_error("ice: Memory allocation of ICE session failed"); ms_error("ice: Memory allocation of ICE session failed");
return NULL; return NULL;
...@@ -271,7 +269,7 @@ static void ice_check_list_init(IceCheckList *cl) ...@@ -271,7 +269,7 @@ static void ice_check_list_init(IceCheckList *cl)
IceCheckList * ice_check_list_new(void) IceCheckList * ice_check_list_new(void)
{ {
IceCheckList *cl = ms_new(IceCheckList, 1); IceCheckList *cl = ms_new0(IceCheckList, 1);
if (cl == NULL) { if (cl == NULL) {
ms_error("ice_check_list_new: Memory allocation failed"); ms_error("ice_check_list_new: Memory allocation failed");
return NULL; return NULL;
...@@ -1757,7 +1755,7 @@ static IceCandidatePair * ice_construct_valid_pair(IceCheckList *cl, RtpSession ...@@ -1757,7 +1755,7 @@ static IceCandidatePair * ice_construct_valid_pair(IceCheckList *cl, RtpSession
/* The candidate pair is already in the check list, add it to the valid list. */ /* The candidate pair is already in the check list, add it to the valid list. */
pair = (IceCandidatePair *)elem->data; pair = (IceCandidatePair *)elem->data;
} }
valid_pair = ms_new(IceValidCandidatePair, 1); valid_pair = ms_new0(IceValidCandidatePair, 1);
valid_pair->valid = pair; valid_pair->valid = pair;
valid_pair->generated_from = succeeded_pair; valid_pair->generated_from = succeeded_pair;
valid_pair->selected = FALSE; valid_pair->selected = FALSE;
...@@ -2594,7 +2592,7 @@ static void ice_generate_pair_foundations_list(const IceCandidatePair *pair, MSL ...@@ -2594,7 +2592,7 @@ static void ice_generate_pair_foundations_list(const IceCandidatePair *pair, MSL
elem = ms_list_find_custom(*list, (MSCompareFunc)ice_find_pair_foundation, &foundation); elem = ms_list_find_custom(*list, (MSCompareFunc)ice_find_pair_foundation, &foundation);
if (elem == NULL) { if (elem == NULL) {
dyn_foundation = ms_new(IcePairFoundation, 1); dyn_foundation = ms_new0(IcePairFoundation, 1);
memcpy(dyn_foundation, &foundation, sizeof(foundation)); memcpy(dyn_foundation, &foundation, sizeof(foundation));
*list = ms_list_append(*list, dyn_foundation); *list = ms_list_append(*list, dyn_foundation);
} }
......
...@@ -425,7 +425,7 @@ typedef struct _MSFFScalerContext MSFFScalerContext; ...@@ -425,7 +425,7 @@ typedef struct _MSFFScalerContext MSFFScalerContext;
static MSScalerContext *ff_create_swscale_context(int src_w, int src_h, MSPixFmt src_fmt, static MSScalerContext *ff_create_swscale_context(int src_w, int src_h, MSPixFmt src_fmt,
int dst_w, int dst_h, MSPixFmt dst_fmt, int flags){ int dst_w, int dst_h, MSPixFmt dst_fmt, int flags){
int ff_flags=0; int ff_flags=0;
MSFFScalerContext *ctx=ms_new(MSFFScalerContext,1); MSFFScalerContext *ctx=ms_new0(MSFFScalerContext,1);
ctx->src_h=src_h; ctx->src_h=src_h;
#if __arm__ #if __arm__
ff_flags|=SWS_FAST_BILINEAR; ff_flags|=SWS_FAST_BILINEAR;
......
...@@ -38,8 +38,8 @@ static MS2_INLINE uint8_t nal_header_get_nri(const uint8_t *h){ ...@@ -38,8 +38,8 @@ static MS2_INLINE uint8_t nal_header_get_nri(const uint8_t *h){
} }
Rfc3984Context *rfc3984_new(void){ Rfc3984Context *rfc3984_new(void){
Rfc3984Context *ctx=ms_new(Rfc3984Context,1); Rfc3984Context *ctx=ms_new0(Rfc3984Context,1);
rfc3984_init (ctx); rfc3984_init(ctx);
return ctx; return ctx;
} }
......
...@@ -922,7 +922,7 @@ void vp8rtpfmt_unpacker_process(Vp8RtpFmtUnpackerCtx *ctx, MSQueue *inout) { ...@@ -922,7 +922,7 @@ void vp8rtpfmt_unpacker_process(Vp8RtpFmtUnpackerCtx *ctx, MSQueue *inout) {
ms_message("vp8rtpfmt_unpacker_process:"); ms_message("vp8rtpfmt_unpacker_process:");
#endif #endif
while ((m = ms_queue_get(inout)) != NULL) { while ((m = ms_queue_get(inout)) != NULL) {
packet = ms_new(Vp8RtpFmtPacket, 1); packet = ms_new0(Vp8RtpFmtPacket, 1);
packet->m = m; packet->m = m;
packet->extended_cseq = vp8rtpfmt_unpacker_calc_extended_cseq(ctx, mblk_get_cseq(m)); packet->extended_cseq = vp8rtpfmt_unpacker_calc_extended_cseq(ctx, mblk_get_cseq(m));
packet->pd = ms_new0(Vp8RtpFmtPayloadDescriptor, 1); packet->pd = ms_new0(Vp8RtpFmtPayloadDescriptor, 1);
......