[gst-cvs] gst-plugins-good: rtpsession: Small cleanups

Wim Taymans wtay at kemper.freedesktop.org
Mon Sep 13 06:51:55 PDT 2010


Module: gst-plugins-good
Branch: master
Commit: d541f5e24db9c88abeb29be9c134636934c0f131
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=d541f5e24db9c88abeb29be9c134636934c0f131

Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date:   Mon Sep 13 15:44:52 2010 +0200

rtpsession: Small cleanups

Make the property description prettier.
Actually multiple the bandwidth with the fraction.

---

 gst/rtpmanager/gstrtpsession.c |    3 ++-
 gst/rtpmanager/rtpstats.c      |   14 +++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/gst/rtpmanager/gstrtpsession.c b/gst/rtpmanager/gstrtpsession.c
index 63123cd..a8a11df 100644
--- a/gst/rtpmanager/gstrtpsession.c
+++ b/gst/rtpmanager/gstrtpsession.c
@@ -542,7 +542,8 @@ gst_rtp_session_class_init (GstRtpSessionClass * klass)
 
   g_object_class_install_property (gobject_class, PROP_RTCP_FRACTION,
       g_param_spec_double ("rtcp-fraction", "RTCP Fraction",
-          "The RTCP bandwidth of the session in bytes per second (or as a real fraction of the RTP bandwidth if < 1)",
+          "The RTCP bandwidth of the session in bytes per second "
+          "(or as a real fraction of the RTP bandwidth if < 1.0)",
           0.0, G_MAXDOUBLE, DEFAULT_RTCP_FRACTION, G_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class, PROP_RTCP_RR_BANDWIDTH,
diff --git a/gst/rtpmanager/rtpstats.c b/gst/rtpmanager/rtpstats.c
index 8d1f5cf..a7066b5 100644
--- a/gst/rtpmanager/rtpstats.c
+++ b/gst/rtpmanager/rtpstats.c
@@ -58,22 +58,22 @@ rtp_stats_set_bandwidths (RTPSessionStats * stats, guint rtp_bw,
     rtcp_bw = rs + rr;
 
   /* If rtcp_bw is between 0 and 1, it is a fraction of rtp_bw */
-  if (rtcp_bw > 0 && rtcp_bw < 1) {
-    if (rtp_bw > 0)
+  if (rtcp_bw > 0.0 && rtcp_bw < 1.0) {
+    if (rtp_bw > 0.0)
       rtcp_bw = rtp_bw * rtcp_bw;
     else
-      rtcp_bw = -1;
+      rtcp_bw = -1.0;
   }
 
   /* RTCP is 5% of the RTP bandwidth */
-  if (rtp_bw == -1 && rtcp_bw > 0)
+  if (rtp_bw == -1 && rtcp_bw > 1.0)
     rtp_bw = rtcp_bw * 20;
-  else if (rtp_bw != -1 && rtcp_bw < 0)
+  else if (rtp_bw != -1 && rtcp_bw < 0.0)
     rtcp_bw = rtp_bw / 20;
-  else if (rtp_bw == -1 && rtcp_bw < 0) {
+  else if (rtp_bw == -1 && rtcp_bw < 0.0) {
     /* nothing given, take defaults */
     rtp_bw = RTP_STATS_BANDWIDTH;
-    rtcp_bw = rtp_bw = RTP_STATS_RTCP_FRACTION;
+    rtcp_bw = rtp_bw * RTP_STATS_RTCP_FRACTION;
   }
 
   stats->bandwidth = rtp_bw;





More information about the Gstreamer-commits mailing list