From: Wim Taymans Date: Thu, 30 May 2013 08:45:42 +0000 (+0200) Subject: rtsp: cleanup the watch reset function X-Git-Tag: 1.19.3~511^2~5283 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ad5632586a2910f4f88038ba312a1db8f448b1d5;p=platform%2Fupstream%2Fgstreamer.git rtsp: cleanup the watch reset function --- diff --git a/gst-libs/gst/rtsp/gstrtspconnection.c b/gst-libs/gst/rtsp/gstrtspconnection.c index 0fbe247..39c6c68 100644 --- a/gst-libs/gst/rtsp/gstrtspconnection.c +++ b/gst-libs/gst/rtsp/gstrtspconnection.c @@ -3064,24 +3064,28 @@ gst_rtsp_watch_reset (GstRTSPWatch * watch) if (watch->writesrc) g_source_remove_child_source ((GSource *) watch, watch->writesrc); - watch->readsrc = - g_pollable_input_stream_create_source (G_POLLABLE_INPUT_STREAM - (watch->conn->input_stream), NULL); - g_source_set_callback (watch->readsrc, - (GSourceFunc) gst_rtsp_source_dispatch_read, watch, NULL); - watch->writesrc = - g_pollable_output_stream_create_source (G_POLLABLE_OUTPUT_STREAM - (watch->conn->output_stream), NULL); - g_source_set_callback (watch->writesrc, - (GSourceFunc) gst_rtsp_source_dispatch_write, watch, NULL); - - if (watch->readsrc) { + if (watch->conn->input_stream) { + watch->readsrc = + g_pollable_input_stream_create_source (G_POLLABLE_INPUT_STREAM + (watch->conn->input_stream), NULL); + g_source_set_callback (watch->readsrc, + (GSourceFunc) gst_rtsp_source_dispatch_read, watch, NULL); g_source_add_child_source ((GSource *) watch, watch->readsrc); g_source_unref (watch->readsrc); + } else { + watch->readsrc = NULL; } - if (watch->writesrc) { + + if (watch->conn->output_stream) { + watch->writesrc = + g_pollable_output_stream_create_source (G_POLLABLE_OUTPUT_STREAM + (watch->conn->output_stream), NULL); + g_source_set_callback (watch->writesrc, + (GSourceFunc) gst_rtsp_source_dispatch_write, watch, NULL); g_source_add_child_source ((GSource *) watch, watch->writesrc); g_source_unref (watch->writesrc); + } else { + watch->writesrc = NULL; } }