summaryrefslogtreecommitdiffstats
path: root/gst/rtp
diff options
context:
space:
mode:
authorEdward Hervey <bilboed@bilboed.com>2009-08-03 21:22:48 +0200
committerEdward Hervey <bilboed@bilboed.com>2009-08-03 21:26:30 +0200
commit25c5514fab38ca0d62bbbf0a0d5cc771d0be2ae6 (patch)
tree6b4fda7ac9cdbb80dc4f645f13ccfdb9ebd7905a /gst/rtp
parent6aff520a24168d49f06c3925e76de0156e786a60 (diff)
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 :)
Diffstat (limited to 'gst/rtp')
-rw-r--r--gst/rtp/gstrtpqdmdepay.c18
-rw-r--r--gst/rtp/gstrtpqdmdepay.h1
2 files changed, 18 insertions, 1 deletions
diff --git a/gst/rtp/gstrtpqdmdepay.c b/gst/rtp/gstrtpqdmdepay.c
index 36384f90..01ad4733 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 815cd4d0..d678d1a3 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 */