mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 09:40:37 +00:00
media: allow NULL as the thread
Use the default context whan passing a NULL thread.
This commit is contained in:
parent
adc3e8907e
commit
de2a70bb10
2 changed files with 8 additions and 5 deletions
|
@ -2157,9 +2157,9 @@ gst_rtsp_media_prepare (GstRTSPMedia * media, GstRTSPThread * thread)
|
||||||
GstBus *bus;
|
GstBus *bus;
|
||||||
GSource *source;
|
GSource *source;
|
||||||
GstRTSPMediaClass *klass;
|
GstRTSPMediaClass *klass;
|
||||||
|
GMainContext *context;
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_RTSP_MEDIA (media), FALSE);
|
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;
|
priv = media->priv;
|
||||||
|
|
||||||
|
@ -2206,6 +2206,8 @@ gst_rtsp_media_prepare (GstRTSPMedia * media, GstRTSPThread * thread)
|
||||||
priv->seekable = FALSE;
|
priv->seekable = FALSE;
|
||||||
priv->buffering = FALSE;
|
priv->buffering = FALSE;
|
||||||
priv->thread = thread;
|
priv->thread = thread;
|
||||||
|
context = (thread != NULL) ? (thread->context) : NULL;
|
||||||
|
|
||||||
/* we're preparing now */
|
/* we're preparing now */
|
||||||
gst_rtsp_media_set_status (media, GST_RTSP_MEDIA_STATUS_PREPARING);
|
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_source_set_callback (priv->source, (GSourceFunc) bus_message,
|
||||||
g_object_ref (media), (GDestroyNotify) watch_destroyed);
|
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 */
|
/* add stuff to the bin */
|
||||||
gst_bin_add (GST_BIN (priv->pipeline), priv->rtpbin);
|
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 */
|
/* do remainder in context */
|
||||||
source = g_idle_source_new ();
|
source = g_idle_source_new ();
|
||||||
g_source_set_callback (source, (GSourceFunc) start_prepare, media, NULL);
|
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);
|
g_source_unref (source);
|
||||||
|
|
||||||
wait_status:
|
wait_status:
|
||||||
|
@ -2248,6 +2250,7 @@ was_prepared:
|
||||||
{
|
{
|
||||||
GST_LOG ("media %p was prepared", media);
|
GST_LOG ("media %p was prepared", media);
|
||||||
/* we are not going to use the giving thread, so stop it. */
|
/* we are not going to use the giving thread, so stop it. */
|
||||||
|
if (thread)
|
||||||
gst_rtsp_thread_stop (thread);
|
gst_rtsp_thread_stop (thread);
|
||||||
g_rec_mutex_unlock (&priv->state_lock);
|
g_rec_mutex_unlock (&priv->state_lock);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in a new issue