summaryrefslogtreecommitdiffstats
path: root/gst/rtp/gstrtpmpapay.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2005-09-22 14:13:36 +0000
committerWim Taymans <wim.taymans@gmail.com>2005-09-22 14:13:36 +0000
commit7067b806e016f349cb9e83e49eddc8ede4d9c0d5 (patch)
treea1e67c37153ba889c5cf89636df0f30a83b8195c /gst/rtp/gstrtpmpapay.c
parent4aac63130ad939751a44f827d11f8d0ed79e53ac (diff)
gst/rtp/: Use is_filled to both check MTU and max-ptime of base class.
Original commit message from CVS: * gst/rtp/TODO: * gst/rtp/gstrtpdec.c: (gst_rtpdec_getcaps): * gst/rtp/gstrtpmp4venc.c: (gst_rtpmp4venc_class_init), (gst_rtpmp4venc_parse_data), (gst_rtpmp4venc_handle_buffer), (gst_rtpmp4venc_set_property): * gst/rtp/gstrtpmp4venc.h: * gst/rtp/gstrtpmpaenc.c: (gst_rtpmpaenc_handle_buffer): * gst/rtp/gstrtpmpaenc.h: Use is_filled to both check MTU and max-ptime of base class.
Diffstat (limited to 'gst/rtp/gstrtpmpapay.c')
-rw-r--r--gst/rtp/gstrtpmpapay.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gst/rtp/gstrtpmpapay.c b/gst/rtp/gstrtpmpapay.c
index 34aa254e..34d3202e 100644
--- a/gst/rtp/gstrtpmpapay.c
+++ b/gst/rtp/gstrtpmpapay.c
@@ -225,11 +225,18 @@ gst_rtpmpaenc_handle_buffer (GstBaseRTPPayload * basepayload,
GstFlowReturn ret;
guint size, avail;
guint packet_len;
+ GstClockTime duration;
rtpmpaenc = GST_RTP_MPA_ENC (basepayload);
size = GST_BUFFER_SIZE (buffer);
+ duration = GST_BUFFER_DURATION (buffer);
+
avail = gst_adapter_available (rtpmpaenc->adapter);
+ if (avail == 0) {
+ rtpmpaenc->first_ts = GST_BUFFER_TIMESTAMP (buffer);
+ rtpmpaenc->duration = 0;
+ }
/* get packet length of previous data and this new data,
* payload length includes a 4 byte header */
@@ -237,18 +244,17 @@ gst_rtpmpaenc_handle_buffer (GstBaseRTPPayload * basepayload,
/* if this buffer is going to overflow the packet, flush what we
* have. */
- if (packet_len > GST_BASE_RTP_PAYLOAD_MTU (rtpmpaenc)) {
+ if (gst_basertppayload_is_filled (basepayload,
+ packet_len, rtpmpaenc->duration + duration)) {
ret = gst_rtpmpaenc_flush (rtpmpaenc);
- avail = 0;
+ rtpmpaenc->first_ts = GST_BUFFER_TIMESTAMP (buffer);
+ rtpmpaenc->duration = 0;
} else {
ret = GST_FLOW_OK;
}
gst_adapter_push (rtpmpaenc->adapter, buffer);
-
- if (avail == 0) {
- rtpmpaenc->first_ts = GST_BUFFER_TIMESTAMP (buffer);
- }
+ rtpmpaenc->duration += duration;
return ret;
}