diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2007-03-29 14:40:35 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2007-03-29 14:40:35 +0000 |
commit | a87260cb3bcf022486875648b72a0ef37d2b0a7f (patch) | |
tree | 27b2bfbb3571e06c2bb92052d8c8f2616086253b /gst/rtp/gstrtph264depay.c | |
parent | da3e23d3758e7c5b38b27c4894f1f0845e5231e9 (diff) |
gst/rtp/: Flush adapter on disconts.
Original commit message from CVS:
* gst/rtp/gstasteriskh263.h:
* gst/rtp/gstrtph263pdepay.c: (gst_rtp_h263p_depay_process),
(gst_rtp_h263p_depay_change_state):
* gst/rtp/gstrtph263pdepay.h:
* gst/rtp/gstrtph264depay.c: (gst_rtp_h264_depay_class_init),
(gst_rtp_h264_depay_setcaps), (gst_rtp_h264_depay_process),
(gst_rtp_h264_depay_change_state):
* gst/rtp/gstrtph264depay.h:
* gst/rtp/gstrtpmp4adepay.c: (gst_rtp_mp4a_depay_class_init),
(gst_rtp_mp4a_depay_setcaps), (gst_rtp_mp4a_depay_process):
* gst/rtp/gstrtpmp4gdepay.c: (gst_rtp_mp4g_depay_process):
Flush adapter on disconts.
Diffstat (limited to 'gst/rtp/gstrtph264depay.c')
-rw-r--r-- | gst/rtp/gstrtph264depay.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gst/rtp/gstrtph264depay.c b/gst/rtp/gstrtph264depay.c index 47538076..11376797 100644 --- a/gst/rtp/gstrtph264depay.c +++ b/gst/rtp/gstrtph264depay.c @@ -278,6 +278,12 @@ gst_rtp_h264_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) if (!gst_rtp_buffer_validate (buf)) goto bad_packet; + /* flush remaining data on discont */ + if (GST_BUFFER_IS_DISCONT (buf)) { + gst_adapter_clear (rtph264depay->adapter); + rtph264depay->wait_start = TRUE; + } + { gint payload_len; guint8 *payload; @@ -325,6 +331,8 @@ gst_rtp_h264_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) payload += header_len; payload_len -= header_len; + rtph264depay->wait_start = FALSE; + /* STAP-A Single-time aggregation packet 5.7.1 */ while (payload_len > 2) { /* 1 @@ -390,10 +398,15 @@ gst_rtp_h264_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) GST_DEBUG_OBJECT (rtph264depay, "S %d, E %d", S, E); + if (rtph264depay->wait_start && !S) + goto waiting_start; + if (S) { /* NAL unit starts here */ guint8 nal_header; + rtph264depay->wait_start = FALSE; + /* reconstruct NAL header */ nal_header = (payload[0] & 0xe0) | (payload[1] & 0x1f); @@ -446,6 +459,8 @@ gst_rtp_h264_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) } default: { + rtph264depay->wait_start = FALSE; + /* 1-23 NAL unit Single NAL unit packet per H.264 5.6 */ /* the entire payload is the output buffer */ nalu_size = payload_len; @@ -478,6 +493,11 @@ undefined_type: (NULL), ("Undefined packet type")); return NULL; } +waiting_start: + { + GST_DEBUG_OBJECT (rtph264depay, "waiting for start"); + return NULL; + } not_implemented: { GST_ELEMENT_ERROR (rtph264depay, STREAM, FORMAT, @@ -530,6 +550,7 @@ gst_rtp_h264_depay_change_state (GstElement * element, break; case GST_STATE_CHANGE_READY_TO_PAUSED: gst_adapter_clear (rtph264depay->adapter); + rtph264depay->wait_start = TRUE; break; default: break; |