summaryrefslogtreecommitdiffstats
path: root/gst/rtp/gstrtph264depay.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2007-04-10 17:06:05 +0000
committerWim Taymans <wim.taymans@gmail.com>2007-04-10 17:06:05 +0000
commitacddbd83ff23d7016afdcfad5da3d3aa82b63679 (patch)
tree0a7c756fb05a0c6bfb3a1babfd85d327684b5f91 /gst/rtp/gstrtph264depay.c
parent497d589d56cf5e0ef758ca6c0443cdee7b3da91d (diff)
gst/rtp/gstrtpamrdepay.c: Fix depayloader clock_rate and some cleanups.
Original commit message from CVS: * gst/rtp/gstrtpamrdepay.c: (gst_rtp_amr_depay_setcaps), (gst_rtp_amr_depay_process): Fix depayloader clock_rate and some cleanups. * gst/rtp/gstrtph264depay.c: (gst_rtp_h264_depay_finalize), (gst_rtp_h264_depay_setcaps), (gst_rtp_h264_depay_process): * gst/rtp/gstrtph264depay.h: Don't push codec_data in the adapter because it might get flushed when we get a discont. * gst/rtp/gstrtpmp4gdepay.c: (gst_rtp_mp4g_depay_process): Handle multiple AU per packet. * gst/rtp/gstrtpsv3vdepay.c: (gst_rtp_sv3v_depay_process), (gst_rtp_sv3v_depay_plugin_init): Disable rank, this one does not work. Remove timestamping, base class does that.
Diffstat (limited to 'gst/rtp/gstrtph264depay.c')
-rw-r--r--gst/rtp/gstrtph264depay.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/gst/rtp/gstrtph264depay.c b/gst/rtp/gstrtph264depay.c
index 11376797..be27910d 100644
--- a/gst/rtp/gstrtph264depay.c
+++ b/gst/rtp/gstrtph264depay.c
@@ -154,8 +154,10 @@ gst_rtp_h264_depay_finalize (GObject * object)
rtph264depay = GST_RTP_H264_DEPAY (object);
+ if (rtph264depay->codec_data)
+ gst_buffer_unref (rtph264depay->codec_data);
+
g_object_unref (rtph264depay->adapter);
- rtph264depay->adapter = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -255,9 +257,12 @@ gst_rtp_h264_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
}
GST_BUFFER_SIZE (codec_data) = total;
- /* don't set codec_data, we send unpacketized data so let the decoder
- * packetize for us */
- gst_adapter_push (rtph264depay->adapter, codec_data);
+ /* keep the codec_data, we need to send it as the first buffer. We cannot
+ * push it in the adapter because the adapter might be flushed on discont.
+ */
+ if (rtph264depay->codec_data)
+ gst_buffer_unref (rtph264depay->codec_data);
+ rtph264depay->codec_data = codec_data;
}
gst_pad_set_caps (depayload->srcpad, srccaps);
@@ -333,6 +338,12 @@ gst_rtp_h264_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
rtph264depay->wait_start = FALSE;
+ /* prepend codec_data */
+ if (rtph264depay->codec_data) {
+ gst_adapter_push (rtph264depay->adapter, rtph264depay->codec_data);
+ rtph264depay->codec_data = NULL;
+ }
+
/* STAP-A Single-time aggregation packet 5.7.1 */
while (payload_len > 2) {
/* 1
@@ -446,13 +457,20 @@ gst_rtp_h264_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
/* if NAL unit ends, flush the adapter */
if (E) {
+ GST_DEBUG_OBJECT (rtph264depay, "output %d bytes", outsize);
+
outsize = gst_adapter_available (rtph264depay->adapter);
outbuf = gst_adapter_take_buffer (rtph264depay->adapter, outsize);
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (depayload->srcpad));
- GST_DEBUG_OBJECT (rtph264depay, "output %d bytes", outsize);
-
+ /* push codec_data first */
+ if (rtph264depay->codec_data) {
+ gst_buffer_set_caps (rtph264depay->codec_data,
+ GST_PAD_CAPS (depayload->srcpad));
+ gst_base_rtp_depayload_push (depayload, rtph264depay->codec_data);
+ rtph264depay->codec_data = NULL;
+ }
return outbuf;
}
break;
@@ -473,6 +491,13 @@ gst_rtp_h264_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (depayload->srcpad));
+ /* push codec_data first */
+ if (rtph264depay->codec_data) {
+ gst_buffer_set_caps (rtph264depay->codec_data,
+ GST_PAD_CAPS (depayload->srcpad));
+ gst_base_rtp_depayload_push (depayload, rtph264depay->codec_data);
+ rtph264depay->codec_data = NULL;
+ }
return outbuf;
}
}