diff --git a/ChangeLog b/ChangeLog index ac2905cc15..907539fe29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2007-09-19 Wim Taymans + + * gst/rtp/gstrtpL16pay.c: (gst_rtp_L16_pay_handle_buffer): + Removed some unused code. + + * gst/rtp/gstrtpamrpay.c: (gst_rtp_amr_pay_handle_buffer): + * gst/rtp/gstrtpgsmpay.c: (gst_rtp_gsm_pay_handle_buffer): + * gst/rtp/gstrtpmp2tpay.c: (gst_rtp_mp2t_pay_handle_buffer): + * gst/rtp/gstrtpspeexpay.c: (gst_rtp_speex_pay_handle_buffer): + * gst/rtp/gstrtptheorapay.c: (gst_rtp_theora_pay_init_packet), + (gst_rtp_theora_pay_flush_packet): + * gst/rtp/gstrtpvorbispay.c: (gst_rtp_vorbis_pay_flush_packet): + Try to preserve the incomming buffer duration on the outgoing + packets. Fixes #478244. + 2007-09-18 Tim-Philipp Müller * ext/taglib/gstapev2mux.cc: diff --git a/gst/rtp/gstrtpL16pay.c b/gst/rtp/gstrtpL16pay.c index bef6bc17db..9f561c580a 100644 --- a/gst/rtp/gstrtpL16pay.c +++ b/gst/rtp/gstrtpL16pay.c @@ -238,14 +238,13 @@ gst_rtp_L16_pay_handle_buffer (GstBaseRTPPayload * basepayload, GstRtpL16Pay *rtpL16pay; GstFlowReturn ret = GST_FLOW_OK; guint payload_len; - GstClockTime timestamp, duration; + GstClockTime timestamp; guint mtu, avail; rtpL16pay = GST_RTP_L16_PAY (basepayload); mtu = GST_BASE_RTP_PAYLOAD_MTU (rtpL16pay); timestamp = GST_BUFFER_TIMESTAMP (buffer); - duration = GST_BUFFER_DURATION (buffer); if (GST_BUFFER_IS_DISCONT (buffer)) gst_adapter_clear (rtpL16pay->adapter); diff --git a/gst/rtp/gstrtpamrpay.c b/gst/rtp/gstrtpamrpay.c index e32b11f3f4..6d781147c8 100644 --- a/gst/rtp/gstrtpamrpay.c +++ b/gst/rtp/gstrtpamrpay.c @@ -205,7 +205,7 @@ gst_rtp_amr_pay_handle_buffer (GstBaseRTPPayload * basepayload, guint size, payload_len; GstBuffer *outbuf; guint8 *payload, *data, *payload_amr; - GstClockTime timestamp; + GstClockTime timestamp, duration; guint packet_len, mtu; gint i, num_packets, num_nonempty_packets; gint amr_len; @@ -217,6 +217,7 @@ gst_rtp_amr_pay_handle_buffer (GstBaseRTPPayload * basepayload, size = GST_BUFFER_SIZE (buffer); data = GST_BUFFER_DATA (buffer); timestamp = GST_BUFFER_TIMESTAMP (buffer); + duration = GST_BUFFER_DURATION (buffer); /* setup frame size pointer */ if (rtpamrpay->mode == GST_RTP_AMR_P_MODE_NB) @@ -276,6 +277,12 @@ gst_rtp_amr_pay_handle_buffer (GstBaseRTPPayload * basepayload, GST_BUFFER_TIMESTAMP (outbuf) = count * 20 * GST_MSECOND; } + if (duration != GST_CLOCK_TIME_NONE) + GST_BUFFER_DURATION (outbuf) = duration; + else { + GST_BUFFER_DURATION (outbuf) = 20 * GST_MSECOND; + } + /* get payload, this is now writable */ payload = gst_rtp_buffer_get_payload (outbuf); diff --git a/gst/rtp/gstrtpgsmpay.c b/gst/rtp/gstrtpgsmpay.c index bedee4c788..f09d091d69 100644 --- a/gst/rtp/gstrtpgsmpay.c +++ b/gst/rtp/gstrtpgsmpay.c @@ -129,13 +129,14 @@ gst_rtp_gsm_pay_handle_buffer (GstBaseRTPPayload * basepayload, guint size, payload_len; GstBuffer *outbuf; guint8 *payload, *data; - GstClockTime timestamp; + GstClockTime timestamp, duration; GstFlowReturn ret; rtpgsmpay = GST_RTP_GSM_PAY (basepayload); size = GST_BUFFER_SIZE (buffer); timestamp = GST_BUFFER_TIMESTAMP (buffer); + duration = GST_BUFFER_DURATION (buffer); /* FIXME, only one GSM frame per RTP packet for now */ payload_len = size; @@ -144,8 +145,9 @@ gst_rtp_gsm_pay_handle_buffer (GstBaseRTPPayload * basepayload, /* FIXME, assert for now */ g_assert (payload_len <= GST_BASE_RTP_PAYLOAD_MTU (rtpgsmpay)); - /* copy timestamp */ + /* copy timestamp and duration */ GST_BUFFER_TIMESTAMP (outbuf) = timestamp; + GST_BUFFER_DURATION (outbuf) = duration; /* get payload */ payload = gst_rtp_buffer_get_payload (outbuf); diff --git a/gst/rtp/gstrtpmp2tpay.c b/gst/rtp/gstrtpmp2tpay.c index acc66d64b1..03698b1f7c 100644 --- a/gst/rtp/gstrtpmp2tpay.c +++ b/gst/rtp/gstrtpmp2tpay.c @@ -118,7 +118,7 @@ gst_rtp_mp2t_pay_handle_buffer (GstBaseRTPPayload * basepayload, guint size, payload_len; GstBuffer *outbuf; guint8 *payload, *data; - GstClockTime timestamp; + GstClockTime timestamp, duration; GstFlowReturn ret; rtpmp2tpay = GST_RTP_MP2T_PAY (basepayload); @@ -126,6 +126,7 @@ gst_rtp_mp2t_pay_handle_buffer (GstBaseRTPPayload * basepayload, size = GST_BUFFER_SIZE (buffer); data = GST_BUFFER_DATA (buffer); timestamp = GST_BUFFER_TIMESTAMP (buffer); + duration = GST_BUFFER_DURATION (buffer); /* FIXME, only one MP2T frame per RTP packet for now */ payload_len = size; @@ -134,6 +135,7 @@ gst_rtp_mp2t_pay_handle_buffer (GstBaseRTPPayload * basepayload, /* copy timestamp */ GST_BUFFER_TIMESTAMP (outbuf) = timestamp; + GST_BUFFER_DURATION (outbuf) = duration; /* get payload */ payload = gst_rtp_buffer_get_payload (outbuf); diff --git a/gst/rtp/gstrtpspeexpay.c b/gst/rtp/gstrtpspeexpay.c index 2ca72408d5..1e871bebe2 100644 --- a/gst/rtp/gstrtpspeexpay.c +++ b/gst/rtp/gstrtpspeexpay.c @@ -209,7 +209,7 @@ gst_rtp_speex_pay_handle_buffer (GstBaseRTPPayload * basepayload, guint size, payload_len; GstBuffer *outbuf; guint8 *payload, *data; - GstClockTime timestamp; + GstClockTime timestamp, duration; GstFlowReturn ret; rtpspeexpay = GST_RTP_SPEEX_PAY (basepayload); @@ -236,6 +236,7 @@ gst_rtp_speex_pay_handle_buffer (GstBaseRTPPayload * basepayload, } timestamp = GST_BUFFER_TIMESTAMP (buffer); + duration = GST_BUFFER_DURATION (buffer); /* FIXME, only one SPEEX frame per RTP packet for now */ payload_len = size; @@ -244,8 +245,10 @@ gst_rtp_speex_pay_handle_buffer (GstBaseRTPPayload * basepayload, /* FIXME, assert for now */ g_assert (payload_len <= GST_BASE_RTP_PAYLOAD_MTU (rtpspeexpay)); - /* copy timestamp */ + /* copy timestamp and duration */ GST_BUFFER_TIMESTAMP (outbuf) = timestamp; + GST_BUFFER_DURATION (outbuf) = duration; + /* get payload */ payload = gst_rtp_buffer_get_payload (outbuf); diff --git a/gst/rtp/gstrtptheorapay.c b/gst/rtp/gstrtptheorapay.c index c8f907e6f1..6601e2d2eb 100644 --- a/gst/rtp/gstrtptheorapay.c +++ b/gst/rtp/gstrtptheorapay.c @@ -163,6 +163,7 @@ gst_rtp_theora_pay_init_packet (GstRtpTheoraPay * rtptheorapay, guint8 TDT, gst_rtp_buffer_new_allocate_len (GST_BASE_RTP_PAYLOAD_MTU (rtptheorapay), 0, 0); gst_rtp_theora_pay_reset_packet (rtptheorapay, TDT); + GST_BUFFER_TIMESTAMP (rtptheorapay->packet) = timestamp; } @@ -203,6 +204,8 @@ gst_rtp_theora_pay_flush_packet (GstRtpTheoraPay * rtptheorapay) hlen = gst_rtp_buffer_calc_header_len (0); GST_BUFFER_SIZE (rtptheorapay->packet) = hlen + rtptheorapay->payload_pos; + GST_BUFFER_DURATION (rtptheorapay->packet) = rtptheorapay->payload_duration; + /* push, this gives away our ref to the packet, so clear it. */ ret = gst_basertppayload_push (GST_BASE_RTP_PAYLOAD (rtptheorapay), diff --git a/gst/rtp/gstrtpvorbispay.c b/gst/rtp/gstrtpvorbispay.c index f8d19ce44f..37eef6fcea 100644 --- a/gst/rtp/gstrtpvorbispay.c +++ b/gst/rtp/gstrtpvorbispay.c @@ -199,6 +199,8 @@ gst_rtp_vorbis_pay_flush_packet (GstRtpVorbisPay * rtpvorbispay) hlen = gst_rtp_buffer_calc_header_len (0); GST_BUFFER_SIZE (rtpvorbispay->packet) = hlen + rtpvorbispay->payload_pos; + GST_BUFFER_DURATION (rtpvorbispay->packet) = rtpvorbispay->payload_duration; + /* push, this gives away our ref to the packet, so clear it. */ ret = gst_basertppayload_push (GST_BASE_RTP_PAYLOAD (rtpvorbispay),