diff --git a/src/videostream.c b/src/videostream.c index 5ab9af3..d2ee0a5 100644 --- a/src/videostream.c +++ b/src/videostream.c @@ -142,7 +142,7 @@ void video_stream_iterate(VideoStream *stream){ ms_filter_call_method_noarg(stream->output, MS_VIDEO_OUT_HANDLE_RESIZING); */ - if (stream->evq){ + if ((stream!= NULL) && (stream->evq!=NULL)){ OrtpEvent *ev=ortp_ev_queue_get(stream->evq); if (ev!=NULL){ if (ortp_event_get_type(ev)==ORTP_EVENT_RTCP_PACKET_RECEIVED){ @@ -208,6 +208,7 @@ int video_stream_start (VideoStream *stream, RtpProfile *profile, const char *re pt=rtp_profile_get_payload(profile,payload); if (pt==NULL){ ms_error("videostream.c: undefined payload type."); + video_stream_free(stream); return -1; } stream->encoder=ms_filter_create_encoder(pt->mime_type); @@ -215,6 +216,7 @@ int video_stream_start (VideoStream *stream, RtpProfile *profile, const char *re if ((stream->encoder==NULL) || (stream->decoder==NULL)){ /* big problem: we have not a registered codec for this payload...*/ ms_error("videostream.c: No codecs available for payload %i:%s.",payload,pt->mime_type); + video_stream_free(stream); return -1; } @@ -513,7 +515,7 @@ int video_stream_send_only_start(VideoStream* stream, RtpProfile *profile, const } void video_stream_send_only_stop(VideoStream *stream){ - if (stream->ticker){ + if ((stream != NULL) && (stream->ticker != NULL)){ ms_ticker_detach (stream->ticker, stream->source); ms_filter_unlink(stream->source,0,stream->pixconv,0); ms_filter_unlink (stream->pixconv, 0, stream->sizeconv, 0); @@ -546,12 +548,14 @@ int video_stream_recv_only_start (VideoStream *stream, RtpProfile *profile, cons pt=rtp_profile_get_payload(profile,payload); if (pt==NULL){ ms_error("videostream.c: undefined payload type."); + video_stream_free(stream); return -1; } stream->decoder=ms_filter_create_decoder(pt->mime_type); if (stream->decoder==NULL){ /* big problem: we have not a registered codec for this payload...*/ ms_error("videostream.c: No codecs available for payload %i:%s.",payload,pt->mime_type); + video_stream_free(stream); return -1; } #ifndef WIN32