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