[gst-cvs] gst-plugins-good: rtpqdm2depay: Handle gaps in incoming packets.
Edward Hervey
bilboed at kemper.freedesktop.org
Mon Aug 3 12:32:32 PDT 2009
Module: gst-plugins-good
Branch: master
Commit: 25c5514fab38ca0d62bbbf0a0d5cc771d0be2ae6
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=25c5514fab38ca0d62bbbf0a0d5cc771d0be2ae6
Author: Edward Hervey <bilboed at bilboed.com>
Date: Mon Aug 3 21:22:48 2009 +0200
rtpqdm2depay: Handle gaps in incoming packets.
Whenever we see a gap, we flush the temporary packets (but not the adapter). If we
had some data temporarily stored it will be outputted (the sound will sound a bit
garbled... but that's how it sounds on MacOSX :)
---
gst/rtp/gstrtpqdmdepay.c | 18 +++++++++++++++++-
gst/rtp/gstrtpqdmdepay.h | 1 +
2 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/gst/rtp/gstrtpqdmdepay.c b/gst/rtp/gstrtpqdmdepay.c
index 36384f9..01ad473 100644
--- a/gst/rtp/gstrtpqdmdepay.c
+++ b/gst/rtp/gstrtpqdmdepay.c
@@ -239,6 +239,7 @@ gst_rtp_qdm2_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
{
GstRtpQDM2Depay *rtpqdm2depay;
GstBuffer *outbuf;
+ guint16 seq;
rtpqdm2depay = GST_RTP_QDM2_DEPAY (depayload);
@@ -253,8 +254,20 @@ gst_rtp_qdm2_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
goto bad_packet;
payload = gst_rtp_buffer_get_payload (buf);
+ seq = gst_rtp_buffer_get_seq (buf);
+ if (G_UNLIKELY (seq != rtpqdm2depay->nextseq)) {
+ GST_DEBUG ("GAP in sequence number, Resetting data !");
+ /* Flush previous data */
+ flush_data (rtpqdm2depay);
+ /* And store new timestamp */
+ rtpqdm2depay->ptimestamp = rtpqdm2depay->timestamp;
+ rtpqdm2depay->timestamp = GST_BUFFER_TIMESTAMP (buf);
+ /* And that previous data will be pushed at the bottom */
+ }
+ rtpqdm2depay->nextseq = seq + 1;
- GST_DEBUG ("Payload size %d 0x%x", payload_len, payload_len);
+ GST_DEBUG ("Payload size %d 0x%x sequence:%d", payload_len, payload_len,
+ seq);
GST_MEMDUMP ("Incoming payload", payload, payload_len);
@@ -348,8 +361,11 @@ gst_rtp_qdm2_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
avail = gst_adapter_available (rtpqdm2depay->adapter);
if (G_UNLIKELY (avail)) {
+ GST_DEBUG ("Pushing out %d bytes of collected data");
outbuf = gst_adapter_take_buffer (rtpqdm2depay->adapter, avail);
GST_BUFFER_TIMESTAMP (outbuf) = rtpqdm2depay->ptimestamp;
+ GST_DEBUG ("Outgoing buffer timestamp %" GST_TIME_FORMAT,
+ GST_TIME_ARGS (rtpqdm2depay->ptimestamp));
return outbuf;
}
}
diff --git a/gst/rtp/gstrtpqdmdepay.h b/gst/rtp/gstrtpqdmdepay.h
index 815cd4d..d678d1a 100644
--- a/gst/rtp/gstrtpqdmdepay.h
+++ b/gst/rtp/gstrtpqdmdepay.h
@@ -53,6 +53,7 @@ struct _GstRtpQDM2Depay
GstAdapter *adapter;
+ guint16 nextseq;
gboolean configured;
GstClockTime timestamp; /* Timestamp of current incoming data */
More information about the Gstreamer-commits
mailing list