Commit 453f0607 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller
Browse files

gst/playback/gstplaybasebin.c: Catch async errors when starting up the...

gst/playback/gstplaybasebin.c: Catch async errors when starting up the subtitle bin, so we can stop waiting and conti...

Original commit message from CVS:
* gst/playback/gstplaybasebin.c: (subbin_startup_sync_msg),
(setup_source):
Catch async errors when starting up the subtitle bin, so we can
stop waiting and continue with the main film instead of hanging
forever. Fixes #339366.
* tests/check/elements/playbin.c: (playbin_suite):
Enable unit test for the above.
parent 1fff3118
2006-10-18 Tim-Philipp Müller <tim at centricular dot net>
* gst/playback/gstplaybasebin.c: (subbin_startup_sync_msg),
(setup_source):
Catch async errors when starting up the subtitle bin, so we can
stop waiting and continue with the main film instead of hanging
forever. Fixes #339366.
* tests/check/elements/playbin.c: (playbin_suite):
Enable unit test for the above.
2006-10-18 Tim-Philipp Müller <tim at centricular dot net>
 
* tests/check/Makefile.am:
......@@ -1785,6 +1785,25 @@ remove_source (GstPlayBaseBin * bin)
}
}
static GstBusSyncReply
subbin_startup_sync_msg (GstBus * bus, GstMessage * msg, gpointer user_data)
{
if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR) {
GstPlayBaseBin *play_base_bin;
play_base_bin = GST_PLAY_BASE_BIN (user_data);
if (!play_base_bin->subtitle_done) {
GST_WARNING_OBJECT (play_base_bin, "error starting up subtitle bin: %"
GST_PTR_FORMAT, msg);
play_base_bin->subtitle_done = TRUE;
GST_DEBUG_OBJECT (play_base_bin, "signal group done");
GROUP_SIGNAL (play_base_bin);
GST_DEBUG_OBJECT (play_base_bin, "signaled group done");
}
}
return GST_BUS_PASS;
}
/* construct and run the source and decoder elements until we found
* all the streams or until a preroll queue has been filled.
*/
......@@ -1851,6 +1870,14 @@ setup_source (GstPlayBaseBin * play_base_bin, gchar ** new_location)
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)
......@@ -1858,6 +1885,10 @@ setup_source (GstPlayBaseBin * play_base_bin, gchar ** new_location)
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) {
......
......@@ -69,7 +69,6 @@ GST_START_TEST (test_sink_usage_video_only_stream)
GST_END_TEST;
#if 0
/* this tests async error handling when setting up the subbin */
GST_START_TEST (test_suburi_error_unknowntype)
{
......@@ -101,7 +100,6 @@ GST_START_TEST (test_suburi_error_unknowntype)
}
GST_END_TEST;
#endif
GST_START_TEST (test_suburi_error_invalidfile)
{
......@@ -285,9 +283,12 @@ GST_PLUGIN_DEFINE_STATIC
GST_VERSION_MINOR,
"playbin-test-elements",
"static elements for the playbin unit test",
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
#endif /* GST_DISABLE_LOADSAVE_REGISTRY */
static Suite *playbin_suite (void)
static Suite *
playbin_suite (void)
{
Suite *s = suite_create ("playbin");
TCase *tc_chain = tcase_create ("general");
......@@ -298,7 +299,7 @@ GST_PLUGIN_DEFINE_STATIC
tcase_add_test (tc_chain, test_sink_usage_video_only_stream);
tcase_add_test (tc_chain, test_suburi_error_wrongproto);
tcase_add_test (tc_chain, test_suburi_error_invalidfile);
/* tcase_add_test (tc_chain, test_suburi_error_unknowntype); */
tcase_add_test (tc_chain, test_suburi_error_unknowntype);
#endif
return s;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment