summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavard Graff <havard.graff@gmail.com>2016-06-22 13:59:35 +0200
committerSebastian Dröge <sebastian@centricular.com>2016-11-01 20:20:47 +0200
commit78ab8cbdcd0b0bca80dfd3eeb0601a8c41207149 (patch)
treedda2efef22d4568733cbeb5a6eaf58b258ace1fd
parentfca2d2f9f0313f57a0c4c70f2ef9324ffc693895 (diff)
rtph263ppay: Fix caps leak
Fix leaking caps when downstream has not-fixed caps. https://bugzilla.gnome.org/show_bug.cgi?id=773515
-rw-r--r--gst/rtp/gstrtph263ppay.c1
-rw-r--r--tests/check/elements/rtph263.c27
2 files changed, 28 insertions, 0 deletions
diff --git a/gst/rtp/gstrtph263ppay.c b/gst/rtp/gstrtph263ppay.c
index 176d7ccae..b9bc45a6d 100644
--- a/gst/rtp/gstrtph263ppay.c
+++ b/gst/rtp/gstrtph263ppay.c
@@ -266,6 +266,7 @@ gst_rtp_h263p_pay_sink_getcaps (GstRTPBasePayload * payload, GstPad * pad,
* where we are dealing with the depayloader's template caps. In this case
* we should accept any input compatible with our sink template caps. */
if (!gst_caps_is_fixed (peercaps)) {
+ gst_caps_unref (peercaps);
caps =
gst_pad_get_pad_template_caps (GST_RTP_BASE_PAYLOAD_SINKPAD (payload));
goto done;
diff --git a/tests/check/elements/rtph263.c b/tests/check/elements/rtph263.c
index ffa33762a..28c01981f 100644
--- a/tests/check/elements/rtph263.c
+++ b/tests/check/elements/rtph263.c
@@ -284,6 +284,30 @@ GST_START_TEST (test_h263pdepay_dont_push_empty_frame)
GST_END_TEST;
+GST_START_TEST (test_h263ppay_non_fixed_caps)
+{
+ GstHarness *h;
+ guint8 frame[] = {
+ 0x00, 0x00, 0x80, 0x06, 0x1c, 0xa8, 0x01, 0x04, 0x91, 0xe0, 0x37, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ };
+
+ h = gst_harness_new_parse ("rtph263ppay");
+
+ /* Set non-fixed caps after payloader */
+ gst_harness_set_caps_str (h, "video/x-h263, variant=(string)itu",
+ "application/x-rtp, clock-rate=[1, MAX]");
+
+ gst_harness_push (h, gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY,
+ frame, sizeof (frame), 0, sizeof (frame), NULL, NULL));
+
+ fail_unless_equals_int (1, gst_harness_buffers_received (h));
+
+ gst_harness_teardown (h);
+}
+
+GST_END_TEST;
+
static Suite *
rtph263_suite (void)
{
@@ -305,6 +329,9 @@ rtph263_suite (void)
test_h263pdepay_fragmented_memory_non_writable_buffer_split_frame);
tcase_add_test (tc_chain, test_h263pdepay_dont_push_empty_frame);
+ suite_add_tcase (s, (tc_chain = tcase_create ("h263ppay")));
+ tcase_add_test (tc_chain, test_h263ppay_non_fixed_caps);
+
return s;
}