summaryrefslogtreecommitdiff
path: root/gst/rtp/gstrtph264depay.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2011-09-28 12:44:59 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2011-09-28 12:44:59 +0200
commit87fbd1e7840d604b133a4daf9c7b0651db66889a (patch)
tree0d99ea4efb2b93f725f9e90bba42cde2bbeb4851 /gst/rtp/gstrtph264depay.c
parent3f0b062d2f09fe83095b9f43bf31e953f2edd6f2 (diff)
parent827c3aa14b3efd48c68e6ab565b29e6cfc0c0ca9 (diff)
Merge branch 'master' into 0.11
Conflicts: common ext/pulse/pulsesink.c ext/soup/gstsouphttpclientsink.c gst/audioparsers/gstaacparse.c gst/audioparsers/gstac3parse.c gst/rtp/gstrtph264depay.c gst/rtpmanager/gstrtpjitterbuffer.c gst/rtpmanager/rtpjitterbuffer.c gst/rtsp/gstrtspsrc.c sys/ximage/gstximagesrc.c
Diffstat (limited to 'gst/rtp/gstrtph264depay.c')
-rw-r--r--gst/rtp/gstrtph264depay.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/gst/rtp/gstrtph264depay.c b/gst/rtp/gstrtph264depay.c
index 35078f94d..c3c08ff82 100644
--- a/gst/rtp/gstrtph264depay.c
+++ b/gst/rtp/gstrtph264depay.c
@@ -501,7 +501,7 @@ gst_rtp_h264_complete_au (GstRtpH264Depay * rtph264depay,
* so downstream waiting for keyframe can pick up at SPS/PPS/IDR */
#define NAL_TYPE_IS_KEY(nt) (((nt) == 5) || ((nt) == 7) || ((nt) == 8))
-static gboolean
+static GstBuffer *
gst_rtp_h264_depay_handle_nal (GstRtpH264Depay * rtph264depay, GstBuffer * nal,
GstClockTime in_timestamp, gboolean marker)
{
@@ -584,11 +584,9 @@ gst_rtp_h264_depay_handle_nal (GstRtpH264Depay * rtph264depay, GstBuffer * nal,
GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
else
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
-
- gst_base_rtp_depayload_push (depayload, outbuf);
}
- return TRUE;
+ return outbuf;
/* ERRORS */
short_nal:
@@ -596,12 +594,13 @@ short_nal:
GST_WARNING_OBJECT (depayload, "dropping short NAL");
gst_buffer_unmap (nal, data, size);
gst_buffer_unref (nal);
- return FALSE;
+ return NULL;
}
}
-static void
-gst_rtp_h264_push_fragmentation_unit (GstRtpH264Depay * rtph264depay)
+static GstBuffer *
+gst_rtp_h264_push_fragmentation_unit (GstRtpH264Depay * rtph264depay,
+ gboolean send)
{
guint outsize;
guint8 *outdata;
@@ -624,17 +623,26 @@ gst_rtp_h264_push_fragmentation_unit (GstRtpH264Depay * rtph264depay)
}
gst_buffer_unmap (outbuf, outdata, -1);
- gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf,
- rtph264depay->fu_timestamp, rtph264depay->fu_marker);
-
rtph264depay->current_fu_type = 0;
+
+ if (send) {
+ outbuf = gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf,
+ rtph264depay->fu_timestamp, rtph264depay->fu_marker);
+ if (outbuf)
+ gst_base_rtp_depayload_push (GST_BASE_RTP_DEPAYLOAD (rtph264depay),
+ outbuf);
+ return NULL;
+ } else {
+ return gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf,
+ rtph264depay->fu_timestamp, rtph264depay->fu_marker);
+ }
}
static GstBuffer *
gst_rtp_h264_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
{
GstRtpH264Depay *rtph264depay;
- GstBuffer *outbuf;
+ GstBuffer *outbuf = NULL;
guint8 nal_unit_type;
GstRTPBuffer rtp = { NULL };
@@ -692,7 +700,7 @@ gst_rtp_h264_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
* when the FU ended) and send out what we gathered thusfar */
if (G_UNLIKELY (rtph264depay->current_fu_type != 0 &&
nal_unit_type != rtph264depay->current_fu_type))
- gst_rtp_h264_push_fragmentation_unit (rtph264depay);
+ gst_rtp_h264_push_fragmentation_unit (rtph264depay, TRUE);
switch (nal_unit_type) {
case 0:
@@ -755,7 +763,8 @@ gst_rtp_h264_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
outsize = gst_adapter_available (rtph264depay->adapter);
outbuf = gst_adapter_take_buffer (rtph264depay->adapter, outsize);
- gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf, timestamp, marker);
+ outbuf = gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf, timestamp,
+ marker);
break;
}
case 26:
@@ -798,7 +807,7 @@ gst_rtp_h264_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
* Assume that the remote payloader is buggy (doesn't set the end
* bit) and send out what we've gathered thusfar */
if (G_UNLIKELY (rtph264depay->current_fu_type != 0))
- gst_rtp_h264_push_fragmentation_unit (rtph264depay);
+ gst_rtp_h264_push_fragmentation_unit (rtph264depay, TRUE);
rtph264depay->current_fu_type = nal_unit_type;
rtph264depay->fu_timestamp = timestamp;
@@ -844,11 +853,12 @@ gst_rtp_h264_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
gst_adapter_push (rtph264depay->adapter, outbuf);
}
+ outbuf = NULL;
rtph264depay->fu_marker = marker;
/* if NAL unit ends, flush the adapter */
if (E)
- gst_rtp_h264_push_fragmentation_unit (rtph264depay);
+ outbuf = gst_rtp_h264_push_fragmentation_unit (rtph264depay, FALSE);
break;
}
default:
@@ -872,14 +882,15 @@ gst_rtp_h264_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
memcpy (outdata + sizeof (sync_bytes), payload, nalu_size);
gst_buffer_unmap (outbuf, outdata, outsize);
- gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf, timestamp, marker);
+ outbuf = gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf, timestamp,
+ marker);
break;
}
}
gst_rtp_buffer_unmap (&rtp);
}
- return NULL;
+ return outbuf;
/* ERRORS */
undefined_type: