diff --git a/gst/gstcaps.c b/gst/gstcaps.c index 09724d0b24..f0cce6d313 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -1361,7 +1361,7 @@ gst_caps_intersect_zig_zag (const GstCaps * caps1, const GstCaps * caps2) istruct = gst_caps_structure_intersect (struct1, struct2); - gst_caps_append_structure (dest, istruct); + gst_caps_merge_structure (dest, istruct); /* move down left */ k++; if (G_UNLIKELY (j == 0)) @@ -1420,7 +1420,7 @@ gst_caps_intersect_first (const GstCaps * caps1, const GstCaps * caps2) struct2 = gst_caps_get_structure_unchecked (caps2, j); istruct = gst_caps_structure_intersect (struct1, struct2); if (istruct) - gst_caps_append_structure (dest, istruct); + gst_caps_merge_structure (dest, istruct); } } diff --git a/tests/check/gst/gstcaps.c b/tests/check/gst/gstcaps.c index fa160d91dd..a22c15f0d2 100644 --- a/tests/check/gst/gstcaps.c +++ b/tests/check/gst/gstcaps.c @@ -811,6 +811,24 @@ GST_START_TEST (test_intersect_first2) GST_END_TEST; +GST_START_TEST (test_intersect_duplication) +{ + GstCaps *c1, *c2, *test; + + c1 = gst_caps_from_string + ("audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]"); + c2 = gst_caps_from_string + ("audio/x-raw-int, width=(int)16, depth=(int)16, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ], endianness=(int){ 1234, 4321 }, signed=(boolean){ true, false }; audio/x-raw-int, width=(int)16, depth=(int)16, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 11 ], endianness=(int){ 1234, 4321 }, signed=(boolean){ true, false }; audio/x-raw-int, width=(int)16, depth=(int)[ 1, 16 ], rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 11 ], endianness=(int){ 1234, 4321 }, signed=(boolean){ true, false }"); + + test = gst_caps_intersect_full (c1, c2, GST_CAPS_INTERSECT_FIRST); + fail_unless_equals_int (gst_caps_get_size (test), 1); + fail_unless (gst_caps_is_equal (c1, test)); + gst_caps_unref (c1); + gst_caps_unref (c2); + gst_caps_unref (test); +} + +GST_END_TEST; static gboolean _caps_is_fixed_foreach (GQuark field_id, const GValue * value, gpointer unused) @@ -921,6 +939,7 @@ gst_caps_suite (void) tcase_add_test (tc_chain, test_intersect_zigzag); tcase_add_test (tc_chain, test_intersect_first); tcase_add_test (tc_chain, test_intersect_first2); + tcase_add_test (tc_chain, test_intersect_duplication); tcase_add_test (tc_chain, test_normalize); tcase_add_test (tc_chain, test_broken);