From: Olivier CrĂȘte Date: Thu, 31 Dec 2009 21:27:30 +0000 (-0500) Subject: rtpg729pay: Support ptime from caps X-Git-Tag: RELEASE-0.10.18~109 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a1858779294c091c4022837f5dfab2928dfebed;p=platform%2Fupstream%2Fgst-plugins-good.git rtpg729pay: Support ptime from caps https://bugzilla.gnome.org/show_bug.cgi?id=606050 --- diff --git a/gst/rtp/gstrtpg729pay.c b/gst/rtp/gstrtpg729pay.c index 8337f98..3f64527 100644 --- a/gst/rtp/gstrtpg729pay.c +++ b/gst/rtp/gstrtpg729pay.c @@ -190,9 +190,7 @@ gst_rtp_g729_pay_handle_buffer (GstBaseRTPPayload * payload, GstBuffer * buf) /* min number of bytes based on a given ptime, has to be a multiple of frame duration */ { - guint64 min_ptime; - - g_object_get (G_OBJECT (payload), "min-ptime", &min_ptime, NULL); + guint64 min_ptime = payload->min_ptime; min_ptime = min_ptime / 1000000; minptime_octets = G729_FRAME_SIZE * @@ -205,6 +203,18 @@ gst_rtp_g729_pay_handle_buffer (GstBaseRTPPayload * payload, GstBuffer * buf) min_payload_len = max_payload_len; } + /* If the ptime is specified in the caps, tried to adhere to it exactly */ + if (payload->abidata.ABI.ptime) { + guint ptime_in_bytes = G729_FRAME_SIZE * + (guint) (payload->abidata.ABI.ptime / G729_FRAME_DURATION_MS); + + /* clip to computed min and max lengths */ + ptime_in_bytes = MAX (min_payload_len, ptime_in_bytes); + ptime_in_bytes = MIN (max_payload_len, ptime_in_bytes); + + min_payload_len = max_payload_len = ptime_in_bytes; + } + GST_LOG_OBJECT (basertpaudiopayload, "Calculated min_payload_len %u and max_payload_len %u", min_payload_len, max_payload_len);