summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOgnyan Tonchev <ognyan@axis.com>2014-04-12 05:53:15 +0200
committerWim Taymans <wtaymans@redhat.com>2014-04-12 05:55:02 +0200
commitde2a70bb10b1e0111b3cbfa5c45c374061223965 (patch)
treedfc08e46c171668a62a84f62bbc0c84e92737fcf
parentadc3e8907e87235391f68f7f061321f74fb882f7 (diff)
media: allow NULL as the thread
Use the default context whan passing a NULL thread.
-rw-r--r--gst/rtsp-server/rtsp-media.c11
-rw-r--r--tests/check/gst/media.c2
2 files changed, 8 insertions, 5 deletions
diff --git a/gst/rtsp-server/rtsp-media.c b/gst/rtsp-server/rtsp-media.c
index 33c4d2c..b827c72 100644
--- a/gst/rtsp-server/rtsp-media.c
+++ b/gst/rtsp-server/rtsp-media.c
@@ -2157,9 +2157,9 @@ gst_rtsp_media_prepare (GstRTSPMedia * media, GstRTSPThread * thread)
GstBus *bus;
GSource *source;
GstRTSPMediaClass *klass;
+ GMainContext *context;
g_return_val_if_fail (GST_IS_RTSP_MEDIA (media), FALSE);
- g_return_val_if_fail (GST_IS_RTSP_THREAD (thread), FALSE);
priv = media->priv;
@@ -2206,6 +2206,8 @@ gst_rtsp_media_prepare (GstRTSPMedia * media, GstRTSPThread * thread)
priv->seekable = FALSE;
priv->buffering = FALSE;
priv->thread = thread;
+ context = (thread != NULL) ? (thread->context) : NULL;
+
/* we're preparing now */
gst_rtsp_media_set_status (media, GST_RTSP_MEDIA_STATUS_PREPARING);
@@ -2218,7 +2220,7 @@ gst_rtsp_media_prepare (GstRTSPMedia * media, GstRTSPThread * thread)
g_source_set_callback (priv->source, (GSourceFunc) bus_message,
g_object_ref (media), (GDestroyNotify) watch_destroyed);
- priv->id = g_source_attach (priv->source, thread->context);
+ priv->id = g_source_attach (priv->source, context);
/* add stuff to the bin */
gst_bin_add (GST_BIN (priv->pipeline), priv->rtpbin);
@@ -2226,7 +2228,7 @@ gst_rtsp_media_prepare (GstRTSPMedia * media, GstRTSPThread * thread)
/* do remainder in context */
source = g_idle_source_new ();
g_source_set_callback (source, (GSourceFunc) start_prepare, media, NULL);
- g_source_attach (source, thread->context);
+ g_source_attach (source, context);
g_source_unref (source);
wait_status:
@@ -2248,7 +2250,8 @@ was_prepared:
{
GST_LOG ("media %p was prepared", media);
/* we are not going to use the giving thread, so stop it. */
- gst_rtsp_thread_stop (thread);
+ if (thread)
+ gst_rtsp_thread_stop (thread);
g_rec_mutex_unlock (&priv->state_lock);
return TRUE;
}
diff --git a/tests/check/gst/media.c b/tests/check/gst/media.c
index 307c9e1..e06a4dd 100644
--- a/tests/check/gst/media.c
+++ b/tests/check/gst/media.c
@@ -317,7 +317,7 @@ GST_START_TEST (test_media_prepare_port_alloc_fail)
addrpool = gst_rtsp_address_pool_new ();
fail_unless (gst_rtsp_address_pool_add_range (addrpool, "192.168.1.1",
- "192.168.1.1", 6000, 6001, 0));
+ "192.168.1.1", 6000, 6001, 0));
gst_rtsp_media_set_address_pool (media, addrpool);
thread = gst_rtsp_thread_pool_get_thread (pool,