typefind: fix caps leak when used in connection with uridecodebin and playbin

Don't leak forced sink caps.
This commit is contained in:
Tim-Philipp Müller 2013-04-27 00:05:45 +01:00
parent 3b8181a8c5
commit e1c6a56596
2 changed files with 17 additions and 0 deletions

View file

@ -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

View file

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