Renaming bandwidth to bitrate in webrtcvoiceengine.

"bandwidth" is usually a misleading mentioning. It can mean network throughput, audio frequency contents, etc.

This is to remove the confusion inside webrtcvoiceengine

BUG=
R=juberti@webrtc.org, pbos@webrtc.org, tina.legrand@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/28799004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7551 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/media/webrtc/webrtcvoiceengine.cc b/talk/media/webrtc/webrtcvoiceengine.cc
index 5f2de4a..de53893 100644
--- a/talk/media/webrtc/webrtcvoiceengine.cc
+++ b/talk/media/webrtc/webrtcvoiceengine.cc
@@ -495,7 +495,7 @@
                          ARRAY_SIZE(kCodecPrefs) - (pref - kCodecPrefs));
         LOG(LS_INFO) << ToString(codec);
         if (IsIsac(codec)) {
-          // Indicate auto-bandwidth in signaling.
+          // Indicate auto-bitrate in signaling.
           codec.bitrate = 0;
         }
         if (IsOpus(codec)) {
@@ -1227,7 +1227,7 @@
           // Apply codec-specific settings.
           if (IsIsac(codec)) {
             // If ISAC and an explicit bitrate is not specified,
-            // enable auto bandwidth adjustment.
+            // enable auto bitrate adjustment.
             voe_codec.rate = (in.bitrate > 0) ? in.bitrate : -1;
           }
           *out = voe_codec;
@@ -1792,8 +1792,8 @@
     : WebRtcMediaChannel<VoiceMediaChannel, WebRtcVoiceEngine>(
           engine,
           engine->CreateMediaVoiceChannel()),
-      send_bw_setting_(false),
-      send_bw_bps_(0),
+      send_bitrate_setting_(false),
+      send_bitrate_bps_(0),
       options_(),
       dtmf_allowed_(false),
       desired_playout_(false),
@@ -2028,9 +2028,7 @@
   bool nack_enabled = nack_enabled_;
   bool enable_codec_fec = false;
 
-  // max_playback_rate <= 0 will not trigger setting of maximum encoding
-  // bandwidth.
-  int max_playback_rate = 0;
+  int opus_max_playback_rate = 0;
 
   // Set send codec (the first non-telephone-event/CN codec)
   for (std::vector<AudioCodec>::const_iterator it = codecs.begin();
@@ -2048,7 +2046,6 @@
       continue;
     }
 
-
     // We'll use the first codec in the list to actually send audio data.
     // Be sure to use the payload type requested by the remote side.
     // "red", for RED audio, is a special case where the actual codec to be
@@ -2080,7 +2077,8 @@
       // For Opus as the send codec, we are to enable inband FEC if requested
       // and set maximum playback rate.
       if (IsOpus(*it)) {
-        GetOpusConfig(*it, &send_codec, &enable_codec_fec, &max_playback_rate);
+        GetOpusConfig(*it, &send_codec, &enable_codec_fec,
+                      &opus_max_playback_rate);
       }
     }
     found_send_codec = true;
@@ -2116,15 +2114,16 @@
   }
 
   // maxplaybackrate should be set after SetSendCodec.
-  if (max_playback_rate > 0) {
+  // If opus_max_playback_rate <= 0, the default maximum playback rate of 48 kHz
+  // will be used.
+  if (opus_max_playback_rate > 0) {
     LOG(LS_INFO) << "Attempt to set maximum playback rate to "
-                 << max_playback_rate
+                 << opus_max_playback_rate
                  << " Hz on channel "
                  << channel;
 #ifdef USE_WEBRTC_DEV_BRANCH
-    // (max_playback_rate + 1) >> 1 is to obtain ceil(max_playback_rate / 2.0).
     if (engine()->voe()->codec()->SetOpusMaxPlaybackRate(
-        channel, max_playback_rate) == -1) {
+        channel, opus_max_playback_rate) == -1) {
       LOG(LS_WARNING) << "Could not set maximum playback rate.";
     }
 #endif
@@ -2133,8 +2132,8 @@
   // Always update the |send_codec_| to the currently set send codec.
   send_codec_.reset(new webrtc::CodecInst(send_codec));
 
-  if (send_bw_setting_) {
-    SetSendBandwidthInternal(send_bw_bps_);
+  if (send_bitrate_setting_) {
+    SetSendBitrateInternal(send_bitrate_bps_);
   }
 
   // Loop through the codecs list again to config the telephone-event/CN codec.
@@ -3187,25 +3186,27 @@
   return true;
 }
 
+// TODO(minyue): SetMaxSendBandwidth() is subject to be renamed to
+// SetMaxSendBitrate() in future.
 bool WebRtcVoiceMediaChannel::SetMaxSendBandwidth(int bps) {
-  LOG(LS_INFO) << "WebRtcVoiceMediaChanne::SetSendBandwidth.";
+  LOG(LS_INFO) << "WebRtcVoiceMediaChannel::SetMaxSendBandwidth.";
 
-  return SetSendBandwidthInternal(bps);
+  return SetSendBitrateInternal(bps);
 }
 
-bool WebRtcVoiceMediaChannel::SetSendBandwidthInternal(int bps) {
-  LOG(LS_INFO) << "WebRtcVoiceMediaChannel::SetSendBandwidthInternal.";
+bool WebRtcVoiceMediaChannel::SetSendBitrateInternal(int bps) {
+  LOG(LS_INFO) << "WebRtcVoiceMediaChannel::SetSendBitrateInternal.";
 
-  send_bw_setting_ = true;
-  send_bw_bps_ = bps;
+  send_bitrate_setting_ = true;
+  send_bitrate_bps_ = bps;
 
   if (!send_codec_) {
     LOG(LS_INFO) << "The send codec has not been set up yet. "
-                 << "The send bandwidth setting will be applied later.";
+                 << "The send bitrate setting will be applied later.";
     return true;
   }
 
-  // Bandwidth is auto by default.
+  // Bitrate is auto by default.
   // TODO(bemasc): Fix this so that if SetMaxSendBandwidth(50) is followed by
   // SetMaxSendBandwith(0), the second call removes the previous limit.
   if (bps <= 0)
diff --git a/talk/media/webrtc/webrtcvoiceengine.h b/talk/media/webrtc/webrtcvoiceengine.h
index 8d762d4..f19059b 100644
--- a/talk/media/webrtc/webrtcvoiceengine.h
+++ b/talk/media/webrtc/webrtcvoiceengine.h
@@ -435,7 +435,7 @@
     return channel_id == voe_channel();
   }
   bool SetSendCodecs(int channel, const std::vector<AudioCodec>& codecs);
-  bool SetSendBandwidthInternal(int bps);
+  bool SetSendBitrateInternal(int bps);
 
   bool SetHeaderExtension(ExtensionSetterFunction setter, int channel_id,
                           const RtpHeaderExtension* extension);
@@ -453,8 +453,8 @@
   std::vector<AudioCodec> recv_codecs_;
   std::vector<AudioCodec> send_codecs_;
   rtc::scoped_ptr<webrtc::CodecInst> send_codec_;
-  bool send_bw_setting_;
-  int send_bw_bps_;
+  bool send_bitrate_setting_;
+  int send_bitrate_bps_;
   AudioOptions options_;
   bool dtmf_allowed_;
   bool desired_playout_;