Update a ton of audio code to use size_t more correctly and in general reduce
use of int16_t/uint16_t.

This is the upshot of a recommendation by henrik.lundin and kwiberg on an original small change ( https://webrtc-codereview.appspot.com/42569004/#ps1 ) to stop using int16_t just because values could fit in it, and is similar in nature to a previous "mass change to use size_t more" ( https://webrtc-codereview.appspot.com/23129004/ ) which also needed to be split up for review but to land all at once, since, like adding "const", such changes tend to cause a lot of transitive effects.

This was be reviewed and approved in pieces:
https://codereview.webrtc.org/1224093003
https://codereview.webrtc.org/1224123002
https://codereview.webrtc.org/1224163002
https://codereview.webrtc.org/1225133003
https://codereview.webrtc.org/1225173002
https://codereview.webrtc.org/1227163003
https://codereview.webrtc.org/1227203003
https://codereview.webrtc.org/1227213002
https://codereview.webrtc.org/1227893002
https://codereview.webrtc.org/1228793004
https://codereview.webrtc.org/1228803003
https://codereview.webrtc.org/1228823002
https://codereview.webrtc.org/1228823003
https://codereview.webrtc.org/1228843002
https://codereview.webrtc.org/1230693002
https://codereview.webrtc.org/1231713002

The change is being landed as TBR to all the folks who reviewed the above.

BUG=chromium:81439
TEST=none
R=andrew@webrtc.org, pbos@webrtc.org
TBR=aluebs, andrew, asapersson, henrika, hlundin, jan.skoglund, kwiberg, minyue, pbos, pthatcher

Review URL: https://codereview.webrtc.org/1230503003 .

Cr-Commit-Position: refs/heads/master@{#9768}
diff --git a/webrtc/common_audio/channel_buffer.h b/webrtc/common_audio/channel_buffer.h
index a5dcc6c..00ea733 100644
--- a/webrtc/common_audio/channel_buffer.h
+++ b/webrtc/common_audio/channel_buffer.h
@@ -39,9 +39,9 @@
 template <typename T>
 class ChannelBuffer {
  public:
-  ChannelBuffer(int num_frames,
+  ChannelBuffer(size_t num_frames,
                 int num_channels,
-                int num_bands = 1)
+                size_t num_bands = 1)
       : data_(new T[num_frames * num_channels]()),
         channels_(new T*[num_channels * num_bands]),
         bands_(new T*[num_channels * num_bands]),
@@ -50,7 +50,7 @@
         num_channels_(num_channels),
         num_bands_(num_bands) {
     for (int i = 0; i < num_channels_; ++i) {
-      for (int j = 0; j < num_bands_; ++j) {
+      for (size_t j = 0; j < num_bands_; ++j) {
         channels_[j * num_channels_ + i] =
             &data_[i * num_frames_ + j * num_frames_per_band_];
         bands_[i * num_bands_ + j] = channels_[j * num_channels_ + i];
@@ -74,12 +74,11 @@
   // 0 <= band < |num_bands_|
   // 0 <= channel < |num_channels_|
   // 0 <= sample < |num_frames_per_band_|
-  const T* const* channels(int band) const {
+  const T* const* channels(size_t band) const {
     DCHECK_LT(band, num_bands_);
-    DCHECK_GE(band, 0);
     return &channels_[band * num_channels_];
   }
-  T* const* channels(int band) {
+  T* const* channels(size_t band) {
     const ChannelBuffer<T>* t = this;
     return const_cast<T* const*>(t->channels(band));
   }
@@ -103,21 +102,21 @@
 
   // Sets the |slice| pointers to the |start_frame| position for each channel.
   // Returns |slice| for convenience.
-  const T* const* Slice(T** slice, int start_frame) const {
+  const T* const* Slice(T** slice, size_t start_frame) const {
     DCHECK_LT(start_frame, num_frames_);
     for (int i = 0; i < num_channels_; ++i)
       slice[i] = &channels_[i][start_frame];
     return slice;
   }
-  T** Slice(T** slice, int start_frame) {
+  T** Slice(T** slice, size_t start_frame) {
     const ChannelBuffer<T>* t = this;
     return const_cast<T**>(t->Slice(slice, start_frame));
   }
 
-  int num_frames() const { return num_frames_; }
-  int num_frames_per_band() const { return num_frames_per_band_; }
+  size_t num_frames() const { return num_frames_; }
+  size_t num_frames_per_band() const { return num_frames_per_band_; }
   int num_channels() const { return num_channels_; }
-  int num_bands() const { return num_bands_; }
+  size_t num_bands() const { return num_bands_; }
   size_t size() const {return num_frames_ * num_channels_; }
 
   void SetDataForTesting(const T* data, size_t size) {
@@ -129,10 +128,10 @@
   rtc::scoped_ptr<T[]> data_;
   rtc::scoped_ptr<T* []> channels_;
   rtc::scoped_ptr<T* []> bands_;
-  const int num_frames_;
-  const int num_frames_per_band_;
+  const size_t num_frames_;
+  const size_t num_frames_per_band_;
   const int num_channels_;
-  const int num_bands_;
+  const size_t num_bands_;
 };
 
 // One int16_t and one float ChannelBuffer that are kept in sync. The sync is
@@ -143,17 +142,17 @@
 // fbuf() until the next call to any of the other functions.
 class IFChannelBuffer {
  public:
-  IFChannelBuffer(int num_frames, int num_channels, int num_bands = 1);
+  IFChannelBuffer(size_t num_frames, int num_channels, size_t num_bands = 1);
 
   ChannelBuffer<int16_t>* ibuf();
   ChannelBuffer<float>* fbuf();
   const ChannelBuffer<int16_t>* ibuf_const() const;
   const ChannelBuffer<float>* fbuf_const() const;
 
-  int num_frames() const { return ibuf_.num_frames(); }
-  int num_frames_per_band() const { return ibuf_.num_frames_per_band(); }
+  size_t num_frames() const { return ibuf_.num_frames(); }
+  size_t num_frames_per_band() const { return ibuf_.num_frames_per_band(); }
   int num_channels() const { return ibuf_.num_channels(); }
-  int num_bands() const { return ibuf_.num_bands(); }
+  size_t num_bands() const { return ibuf_.num_bands(); }
 
  private:
   void RefreshF() const;