[gst-cvs] gst-plugins-base: basertpaudiopayload: Respect ptime if it is given
Olivier Crête
tester at kemper.freedesktop.org
Tue Jan 5 10:21:06 PST 2010
Module: gst-plugins-base
Branch: master
Commit: bc6179952b292110964e808b16ae127be5b221f9
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=bc6179952b292110964e808b16ae127be5b221f9
Author: Olivier Crête <olivier.crete at collabora.co.uk>
Date: Tue Dec 29 18:45:32 2009 -0500
basertpaudiopayload: Respect ptime if it is given
If the ptime is given in the caps, respect it and force the minimum
and maximum sizes to be exactly the requested ptime.
https://bugzilla.gnome.org/show_bug.cgi?id=606050
---
gst-libs/gst/rtp/gstbasertpaudiopayload.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/gst-libs/gst/rtp/gstbasertpaudiopayload.c b/gst-libs/gst/rtp/gstbasertpaudiopayload.c
index 966d93d..1daa783 100644
--- a/gst-libs/gst/rtp/gstbasertpaudiopayload.c
+++ b/gst-libs/gst/rtp/gstbasertpaudiopayload.c
@@ -98,6 +98,7 @@ struct _GstBaseRTPAudioPayloadPrivate
guint cached_mtu;
guint cached_min_ptime;
guint cached_max_ptime;
+ guint cached_ptime;
guint cached_min_length;
guint cached_max_length;
};
@@ -516,6 +517,7 @@ gst_base_rtp_audio_payload_get_lengths (GstBaseRTPPayload *
/* check cached values */
if (G_LIKELY (priv->cached_mtu == mtu
+ && priv->cached_ptime == basepayload->abidata.ABI.ptime
&& priv->cached_max_ptime == basepayload->max_ptime
&& priv->cached_min_ptime == basepayload->min_ptime)) {
/* if nothing changed, return cached values */
@@ -546,8 +548,21 @@ gst_base_rtp_audio_payload_get_lengths (GstBaseRTPPayload *
if (*min_payload_len > *max_payload_len)
*min_payload_len = *max_payload_len;
+ /* If the ptime is specified in the caps, tried to adhere to it exactly */
+ if (basepayload->abidata.ABI.ptime) {
+ guint ptime_in_bytes = priv->time_to_bytes (payload,
+ basepayload->abidata.ABI.ptime);
+
+ /* 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;
+ }
+
/* cache values */
priv->cached_mtu = mtu;
+ priv->cached_ptime = basepayload->abidata.ABI.ptime;
priv->cached_min_ptime = basepayload->min_ptime;
priv->cached_max_ptime = basepayload->max_ptime;
priv->cached_min_length = *min_payload_len;
More information about the Gstreamer-commits
mailing list