gst/playback/gstdecodebin2.c: Don't leak mutex.

Original commit message from CVS:
* gst/playback/gstdecodebin2.c: (gst_decode_bin_finalize):
Don't leak mutex.
* tests/check/elements/playbin.c:
(test_sink_usage_video_only_stream),
(test_suburi_error_unknowntype), (test_suburi_error_invalidfile),
(test_suburi_error_wrongproto), (test_missing_urisource_handler),
(test_missing_suburisource_handler),
(test_missing_primary_decoder), (playbin_suite):
Run all tests once with decodebin and once with decodebin2.
One test does not pass yet with decodebin2.
This commit is contained in:
Tim-Philipp Müller 2007-01-23 17:49:29 +00:00
parent 0fcb92f2dd
commit b8d04c8843
3 changed files with 67 additions and 26 deletions

View file

@ -1,3 +1,17 @@
2007-01-23 Tim-Philipp Müller <tim at centricular dot net>
* gst/playback/gstdecodebin2.c: (gst_decode_bin_finalize):
Don't leak mutex.
* tests/check/elements/playbin.c:
(test_sink_usage_video_only_stream),
(test_suburi_error_unknowntype), (test_suburi_error_invalidfile),
(test_suburi_error_wrongproto), (test_missing_urisource_handler),
(test_missing_suburisource_handler),
(test_missing_primary_decoder), (playbin_suite):
Run all tests once with decodebin and once with decodebin2.
One test does not pass yet with decodebin2.
2007-01-23 Edward Hervey <edward@fluendo.com> 2007-01-23 Edward Hervey <edward@fluendo.com>
* ext/ogg/gstoggmux.c: (all_pads_eos), (gst_ogg_mux_collected): * ext/ogg/gstoggmux.c: (all_pads_eos), (gst_ogg_mux_collected):

View file

@ -492,8 +492,11 @@ gst_decode_bin_dispose (GObject * object)
static void static void
gst_decode_bin_finalize (GObject * object) gst_decode_bin_finalize (GObject * object)
{ {
GstDecodeBin *decode_bin;
/* FILLME */ decode_bin = GST_DECODE_BIN (object);
g_mutex_free (decode_bin->lock);
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }

View file

@ -28,8 +28,21 @@
#ifndef GST_DISABLE_LOADSAVE_REGISTRY #ifndef GST_DISABLE_LOADSAVE_REGISTRY
#define DEFINE_TEST(func) \
static void func (void); \
\
GST_START_TEST(func ## _decodebin1) \
{ g_unsetenv("USE_DECODEBIN2"); func(); } \
GST_END_TEST; \
\
GST_START_TEST(func ## _decodebin2) \
{ g_setenv("USE_DECODEBIN2", "1", TRUE); func(); } \
GST_END_TEST;
DEFINE_TEST (test_sink_usage_video_only_stream)
/* make sure the audio sink is not touched for video-only streams */ /* make sure the audio sink is not touched for video-only streams */
GST_START_TEST (test_sink_usage_video_only_stream) static void test_sink_usage_video_only_stream (void)
{ {
GstElement *playbin, *fakevideosink, *fakeaudiosink; GstElement *playbin, *fakevideosink, *fakeaudiosink;
GstState cur_state, pending_state; GstState cur_state, pending_state;
@ -67,10 +80,10 @@ GST_START_TEST (test_sink_usage_video_only_stream)
gst_object_unref (playbin); gst_object_unref (playbin);
} }
GST_END_TEST;
/* this tests async error handling when setting up the subbin */ /* this tests async error handling when setting up the subbin */
GST_START_TEST (test_suburi_error_unknowntype) DEFINE_TEST (test_suburi_error_unknowntype)
static void test_suburi_error_unknowntype (void)
{ {
GstElement *playbin, *fakesink; GstElement *playbin, *fakesink;
@ -99,9 +112,9 @@ GST_START_TEST (test_suburi_error_unknowntype)
gst_object_unref (playbin); gst_object_unref (playbin);
} }
GST_END_TEST; DEFINE_TEST (test_suburi_error_invalidfile)
GST_START_TEST (test_suburi_error_invalidfile) static void test_suburi_error_invalidfile (void)
{ {
GstElement *playbin, *fakesink; GstElement *playbin, *fakesink;
@ -129,9 +142,9 @@ GST_START_TEST (test_suburi_error_invalidfile)
gst_object_unref (playbin); gst_object_unref (playbin);
} }
GST_END_TEST; DEFINE_TEST (test_suburi_error_wrongproto)
GST_START_TEST (test_suburi_error_wrongproto) static void test_suburi_error_wrongproto (void)
{ {
GstElement *playbin, *fakesink; GstElement *playbin, *fakesink;
@ -159,8 +172,6 @@ GST_START_TEST (test_suburi_error_wrongproto)
gst_object_unref (playbin); gst_object_unref (playbin);
} }
GST_END_TEST;
static GstElement * static GstElement *
create_playbin (const gchar * uri) create_playbin (const gchar * uri)
{ {
@ -187,7 +198,9 @@ create_playbin (const gchar * uri)
return playbin; return playbin;
} }
GST_START_TEST (test_missing_urisource_handler) DEFINE_TEST (test_missing_urisource_handler)
static void test_missing_urisource_handler (void)
{ {
GstStructure *s; GstStructure *s;
GstMessage *msg; GstMessage *msg;
@ -236,9 +249,9 @@ GST_START_TEST (test_missing_urisource_handler)
gst_object_unref (playbin); gst_object_unref (playbin);
} }
GST_END_TEST; DEFINE_TEST (test_missing_suburisource_handler)
GST_START_TEST (test_missing_suburisource_handler) static void test_missing_suburisource_handler (void)
{ {
GstStructure *s; GstStructure *s;
GstMessage *msg; GstMessage *msg;
@ -288,9 +301,8 @@ GST_START_TEST (test_missing_suburisource_handler)
gst_object_unref (playbin); gst_object_unref (playbin);
} }
GST_END_TEST; DEFINE_TEST (test_missing_primary_decoder)
static void test_missing_primary_decoder (void)
GST_START_TEST (test_missing_primary_decoder)
{ {
GstStructure *s; GstStructure *s;
GstMessage *msg; GstMessage *msg;
@ -337,8 +349,6 @@ GST_START_TEST (test_missing_primary_decoder)
gst_object_unref (playbin); gst_object_unref (playbin);
} }
GST_END_TEST;
/*** redvideo:// source ***/ /*** redvideo:// source ***/
static guint static guint
@ -574,6 +584,7 @@ GST_PLUGIN_DEFINE_STATIC
#endif /* GST_DISABLE_LOADSAVE_REGISTRY */ #endif /* GST_DISABLE_LOADSAVE_REGISTRY */
static Suite * static Suite *
playbin_suite (void) playbin_suite (void)
{ {
@ -583,13 +594,26 @@ playbin_suite (void)
suite_add_tcase (s, tc_chain); suite_add_tcase (s, tc_chain);
#ifndef GST_DISABLE_LOADSAVE_REGISTRY #ifndef GST_DISABLE_LOADSAVE_REGISTRY
tcase_add_test (tc_chain, test_sink_usage_video_only_stream); /* with the old decodebin */
tcase_add_test (tc_chain, test_suburi_error_wrongproto); tcase_add_test (tc_chain, test_sink_usage_video_only_stream_decodebin1);
tcase_add_test (tc_chain, test_suburi_error_invalidfile); tcase_add_test (tc_chain, test_suburi_error_wrongproto_decodebin1);
tcase_add_test (tc_chain, test_suburi_error_unknowntype); tcase_add_test (tc_chain, test_suburi_error_invalidfile_decodebin1);
tcase_add_test (tc_chain, test_missing_urisource_handler); tcase_add_test (tc_chain, test_suburi_error_unknowntype_decodebin1);
tcase_add_test (tc_chain, test_missing_suburisource_handler); tcase_add_test (tc_chain, test_missing_urisource_handler_decodebin1);
tcase_add_test (tc_chain, test_missing_primary_decoder); tcase_add_test (tc_chain, test_missing_suburisource_handler_decodebin1);
tcase_add_test (tc_chain, test_missing_primary_decoder_decodebin1);
/* and again with decodebin2 */
if (0) {
/* THIS TEST DOES NOT PASS WITH DECODEBIN2 */
tcase_add_test (tc_chain, test_missing_primary_decoder_decodebin2);
}
tcase_add_test (tc_chain, test_sink_usage_video_only_stream_decodebin2);
tcase_add_test (tc_chain, test_suburi_error_wrongproto_decodebin2);
tcase_add_test (tc_chain, test_suburi_error_invalidfile_decodebin2);
tcase_add_test (tc_chain, test_suburi_error_unknowntype_decodebin2);
tcase_add_test (tc_chain, test_missing_urisource_handler_decodebin2);
tcase_add_test (tc_chain, test_missing_suburisource_handler_decodebin2);
/* one day we might also want to have the following checks: /* one day we might also want to have the following checks:
* tcase_add_test (tc_chain, test_missing_secondary_decoder_one_fatal); * tcase_add_test (tc_chain, test_missing_secondary_decoder_one_fatal);