archrelease: copy trunk to extra-x86_64
[arch-packages.git] / farstream-0.1 / trunk / codec-discovery-intersect.patch
blob54134e05496af089db174f7e842b8335f583490c
1 From 50fffb08d941dce58ae48bf531faead8a4e22ed7 Mon Sep 17 00:00:00 2001
2 From: Olivier CrĂȘte <olivier.crete@collabora.com>
3 Date: Tue, 02 Apr 2013 23:13:06 +0000
4 Subject: codec-discovery: Intersect different parts of the same caps to reduce them
6 We do this because a caps may have the static payload in a separate structure from the encoding-name
7 We just want both in the same structure
8 ---
9 diff --git a/gst/fsrtpconference/fs-rtp-discover-codecs.c b/gst/fsrtpconference/fs-rtp-discover-codecs.c
10 index 5530cc8..df316a4 100644
11 --- a/gst/fsrtpconference/fs-rtp-discover-codecs.c
12 +++ b/gst/fsrtpconference/fs-rtp-discover-codecs.c
13 @@ -384,7 +384,6 @@ validate_h263_codecs (CodecCap *codec_cap)
14 if (!rtp_struct)
15 return FALSE;
17 - /* If there no h263version, we accept everything */
18 encoding_name = gst_structure_get_string (rtp_struct, "encoding-name");
20 /* If there is no encoding name, we have a problem, lets refuse it */
21 @@ -1300,15 +1299,44 @@ get_plugins_filtered_from_caps (FilterFunc filter,
22 else
24 gint i;
25 - for (i = 0; i < gst_caps_get_size (matched_caps); i++)
26 + GPtrArray *capslist = g_ptr_array_new_with_free_func (
27 + (GDestroyNotify) gst_caps_unref);
29 + while (gst_caps_get_size (matched_caps) > 0)
31 - GstCaps *cur_caps =
32 - gst_caps_copy_nth (matched_caps, i);
33 + GstCaps *stolencaps = gst_caps_new_full (
34 + gst_caps_steal_structure (matched_caps, 0), NULL);
35 + gboolean got_match = FALSE;
37 + for (i = 0; i < capslist->len; i++)
38 + {
39 + GstCaps *intersect = gst_caps_intersect (stolencaps,
40 + g_ptr_array_index (capslist, i));
42 + if (gst_caps_is_empty (intersect))
43 + {
44 + gst_caps_unref (intersect);
45 + }
46 + else
47 + {
48 + got_match = TRUE;
49 + gst_caps_unref (g_ptr_array_index (capslist, i));
50 + g_ptr_array_index (capslist, i) = intersect;
51 + }
52 + }
54 + if (got_match)
55 + gst_caps_unref (stolencaps);
56 + else
57 + g_ptr_array_add (capslist, stolencaps);
59 - list = create_codec_cap_list (factory, direction, list, cur_caps);
60 - gst_caps_unref (cur_caps);
62 gst_caps_unref (matched_caps);
64 + for (i = 0; i < capslist->len; i++)
65 + list = create_codec_cap_list (factory, direction, list,
66 + g_ptr_array_index (capslist, i));
67 + g_ptr_array_unref (capslist);
72 cgit v0.9.0.3