From 2873efa44b6d1784eea22b4a6d50bfc96d17566f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?=
 <rafael.carre@savoirfairelinux.com>
Date: Mon, 8 Aug 2011 17:42:22 -0400
Subject: [PATCH] * #6611 : remove unused bandwidth codec information

---
 sflphone-client-gnome/src/codeclist.c             |  3 ---
 sflphone-client-gnome/src/codeclist.h             |  4 +---
 sflphone-client-gnome/src/config/audioconf.c      |  7 -------
 sflphone-common/src/Codec.h                       |  5 -----
 sflphone-common/src/audio/codecs/alaw.cpp         |  1 -
 sflphone-common/src/audio/codecs/audiocodec.cpp   | 11 +++--------
 sflphone-common/src/audio/codecs/audiocodec.h     |  5 -----
 .../src/audio/codecs/audiocodecfactory.cpp        | 15 ---------------
 .../src/audio/codecs/audiocodecfactory.h          |  9 ---------
 sflphone-common/src/audio/codecs/celtcodec.cpp    |  1 -
 sflphone-common/src/audio/codecs/g722.cpp         |  1 -
 sflphone-common/src/audio/codecs/gsmcodec.cpp     |  1 -
 .../src/audio/codecs/speexcodec_nb.cpp            |  1 -
 .../src/audio/codecs/speexcodec_ub.cpp            |  1 -
 .../src/audio/codecs/speexcodec_wb.cpp            |  1 -
 sflphone-common/src/audio/codecs/ulaw.cpp         |  1 -
 16 files changed, 4 insertions(+), 63 deletions(-)

diff --git a/sflphone-client-gnome/src/codeclist.c b/sflphone-client-gnome/src/codeclist.c
index 04d4736fb2..246ad2f130 100644
--- a/sflphone-client-gnome/src/codeclist.c
+++ b/sflphone-client-gnome/src/codeclist.c
@@ -132,7 +132,6 @@ void codec_create_new (gint payload, gboolean active, codec_t **c)
     codec->name = specs[0];
     codec->sample_rate = atoi (specs[1]);
     codec->_bitrate = atoi (specs[2]);
-    codec->_bandwidth = atoi (specs[3]);
     codec->is_active = active;
 
     *c = codec;
@@ -148,7 +147,6 @@ void codec_create_new_with_specs (gint payload, gchar **specs, gboolean active,
     codec->name = strdup(specs[0]);
     codec->sample_rate = atoi (specs[1]);
     codec->_bitrate = atoi (specs[2]);
-    codec->_bandwidth = atoi (specs[3]);
     codec->is_active = active;
 
     *c = codec;
@@ -169,7 +167,6 @@ void codec_create_new_from_caps (codec_t *original, codec_t **copy)
     codec->name = original->name;
     codec->sample_rate = original->sample_rate;
     codec->_bitrate = original->_bitrate;
-    codec->_bandwidth = original->_bandwidth;
     codec->is_active = original->is_active;
 
     *copy = codec;
diff --git a/sflphone-client-gnome/src/codeclist.h b/sflphone-client-gnome/src/codeclist.h
index fe62bb37f7..c7412e1aae 100644
--- a/sflphone-client-gnome/src/codeclist.h
+++ b/sflphone-client-gnome/src/codeclist.h
@@ -48,8 +48,6 @@ typedef struct {
     int sample_rate;
     /** Bitrate */
     gdouble _bitrate;
-    /** Bandwidth */
-    gdouble _bandwidth;
 } codec_t;
 
 /** @struct codec_t
@@ -158,7 +156,7 @@ void codec_create_new (gint payload, gboolean active, codec_t **c);
  * Instanciate a new codec with the given specification
  *
  * @param payload	The unique RTP payload
- * @param specs		A list of codec specifications. Ordered: name, sample rate, bit rate, bandwith
+ * @param specs		A list of codec specifications. Ordered: name, sample rate, bit rate
  * @param active	Whether or not this codec should active (checked)
  * @param c			A pointer to receive the new codec instance
  */
diff --git a/sflphone-client-gnome/src/config/audioconf.c b/sflphone-client-gnome/src/config/audioconf.c
index c3ecb8077f..3e860164f1 100644
--- a/sflphone-client-gnome/src/config/audioconf.c
+++ b/sflphone-client-gnome/src/config/audioconf.c
@@ -58,7 +58,6 @@ enum {
     COLUMN_CODEC_NAME,
     COLUMN_CODEC_FREQUENCY,
     COLUMN_CODEC_BITRATE,
-    COLUMN_CODEC_BANDWIDTH,
     CODEC_COLUMN_COUNT
 };
 
@@ -95,7 +94,6 @@ static void preferences_dialog_fill_codec_list (account_t *a)
                                 COLUMN_CODEC_NAME,		c->name,										// Name
                                 COLUMN_CODEC_FREQUENCY,	g_strdup_printf ("%d kHz", c->sample_rate/1000),	// Frequency (kHz)
                                 COLUMN_CODEC_BITRATE,	g_strdup_printf ("%.1f kbps", c->_bitrate),		// Bitrate (kbps)
-                                COLUMN_CODEC_BANDWIDTH,	g_strdup_printf ("%.1f kbps", c->_bandwidth),	// Bandwidth (kpbs)
                                 -1);
         }
     }
@@ -693,11 +691,6 @@ GtkWidget* audiocodecs_box (account_t *a)
     treeViewColumn = gtk_tree_view_column_new_with_attributes (_ ("Bitrate"), renderer, "text", COLUMN_CODEC_BITRATE, NULL);
     gtk_tree_view_append_column (GTK_TREE_VIEW (codecTreeView), treeViewColumn);
 
-    // Frequency column
-    renderer = gtk_cell_renderer_text_new();
-    treeViewColumn = gtk_tree_view_column_new_with_attributes (_ ("Bandwidth"), renderer, "text", COLUMN_CODEC_BANDWIDTH, NULL);
-    gtk_tree_view_append_column (GTK_TREE_VIEW (codecTreeView), treeViewColumn);
-
     g_object_unref (G_OBJECT (codecStore));
     gtk_container_add (GTK_CONTAINER (scrolledWindow), codecTreeView);
 
diff --git a/sflphone-common/src/Codec.h b/sflphone-common/src/Codec.h
index f8f4d57d2c..c432a039e3 100644
--- a/sflphone-common/src/Codec.h
+++ b/sflphone-common/src/Codec.h
@@ -66,11 +66,6 @@ class Codec
          */
         virtual double getBitRate() const = 0;
 
-        /**
-         * @return The expected bandwidth used by this codec.
-         */
-        virtual double getBandwidth() const = 0;
-
         /**
          * Build a unique hash code for identifying the codec uniquely.
          * Note that if multiple implementations of codec are provided,
diff --git a/sflphone-common/src/audio/codecs/alaw.cpp b/sflphone-common/src/audio/codecs/alaw.cpp
index b5d8c64026..7f488952d1 100644
--- a/sflphone-common/src/audio/codecs/alaw.cpp
+++ b/sflphone-common/src/audio/codecs/alaw.cpp
@@ -43,7 +43,6 @@ class Alaw : public sfl::AudioCodec
             _frameSize = 160; // samples, 20 ms at 8kHz
             _channel   = 1;
             _bitrate = 64;
-            _bandwidth = 80;
             _hasDynamicPayload = false;
         }
 
diff --git a/sflphone-common/src/audio/codecs/audiocodec.cpp b/sflphone-common/src/audio/codecs/audiocodec.cpp
index 98b372e4f0..ed5c5cc95f 100644
--- a/sflphone-common/src/audio/codecs/audiocodec.cpp
+++ b/sflphone-common/src/audio/codecs/audiocodec.cpp
@@ -38,15 +38,15 @@ namespace sfl {
 
 AudioCodec::AudioCodec (uint8 payload, const std::string &codecName) :
         _codecName (codecName), _clockRate (8000), _channel (1), _bitrate (0.0),
-        _bandwidth (0), _hasDynamicPayload (false), _payload(payload)
+        _hasDynamicPayload (false), _payload(payload)
 {
     init (payload, _clockRate);
 }
 
 AudioCodec::AudioCodec (const AudioCodec& codec) :
         _codecName (codec._codecName), _clockRate (codec._clockRate), _channel (
-            codec._channel), _bitrate (codec._bitrate), _bandwidth (
-                codec._bandwidth), _hasDynamicPayload (false), _payload(codec._payload)
+            codec._channel), _bitrate (codec._bitrate),
+            _hasDynamicPayload (false), _payload(codec._payload)
 {
     init (codec._payload, codec._clockRate);
 }
@@ -110,11 +110,6 @@ double AudioCodec::getBitRate (void) const
     return _bitrate;
 }
 
-double AudioCodec::getBandwidth (void) const
-{
-    return _bandwidth;
-}
-
 AudioCodec::~AudioCodec()
 {
     delete _payloadFormat;
diff --git a/sflphone-common/src/audio/codecs/audiocodec.h b/sflphone-common/src/audio/codecs/audiocodec.h
index 5a8030e409..7f443db054 100644
--- a/sflphone-common/src/audio/codecs/audiocodec.h
+++ b/sflphone-common/src/audio/codecs/audiocodec.h
@@ -128,11 +128,6 @@ class AudioCodec : public Codec
          */
         double getBitRate() const;
 
-        /**
-         * @Override
-         */
-        double getBandwidth() const;
-
         /**
          * @return the framing size for this codec.
          */
diff --git a/sflphone-common/src/audio/codecs/audiocodecfactory.cpp b/sflphone-common/src/audio/codecs/audiocodecfactory.cpp
index 8c13e13a18..2142e5bc1b 100644
--- a/sflphone-common/src/audio/codecs/audiocodecfactory.cpp
+++ b/sflphone-common/src/audio/codecs/audiocodecfactory.cpp
@@ -129,16 +129,6 @@ double AudioCodecFactory::getBitRate (AudioCodecType payload)
         return 0.0;
 }
 
-double AudioCodecFactory::getBandwidthPerCall (AudioCodecType payload)
-{
-
-    CodecsMap::iterator iter = _CodecsMap.find (payload);
-
-    if (iter!=_CodecsMap.end())
-        return (iter->second->getBandwidth());
-    else
-        return 0.0;
-}
 
 int AudioCodecFactory::getSampleRate (AudioCodecType payload)
 {
@@ -417,11 +407,6 @@ std::vector <std::string> AudioCodecFactory::getCodecSpecifications (const int32
     v.push_back ( (ss.str()).data());
     ss.str ("");
 
-    // Add the bandwidth information
-    ss << getBandwidthPerCall ( (AudioCodecType) payload);
-    v.push_back ( (ss.str()).data());
-    ss.str ("");
-
     return v;
 
 }
diff --git a/sflphone-common/src/audio/codecs/audiocodecfactory.h b/sflphone-common/src/audio/codecs/audiocodecfactory.h
index 46a88e3afd..fa8c053f01 100644
--- a/sflphone-common/src/audio/codecs/audiocodecfactory.h
+++ b/sflphone-common/src/audio/codecs/audiocodecfactory.h
@@ -106,15 +106,6 @@ class AudioCodecFactory
          */
         double getBitRate (AudioCodecType payload);
 
-        /**
-         * Get the bandwidth for one call with the specified codec.
-         * The value has been calculated with the further information:
-         * RTp communication, SIP protocol (the value with IAX2 is very close), no RTCP, one simultaneous call, for one channel (the incoming one).
-         * @param payload The payload of the codec
-         * @return double The bandwidth
-         */
-        double getBandwidthPerCall (AudioCodecType payload);
-
         /**
          * Get the clock rate of the specified codec
          * @param payload The payload of the codec
diff --git a/sflphone-common/src/audio/codecs/celtcodec.cpp b/sflphone-common/src/audio/codecs/celtcodec.cpp
index a2d5bb1b14..9e9f15141f 100644
--- a/sflphone-common/src/audio/codecs/celtcodec.cpp
+++ b/sflphone-common/src/audio/codecs/celtcodec.cpp
@@ -43,7 +43,6 @@ class Celt : public sfl::AudioCodec
             _frameSize = 320;  // fixed frameSize, TODO: support variable size from 64 to 512
             _channel = 1;
             _bitrate = 0;
-            _bandwidth = 0;
             _hasDynamicPayload = true;
 
             initCelt();
diff --git a/sflphone-common/src/audio/codecs/g722.cpp b/sflphone-common/src/audio/codecs/g722.cpp
index 7b613272b6..4ea5e7c869 100644
--- a/sflphone-common/src/audio/codecs/g722.cpp
+++ b/sflphone-common/src/audio/codecs/g722.cpp
@@ -54,7 +54,6 @@ class G722 : public sfl::AudioCodec
             _frameSize = 320; // samples, 20 ms at 16kHz
             _channel   = 1;
             _bitrate = 64;
-            _bandwidth = 80;
             _hasDynamicPayload = false;
 
 
diff --git a/sflphone-common/src/audio/codecs/gsmcodec.cpp b/sflphone-common/src/audio/codecs/gsmcodec.cpp
index b58d356d26..0cba124532 100644
--- a/sflphone-common/src/audio/codecs/gsmcodec.cpp
+++ b/sflphone-common/src/audio/codecs/gsmcodec.cpp
@@ -49,7 +49,6 @@ class Gsm : public sfl::AudioCodec
             _frameSize = 160; // samples, 20 ms at 8kHz
             _channel = 1;
             _bitrate = 13.3;
-            _bandwidth = 29.2;
             _hasDynamicPayload = false;
 
             if (! (_decode_gsmhandle = gsm_create()))
diff --git a/sflphone-common/src/audio/codecs/speexcodec_nb.cpp b/sflphone-common/src/audio/codecs/speexcodec_nb.cpp
index 38cb80eb34..151b781b62 100644
--- a/sflphone-common/src/audio/codecs/speexcodec_nb.cpp
+++ b/sflphone-common/src/audio/codecs/speexcodec_nb.cpp
@@ -50,7 +50,6 @@ class Speex : public sfl::AudioCodec
             _frameSize = 160; // samples, 20 ms at 8kHz
             _channel = 1;
             _bitrate = 24;
-            _bandwidth = 0;
             _hasDynamicPayload = true;
             initSpeex();
         }
diff --git a/sflphone-common/src/audio/codecs/speexcodec_ub.cpp b/sflphone-common/src/audio/codecs/speexcodec_ub.cpp
index 82b8ea0d5b..b3f956297d 100644
--- a/sflphone-common/src/audio/codecs/speexcodec_ub.cpp
+++ b/sflphone-common/src/audio/codecs/speexcodec_ub.cpp
@@ -49,7 +49,6 @@ class Speex : public sfl::AudioCodec
             _frameSize = 640; // 20 ms at 32 kHz
             _channel = 1;
             _bitrate = 0;
-            _bandwidth = 0;
             _hasDynamicPayload = true;
             initSpeex();
         }
diff --git a/sflphone-common/src/audio/codecs/speexcodec_wb.cpp b/sflphone-common/src/audio/codecs/speexcodec_wb.cpp
index 93030198d9..482d9f47cf 100644
--- a/sflphone-common/src/audio/codecs/speexcodec_wb.cpp
+++ b/sflphone-common/src/audio/codecs/speexcodec_wb.cpp
@@ -49,7 +49,6 @@ class Speex : public sfl::AudioCodec
             _frameSize = 320; // 20 ms at 16 kHz
             _channel = 1;
             _bitrate = 42;
-            _bandwidth = 0;
             initSpeex();
         }
 
diff --git a/sflphone-common/src/audio/codecs/ulaw.cpp b/sflphone-common/src/audio/codecs/ulaw.cpp
index d090f493a4..0032eb9dc9 100644
--- a/sflphone-common/src/audio/codecs/ulaw.cpp
+++ b/sflphone-common/src/audio/codecs/ulaw.cpp
@@ -45,7 +45,6 @@ class Ulaw : public sfl::AudioCodec
             _frameSize = 160; // samples, 20 ms at 8kHz
             _channel   = 1;
             _bitrate =  64;
-            _bandwidth = 80;
             _hasDynamicPayload = false;
         }
 
-- 
GitLab