baseaudiopay: fix timestamps on buffer lists

Fix the outgoing timestamps and RTP timestamps on outgoing buffers when using
buffer lists.
This commit is contained in:
Wim Taymans 2010-12-30 18:08:05 +01:00
parent bb786dfb5c
commit 678753b325

View file

@ -482,12 +482,11 @@ gst_base_rtp_audio_payload_push (GstBaseRTPAudioPayload * baseaudiopayload,
static GstFlowReturn static GstFlowReturn
gst_base_rtp_audio_payload_push_buffer (GstBaseRTPAudioPayload * gst_base_rtp_audio_payload_push_buffer (GstBaseRTPAudioPayload *
baseaudiopayload, GstBuffer * buffer) baseaudiopayload, GstBuffer * buffer, GstClockTime timestamp)
{ {
GstBaseRTPPayload *basepayload; GstBaseRTPPayload *basepayload;
GstBaseRTPAudioPayloadPrivate *priv; GstBaseRTPAudioPayloadPrivate *priv;
GstBuffer *outbuf; GstBuffer *outbuf;
GstClockTime timestamp;
guint8 *payload; guint8 *payload;
guint payload_len; guint payload_len;
GstFlowReturn ret; GstFlowReturn ret;
@ -496,7 +495,6 @@ gst_base_rtp_audio_payload_push_buffer (GstBaseRTPAudioPayload *
basepayload = GST_BASE_RTP_PAYLOAD (baseaudiopayload); basepayload = GST_BASE_RTP_PAYLOAD (baseaudiopayload);
payload_len = GST_BUFFER_SIZE (buffer); payload_len = GST_BUFFER_SIZE (buffer);
timestamp = GST_BUFFER_TIMESTAMP (buffer);
GST_DEBUG_OBJECT (baseaudiopayload, "Pushing %d bytes ts %" GST_TIME_FORMAT, GST_DEBUG_OBJECT (baseaudiopayload, "Pushing %d bytes ts %" GST_TIME_FORMAT,
payload_len, GST_TIME_ARGS (timestamp)); payload_len, GST_TIME_ARGS (timestamp));
@ -607,7 +605,9 @@ gst_base_rtp_audio_payload_flush (GstBaseRTPAudioPayload * baseaudiopayload,
* anything. */ * anything. */
buffer = gst_adapter_take_buffer (adapter, payload_len); buffer = gst_adapter_take_buffer (adapter, payload_len);
ret = gst_base_rtp_audio_payload_push_buffer (baseaudiopayload, buffer); ret =
gst_base_rtp_audio_payload_push_buffer (baseaudiopayload, buffer,
timestamp);
} else { } else {
/* create buffer to hold the payload */ /* create buffer to hold the payload */
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0); outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
@ -814,23 +814,22 @@ gst_base_rtp_audio_payload_handle_buffer (GstBaseRTPPayload *
guint align; guint align;
guint size; guint size;
gboolean discont; gboolean discont;
GstClockTime timestamp;
ret = GST_FLOW_OK; ret = GST_FLOW_OK;
payload = GST_BASE_RTP_AUDIO_PAYLOAD_CAST (basepayload); payload = GST_BASE_RTP_AUDIO_PAYLOAD_CAST (basepayload);
priv = payload->priv; priv = payload->priv;
timestamp = GST_BUFFER_TIMESTAMP (buffer);
discont = GST_BUFFER_IS_DISCONT (buffer); discont = GST_BUFFER_IS_DISCONT (buffer);
if (discont) { if (discont) {
GstClockTime timestamp;
GST_DEBUG_OBJECT (payload, "Got DISCONT"); GST_DEBUG_OBJECT (payload, "Got DISCONT");
/* flush everything out of the adapter, mark DISCONT */ /* flush everything out of the adapter, mark DISCONT */
ret = gst_base_rtp_audio_payload_flush (payload, -1, -1); ret = gst_base_rtp_audio_payload_flush (payload, -1, -1);
priv->discont = TRUE; priv->discont = TRUE;
timestamp = GST_BUFFER_TIMESTAMP (buffer);
/* get the distance between the timestamp gap and produce the same gap in /* get the distance between the timestamp gap and produce the same gap in
* the RTP timestamps */ * the RTP timestamps */
if (priv->last_timestamp != -1 && timestamp != -1) { if (priv->last_timestamp != -1 && timestamp != -1) {
@ -878,7 +877,7 @@ gst_base_rtp_audio_payload_handle_buffer (GstBaseRTPPayload *
/* If buffer fits on an RTP packet, let's just push it through /* If buffer fits on an RTP packet, let's just push it through
* this will check against max_ptime and max_mtu */ * this will check against max_ptime and max_mtu */
GST_DEBUG_OBJECT (payload, "Fast packet push"); GST_DEBUG_OBJECT (payload, "Fast packet push");
ret = gst_base_rtp_audio_payload_push_buffer (payload, buffer); ret = gst_base_rtp_audio_payload_push_buffer (payload, buffer, timestamp);
} else { } else {
/* push the buffer in the adapter */ /* push the buffer in the adapter */
gst_adapter_push (priv->adapter, buffer); gst_adapter_push (priv->adapter, buffer);