summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2007-04-05 15:05:24 +0000
committerWim Taymans <wim.taymans@gmail.com>2007-04-05 15:05:24 +0000
commit32c1c29d686eccd37c58a07c417397bc824b7a81 (patch)
treefff474eefc14dcf1ce886148e24a6bb604a7db0f /gst
parentb1e2b088796ab44ae047a76960d65ef5ace8f627 (diff)
downloadgst-plugins-bad-32c1c29d686eccd37c58a07c417397bc824b7a81.tar.gz
gst-plugins-bad-32c1c29d686eccd37c58a07c417397bc824b7a81.tar.bz2
gst-plugins-bad-32c1c29d686eccd37c58a07c417397bc824b7a81.zip
gst/qtdemux/gstrtpxqtdepay.*: Try to recover from packet loss a little better.
Original commit message from CVS: * gst/qtdemux/gstrtpxqtdepay.c: (gst_rtp_xqt_depay_process), (gst_rtp_xqt_depay_change_state): * gst/qtdemux/gstrtpxqtdepay.h: Try to recover from packet loss a little better.
Diffstat (limited to 'gst')
-rw-r--r--gst/qtdemux/gstrtpxqtdepay.c25
-rw-r--r--gst/qtdemux/gstrtpxqtdepay.h1
2 files changed, 25 insertions, 1 deletions
diff --git a/gst/qtdemux/gstrtpxqtdepay.c b/gst/qtdemux/gstrtpxqtdepay.c
index 30e4ce3b..0a147ef4 100644
--- a/gst/qtdemux/gstrtpxqtdepay.c
+++ b/gst/qtdemux/gstrtpxqtdepay.c
@@ -278,9 +278,10 @@ gst_rtp_xqt_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
if (!gst_rtp_buffer_validate (buf))
goto bad_packet;
- /* discont, clear adapter */
if (GST_BUFFER_IS_DISCONT (buf)) {
+ /* discont, clear adapter and try to find a new packet start */
gst_adapter_clear (rtpxqtdepay->adapter);
+ rtpxqtdepay->need_resync = TRUE;
}
m = gst_rtp_buffer_get_marker (buf);
@@ -325,6 +326,22 @@ gst_rtp_xqt_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
"VER: %d, PCK: %d, S: %d, Q: %d, L: %d, D: %d, ID: %d", ver, pck, s, q,
l, d, rtpxqtdepay->current_id);
+ if (rtpxqtdepay->need_resync) {
+ /* we need to find the boundary of a new packet after a DISCONT */
+ if (pck != 3 || q) {
+ /* non-fragmented packet or payload description present, packet starts
+ * here. */
+ rtpxqtdepay->need_resync = FALSE;
+ } else {
+ /* fragmented packet without description */
+ if (m) {
+ /* marker bit set, next packet is start of new one */
+ rtpxqtdepay->need_resync = FALSE;
+ }
+ goto need_resync;
+ }
+ }
+
payload += 4;
payload_len -= 4;
@@ -625,6 +642,11 @@ bad_packet:
("Packet did not validate."), (NULL));
return NULL;
}
+need_resync:
+ {
+ GST_DEBUG_OBJECT (rtpxqtdepay, "waiting for marker");
+ return NULL;
+ }
wrong_version:
{
GST_ELEMENT_WARNING (rtpxqtdepay, STREAM, DECODE,
@@ -688,6 +710,7 @@ gst_rtp_xqt_depay_change_state (GstElement * element, GstStateChange transition)
gst_adapter_clear (rtpxqtdepay->adapter);
rtpxqtdepay->previous_id = -1;
rtpxqtdepay->current_id = -1;
+ rtpxqtdepay->need_resync = FALSE;
break;
default:
break;
diff --git a/gst/qtdemux/gstrtpxqtdepay.h b/gst/qtdemux/gstrtpxqtdepay.h
index 39c5813b..23cf6eea 100644
--- a/gst/qtdemux/gstrtpxqtdepay.h
+++ b/gst/qtdemux/gstrtpxqtdepay.h
@@ -46,6 +46,7 @@ struct _GstRtpXQTDepay
GstAdapter *adapter;
+ gboolean need_resync;
guint16 previous_id;
guint16 current_id;
};