From: Tim-Philipp Müller Date: Fri, 26 Apr 2013 23:05:45 +0000 (+0100) Subject: typefind: fix caps leak when used in connection with uridecodebin and playbin X-Git-Tag: 1.1.1~80 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e1c6a56596e927f6521a6c2ac32948202005c900;p=platform%2Fupstream%2Fgstreamer.git typefind: fix caps leak when used in connection with uridecodebin and playbin Don't leak forced sink caps. --- diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index a94439e..f333fb4 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -1195,6 +1195,7 @@ gst_type_find_element_activate_sink (GstPad * pad, GstObject * parent) GST_DEBUG ("Emiting found caps %" GST_PTR_FORMAT, found_caps); g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE], 0, probability, found_caps); + gst_caps_unref (found_caps); typefind->mode = MODE_NORMAL; /* the signal above could have made a downstream element activate * the pad in pull mode, we check if the pad is already active now and if diff --git a/tests/check/pipelines/simple-launch-lines.c b/tests/check/pipelines/simple-launch-lines.c index 1429500..62385b2 100644 --- a/tests/check/pipelines/simple-launch-lines.c +++ b/tests/check/pipelines/simple-launch-lines.c @@ -310,6 +310,20 @@ GST_START_TEST (test_stop_from_app) GST_END_TEST; +GST_START_TEST (test_typefind_force_sink_caps) +{ + const gchar *s; + + s = "fakesrc can-activate-push=true num-buffers=5 ! " + "typefind force-caps=foo/x-bar ! fakesink can-activate-push=true"; + ASSERT_CRITICAL (run_pipeline (setup_pipeline (s), s, + GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED | + GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE | + GST_MESSAGE_STREAM_START, GST_MESSAGE_UNKNOWN)); +} + +GST_END_TEST; + static Suite * simple_launch_lines_suite (void) { @@ -324,6 +338,8 @@ simple_launch_lines_suite (void) tcase_add_test (tc_chain, test_state_change_returns); /* tcase_add_test (tc_chain, test_tee); FIXME */ tcase_add_test (tc_chain, test_stop_from_app); + tcase_add_test (tc_chain, test_typefind_force_sink_caps); + return s; }