summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2009-08-27 15:46:15 +0200
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2009-08-31 16:50:01 +0200
commit30efa405f35c7bd299de8b457c8b622d37bb00f9 (patch)
tree4c6b794efb014babd47c79222ce8ba817932f8be
parent15fa7d33edeb7a4d2c9c5e8baddab9644e7b82a8 (diff)
rtpmp4gdepay: handle broken AU-Index in non-interleaved streams
In case of non-interleaved (= sequentially payloaded) streams, the AU-Index serves little purpose (that is not already covered by RTP fields). (Broken) Payloaders might consider this field then to be disregarded and have non spec compliant values, e.g. each RTP packet having AU-Index 2 (rather than 0). As such, ensure/force simple sequential sending of non-interleaved streams.
-rw-r--r--gst/rtp/gstrtpmp4gdepay.c18
-rw-r--r--gst/rtp/gstrtpmp4gdepay.h1
2 files changed, 19 insertions, 0 deletions
diff --git a/gst/rtp/gstrtpmp4gdepay.c b/gst/rtp/gstrtpmp4gdepay.c
index e12357aa4..a4c8a4b57 100644
--- a/gst/rtp/gstrtpmp4gdepay.c
+++ b/gst/rtp/gstrtpmp4gdepay.c
@@ -273,12 +273,14 @@ gst_rtp_mp4g_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
rtpmp4gdepay->auxiliarydatasizelength =
gst_rtp_mp4g_depay_parse_int (structure, "auxiliarydatasizelength", 0);
rtpmp4gdepay->constantSize =
gst_rtp_mp4g_depay_parse_int (structure, "constantsize", 0);
rtpmp4gdepay->constantDuration =
gst_rtp_mp4g_depay_parse_int (structure, "constantduration", 0);
+ rtpmp4gdepay->maxDisplacement =
+ gst_rtp_mp4g_depay_parse_int (structure, "maxdisplacement", 0);
/* get config string */
if ((str = gst_structure_get_string (structure, "config"))) {
GValue v = { 0 };
@@ -544,12 +546,28 @@ gst_rtp_mp4g_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
if (rtpmp4gdepay->max_AU_index != -1
&& rtpmp4gdepay->max_AU_index <= AU_index) {
GST_DEBUG_OBJECT (rtpmp4gdepay, "new interleave group, flushing");
/* a new interleave group started, flush */
gst_rtp_mp4g_depay_flush_queue (rtpmp4gdepay);
}
+ if (G_UNLIKELY (!rtpmp4gdepay->maxDisplacement &&
+ rtpmp4gdepay->max_AU_index != -1
+ && rtpmp4gdepay->max_AU_index >= AU_index)) {
+ GstBuffer *outbuf;
+
+ /* some broken non-interleaved streams have AU-index jumping around
+ * all over the place, apparently assuming receiver disregards */
+ GST_DEBUG_OBJECT (rtpmp4gdepay, "non-interleaved broken AU indices;"
+ " forcing continuous flush");
+ /* reset AU to avoid repeated DISCONT in such case */
+ outbuf = g_queue_peek_head (rtpmp4gdepay->packets);
+ if (G_LIKELY (outbuf)) {
+ rtpmp4gdepay->next_AU_index = GST_BUFFER_OFFSET (outbuf);
+ gst_rtp_mp4g_depay_flush_queue (rtpmp4gdepay);
+ }
+ }
rtpmp4gdepay->prev_rtptime = rtptime;
} else {
AU_index_delta =
gst_bs_parse_read (&bs, rtpmp4gdepay->indexdeltalength);
AU_index += AU_index_delta + 1;
}
diff --git a/gst/rtp/gstrtpmp4gdepay.h b/gst/rtp/gstrtpmp4gdepay.h
index b87072c56..9d534a5a7 100644
--- a/gst/rtp/gstrtpmp4gdepay.h
+++ b/gst/rtp/gstrtpmp4gdepay.h
@@ -46,12 +46,13 @@ struct _GstRtpMP4GDepay
gint profile_level_id;
gint streamtype;
gint constantSize;
gint constantDuration;
+ gint maxDisplacement;
gint sizelength;
gint indexlength;
gint indexdeltalength;
gint ctsdeltalength;
gint dtsdeltalength;