summaryrefslogtreecommitdiffstats
path: root/gst/rtp/gstrtpmp4vpay.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/gstrtpmp4vpay.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/gstrtpmp4vpay.c')
-rw-r--r--gst/rtp/gstrtpmp4vpay.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/gst/rtp/gstrtpmp4vpay.c b/gst/rtp/gstrtpmp4vpay.c
index 08d9b2d3..08644edb 100644
--- a/gst/rtp/gstrtpmp4vpay.c
+++ b/gst/rtp/gstrtpmp4vpay.c
@@ -346,6 +346,7 @@ gst_rtpmp4venc_handle_buffer (GstBaseRTPPayload * basepayload,
guint8 *data;
gboolean flush;
gint strip;
+ GstClockTime duration;
ret = GST_FLOW_OK;
@@ -353,11 +354,13 @@ gst_rtpmp4venc_handle_buffer (GstBaseRTPPayload * basepayload,
size = GST_BUFFER_SIZE (buffer);
data = GST_BUFFER_DATA (buffer);
+ duration = GST_BUFFER_DURATION (buffer);
avail = gst_adapter_available (rtpmp4venc->adapter);
/* empty buffer, take timestamp */
if (avail == 0) {
rtpmp4venc->first_ts = GST_BUFFER_TIMESTAMP (buffer);
+ rtpmp4venc->duration = 0;
}
/* parse incomming data and see if we need to start a new RTP
@@ -382,23 +385,24 @@ gst_rtpmp4venc_handle_buffer (GstBaseRTPPayload * basepayload,
/* if we need to flush, do so now */
if (flush) {
ret = gst_rtpmp4venc_flush (rtpmp4venc);
- avail = 0;
rtpmp4venc->first_ts = GST_BUFFER_TIMESTAMP (buffer);
+ rtpmp4venc->duration = 0;
+ avail = 0;
}
- avail = gst_adapter_available (rtpmp4venc->adapter);
-
/* get packet length of data and see if we exceeded MTU. */
packet_len = gst_rtpbuffer_calc_packet_len (avail + size, 0, 0);
- if (packet_len > GST_BASE_RTP_PAYLOAD_MTU (rtpmp4venc)) {
+ if (gst_basertppayload_is_filled (basepayload,
+ packet_len, rtpmp4venc->duration + duration)) {
ret = gst_rtpmp4venc_flush (rtpmp4venc);
- avail = 0;
rtpmp4venc->first_ts = GST_BUFFER_TIMESTAMP (buffer);
+ rtpmp4venc->duration = 0;
}
/* push new data */
gst_adapter_push (rtpmp4venc->adapter, buffer);
+ rtpmp4venc->duration += duration;
return ret;
}