From a58a6b18545eb47de82780352dcb2099cb370e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 12 Feb 2007 10:33:40 +0000 Subject: [PATCH] gst/playback/gstplaybasebin.c: When we have external subtitles and wait for the subtitle decodebin to get up and runn... Original commit message from CVS: * gst/playback/gstplaybasebin.c: (setup_source): When we have external subtitles and wait for the subtitle decodebin to get up and running, we set up a (sync) bus handler for the subtitle decodebin, so we can stop waiting when it posts an error message. However, we should do that before we set the subtitle decodebin's state to playing, otherwise things are racy and we might miss error messages posted before we had a chance to set up the bus. This should finally fix totem hanging on .txt pseudo-subtitle files. --- ChangeLog | 11 +++++++++++ common | 2 +- gst/playback/gstplaybasebin.c | 23 +++++++++++------------ 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 52a6bde409..24521506db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-02-10 Tim-Philipp Müller + + * gst/playback/gstplaybasebin.c: (setup_source): + When we have external subtitles and wait for the subtitle decodebin + to get up and running, we set up a (sync) bus handler for the + subtitle decodebin, so we can stop waiting when it posts an error + message. However, we should do that before we set the subtitle + decodebin's state to playing, otherwise things are racy and we might + miss error messages posted before we had a chance to set up the bus. + This should finally fix totem hanging on .txt pseudo-subtitle files. + 2007-02-10 Sébastien Moutte * gst-libs/gst/rtp/gstbasertpaudiopayload.c:(gst_base_rtp_audio_payload_handle_frame_based_buffer): diff --git a/common b/common index de43a8f3c6..66d97715fc 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit de43a8f3c629983e0bea0b8eb617e52ed35a6cda +Subproject commit 66d97715fc83888fd1b5469c569f0ef5bbea628b diff --git a/gst/playback/gstplaybasebin.c b/gst/playback/gstplaybasebin.c index 0594c370af..f6f860c41c 100644 --- a/gst/playback/gstplaybasebin.c +++ b/gst/playback/gstplaybasebin.c @@ -1967,6 +1967,7 @@ setup_source (GstPlayBaseBin * play_base_bin) /* do subs */ if (subbin) { GstElement *db; + GstBus *bus; play_base_bin->subtitle = subbin; db = gst_bin_get_by_name (GST_BIN_CAST (subbin), "subtitle-decoder"); @@ -1996,16 +1997,14 @@ setup_source (GstPlayBaseBin * play_base_bin) * to commit the subtitle group using an extra flag. */ play_base_bin->subtitle_done = FALSE; + /* since subbin is still a stand-alone bin, we need to add a custom bus + * to intercept error messages, so we can stop waiting and continue */ + bus = gst_bus_new (); + gst_element_set_bus (subbin, bus); + gst_bus_set_sync_handler (bus, subbin_startup_sync_msg, play_base_bin); + sret = gst_element_set_state (subbin, GST_STATE_PAUSED); if (sret != GST_STATE_CHANGE_FAILURE) { - GstBus *bus; - - /* since subbin is still a stand-alone bin, we need to add a custom bus - * to intercept error messages, so we can stop waiting and continue */ - bus = gst_bus_new (); - gst_element_set_bus (subbin, bus); - gst_bus_set_sync_handler (bus, subbin_startup_sync_msg, play_base_bin); - GROUP_LOCK (play_base_bin); GST_DEBUG ("waiting for subtitle to complete..."); while (!play_base_bin->subtitle_done) @@ -2013,10 +2012,6 @@ setup_source (GstPlayBaseBin * play_base_bin) GST_DEBUG ("group done !"); GROUP_UNLOCK (play_base_bin); - gst_bus_set_sync_handler (bus, NULL, NULL); - gst_element_set_bus (subbin, NULL); - gst_object_unref (bus); - if (!play_base_bin->building_group || play_base_bin->building_group->type[GST_STREAM_TYPE_TEXT - 1].npads == 0) { @@ -2034,6 +2029,10 @@ setup_source (GstPlayBaseBin * play_base_bin) gst_object_unref (play_base_bin->subtitle); play_base_bin->subtitle = NULL; } + + gst_bus_set_sync_handler (bus, NULL, NULL); + gst_element_set_bus (subbin, NULL); + gst_object_unref (bus); } gst_object_unref (db); }