mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
rtspsrc: Don't parse key data more than needed.
When an auxilliary streams are present in the SDP media, there's no need to re-parse the SDP attributes multiple times.
This commit is contained in:
parent
fe4ed1d1df
commit
b38e24995b
1 changed files with 18 additions and 6 deletions
|
@ -1483,6 +1483,7 @@ gst_rtspsrc_collect_payloads (GstRTSPSrc * src, const GstSDPMessage * sdp,
|
|||
{
|
||||
guint i, len;
|
||||
const gchar *proto;
|
||||
GstCaps *global_caps;
|
||||
|
||||
/* get proto */
|
||||
proto = gst_sdp_media_get_proto (media);
|
||||
|
@ -1500,10 +1501,17 @@ gst_rtspsrc_collect_payloads (GstRTSPSrc * src, const GstSDPMessage * sdp,
|
|||
else
|
||||
goto unknown_proto;
|
||||
|
||||
/* Parse global SDP attributes once */
|
||||
global_caps = gst_caps_new_empty_simple ("application/x-unknown");
|
||||
GST_DEBUG ("mapping sdp session level attributes to caps");
|
||||
gst_rtspsrc_sdp_attributes_to_caps (sdp->attributes, global_caps);
|
||||
GST_DEBUG ("mapping sdp media level attributes to caps");
|
||||
gst_rtspsrc_sdp_attributes_to_caps (media->attributes, global_caps);
|
||||
|
||||
len = gst_sdp_media_formats_len (media);
|
||||
for (i = 0; i < len; i++) {
|
||||
gint pt;
|
||||
GstCaps *caps;
|
||||
GstCaps *caps, *outcaps;
|
||||
GstStructure *s;
|
||||
const gchar *enc;
|
||||
PtMapItem item;
|
||||
|
@ -1526,19 +1534,23 @@ gst_rtspsrc_collect_payloads (GstRTSPSrc * src, const GstSDPMessage * sdp,
|
|||
if (strcmp (enc, "X-ASF-PF") == 0)
|
||||
stream->container = TRUE;
|
||||
}
|
||||
GST_DEBUG ("mapping sdp session level attributes to caps");
|
||||
gst_rtspsrc_sdp_attributes_to_caps (sdp->attributes, caps);
|
||||
GST_DEBUG ("mapping sdp media level attributes to caps");
|
||||
gst_rtspsrc_sdp_attributes_to_caps (media->attributes, caps);
|
||||
|
||||
/* Merge in global caps */
|
||||
/* Intersect will merge in missing fields to the current caps */
|
||||
outcaps = gst_caps_intersect (caps, global_caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
/* the first pt will be the default */
|
||||
if (stream->ptmap->len == 0)
|
||||
stream->default_pt = pt;
|
||||
|
||||
item.pt = pt;
|
||||
item.caps = caps;
|
||||
item.caps = outcaps;
|
||||
|
||||
g_array_append_val (stream->ptmap, item);
|
||||
}
|
||||
|
||||
gst_caps_unref (global_caps);
|
||||
return;
|
||||
|
||||
no_proto:
|
||||
|
|
Loading…
Reference in a new issue