From: Mark Nauwelaerts Date: Fri, 16 Apr 2010 10:14:26 +0000 (+0200) Subject: rtph264depay: profile-level-id is an optional parameter X-Git-Tag: RELEASE-0.10.22~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e053a89c21b0d6f52867131c1d3473bc4ae74704;p=platform%2Fupstream%2Fgst-plugins-good.git rtph264depay: profile-level-id is an optional parameter So, if needed, extract the corresponding info from sprop-parameter-sets. Based on patch provided by Fixes #612657. --- diff --git a/gst/rtp/gstrtph264depay.c b/gst/rtp/gstrtph264depay.c index 44f8758..3223dcb 100644 --- a/gst/rtp/gstrtph264depay.c +++ b/gst/rtp/gstrtph264depay.c @@ -288,9 +288,8 @@ gst_rtp_h264_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps) guint len, num_sps, num_pps; gint i; guint8 *data; - guint32 profile_id; - if (ps == NULL || profile == NULL) + if (ps == NULL) goto incomplete_caps; params = g_strsplit (ps, ",", 0); @@ -330,16 +329,31 @@ gst_rtp_h264_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps) } g_strfreev (params); + if (num_sps == 0 || (GST_READ_UINT16_BE (sps[0]) < 3) || num_pps == 0) { + g_strfreev ((gchar **) pps); + g_strfreev ((gchar **) sps); + goto incomplete_caps; + } + codec_data = gst_buffer_new_and_alloc (len); data = GST_BUFFER_DATA (codec_data); /* 8 bits version == 1 */ *data++ = 1; - /* hex: AVCProfileIndication:8 | profile_compat:8 | AVCLevelIndication:8 */ - sscanf (profile, "%6x", &profile_id); - *data++ = (profile_id >> 16) & 0xff; - *data++ = (profile_id >> 8) & 0xff; - *data++ = profile_id & 0xff; + if (profile) { + guint32 profile_id; + + /* hex: AVCProfileIndication:8 | profile_compat:8 | AVCLevelIndication:8 */ + sscanf (profile, "%6x", &profile_id); + *data++ = (profile_id >> 16) & 0xff; + *data++ = (profile_id >> 8) & 0xff; + *data++ = profile_id & 0xff; + } else { + /* extract from SPS */ + *data++ = sps[0][3]; + *data++ = sps[0][4]; + *data++ = sps[0][5]; + } /* 6 bits reserved | 2 bits lengthSizeMinusOn */ *data++ = 0xff; /* 3 bits reserved | 5 bits numOfSequenceParameterSets */