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.
This commit is contained in:
Tim-Philipp Müller 2007-02-12 10:33:40 +00:00
parent 9caee48ed4
commit a58a6b1854
3 changed files with 23 additions and 13 deletions

View file

@ -1,3 +1,14 @@
2007-02-10 Tim-Philipp Müller <tim at centricular dot net>
* 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 <sebastien at moutte dot net>
* gst-libs/gst/rtp/gstbasertpaudiopayload.c:(gst_base_rtp_audio_payload_handle_frame_based_buffer):

2
common

@ -1 +1 @@
Subproject commit de43a8f3c629983e0bea0b8eb617e52ed35a6cda
Subproject commit 66d97715fc83888fd1b5469c569f0ef5bbea628b

View file

@ -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);
}