Landing pkasting's webrtc fixes for MSVC level 4 warnings in WebRTC.
---

Fixes for re-enabling more MSVC level 4 warnings: webrtc/ edition

This contains fixes for the following sorts of issues:
* Possibly-uninitialized local variable
* Signedness mismatch
* Assignment inside conditional

This also contains a small number of other cleanups to nearby code. In
particular several warning-disables for MSVC are removed because they don't seem
to be necessary (either that warning is not enabled or the code does not trigger
it).

BUG=crbug.com/81439
TEST=none
R=henrika@webrtc.org, pkasting@chromium.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6667 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/base/nssstreamadapter.cc b/webrtc/base/nssstreamadapter.cc
index 1d06c1c..f4b2d31 100644
--- a/webrtc/base/nssstreamadapter.cc
+++ b/webrtc/base/nssstreamadapter.cc
@@ -952,17 +952,11 @@
 // Static initialization and shutdown
 NSSContext *NSSContext::Instance() {
   if (!global_nss_context) {
-    NSSContext *new_ctx = new NSSContext();
-
-    if (!(new_ctx->slot_ = PK11_GetInternalSlot())) {
-      delete new_ctx;
-      goto fail;
-    }
-
-    global_nss_context = new_ctx;
+    scoped_ptr<NSSContext> new_ctx(new NSSContext());
+    new_ctx->slot_ = PK11_GetInternalSlot();
+    if (new_ctx->slot_)
+      global_nss_context = new_ctx.release();
   }
-
- fail:
   return global_nss_context;
 }
 
diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c b/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c
index fa54a8d..d47eb80 100644
--- a/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c
+++ b/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c
@@ -2243,8 +2243,6 @@
   } else {
     ISACUBStruct* instUB = &(instISAC->instUB);
     ISACLBStruct* instLB = &(instISAC->instLB);
-    double bottleneckLB;
-    double bottleneckUB;
     int32_t bottleneck = instISAC->bottleneck;
     int16_t codingMode = instISAC->codingMode;
     int16_t frameSizeMs = instLB->ISACencLB_obj.new_framelength /
@@ -2263,6 +2261,8 @@
       instISAC->maxRateBytesPer30Ms = STREAM_SIZE_MAX_30;
     } else if ((encoder_operational_rate == kIsacSuperWideband) &&
                (instISAC->encoderSamplingRateKHz == kIsacWideband)) {
+      double bottleneckLB = 0;
+      double bottleneckUB = 0;
       if (codingMode == 1) {
         WebRtcIsac_RateAllocation(bottleneck, &bottleneckLB, &bottleneckUB,
                                   &(instISAC->bandwidthKHz));
diff --git a/webrtc/modules/audio_coding/main/acm2/acm_generic_codec.cc b/webrtc/modules/audio_coding/main/acm2/acm_generic_codec.cc
index d16d1d3..db776d2 100644
--- a/webrtc/modules/audio_coding/main/acm2/acm_generic_codec.cc
+++ b/webrtc/modules/audio_coding/main/acm2/acm_generic_codec.cc
@@ -838,7 +838,7 @@
   // Calculate number of samples in 10 ms blocks, and number ms in one frame.
   int16_t samples_in_10ms = static_cast<int16_t>(freq_hz / 100);
   int32_t frame_len_ms = static_cast<int32_t>(frame_len_smpl_) * 1000 / freq_hz;
-  int16_t status;
+  int16_t status = -1;
 
   // Vector for storing maximum 30 ms of mono audio at 48 kHz.
   int16_t audio[1440];
diff --git a/webrtc/modules/audio_coding/main/acm2/acm_opus.cc b/webrtc/modules/audio_coding/main/acm2/acm_opus.cc
index 544c932..638c72a 100644
--- a/webrtc/modules/audio_coding/main/acm2/acm_opus.cc
+++ b/webrtc/modules/audio_coding/main/acm2/acm_opus.cc
@@ -80,7 +80,7 @@
   if (codec_id_ != ACMCodecDB::kOpus) {
     WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
                  "Wrong codec id for Opus.");
-    sample_freq_ = -1;
+    sample_freq_ = 0xFFFF;
     bitrate_ = -1;
   }
   return;
diff --git a/webrtc/modules/audio_coding/main/acm2/acm_speex.cc b/webrtc/modules/audio_coding/main/acm2/acm_speex.cc
index 84a0592..c4d7628 100644
--- a/webrtc/modules/audio_coding/main/acm2/acm_speex.cc
+++ b/webrtc/modules/audio_coding/main/acm2/acm_speex.cc
@@ -30,7 +30,7 @@
       vbr_enabled_(false),
       encoding_rate_(-1),
       sampling_frequency_(-1),
-      samples_in_20ms_audio_(-1) {
+      samples_in_20ms_audio_(0xFFFF) {
   return;
 }
 
diff --git a/webrtc/modules/audio_processing/agc/digital_agc.c b/webrtc/modules/audio_processing/agc/digital_agc.c
index 4b169c1..d0f7b10 100644
--- a/webrtc/modules/audio_processing/agc/digital_agc.c
+++ b/webrtc/modules/audio_processing/agc/digital_agc.c
@@ -310,7 +310,7 @@
     int32_t gain32, delta;
     int16_t logratio;
     int16_t lower_thr, upper_thr;
-    int16_t zeros, zeros_fast, frac;
+    int16_t zeros = 0, zeros_fast, frac = 0;
     int16_t decay;
     int16_t gate, gain_adj;
     int16_t k, n;
diff --git a/webrtc/modules/interface/module_common_types.h b/webrtc/modules/interface/module_common_types.h
index e37313c..398808f 100644
--- a/webrtc/modules/interface/module_common_types.h
+++ b/webrtc/modules/interface/module_common_types.h
@@ -20,11 +20,6 @@
 #include "webrtc/common_types.h"
 #include "webrtc/typedefs.h"
 
-#ifdef _WIN32
-// Remove warning "new behavior: elements of array will be default initialized".
-#pragma warning(disable : 4351)
-#endif
-
 namespace webrtc {
 
 struct RTPAudioHeader {
@@ -34,21 +29,10 @@
   uint8_t channel;                    // number of channels 2 = stereo
 };
 
-enum {
-  kNoPictureId = -1
-};
-enum {
-  kNoTl0PicIdx = -1
-};
-enum {
-  kNoTemporalIdx = -1
-};
-enum {
-  kNoKeyIdx = -1
-};
-enum {
-  kNoSimulcastIdx = 0
-};
+const int16_t kNoPictureId = -1;
+const int16_t kNoTl0PicIdx = -1;
+const uint8_t kNoTemporalIdx = 0xFF;
+const int kNoKeyIdx = -1;
 
 struct RTPVideoHeaderVP8 {
   void InitRTPVideoHeaderVP8() {
@@ -67,7 +51,7 @@
                               // kNoPictureId if PictureID does not exist.
   int16_t tl0PicIdx;          // TL0PIC_IDX, 8 bits;
                               // kNoTl0PicIdx means no value provided.
-  int8_t temporalIdx;         // Temporal layer index, or kNoTemporalIdx.
+  uint8_t temporalIdx;        // Temporal layer index, or kNoTemporalIdx.
   bool layerSync;             // This frame is a layer sync frame.
                               // Disabled if temporalIdx == kNoTemporalIdx.
   int keyIdx;                 // 5 bits; kNoKeyIdx means not used.
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index 34a08a8..349340f 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -85,7 +85,7 @@
           CriticalSectionWrapper::CreateCriticalSection()),
       default_module_(
           static_cast<ModuleRtpRtcpImpl*>(configuration.default_module)),
-      padding_index_(-1),  // Start padding at the first child module.
+      padding_index_(static_cast<size_t>(-1)),  // Start padding at first child.
       nack_method_(kNackOff),
       nack_last_time_sent_full_(0),
       nack_last_seq_number_sent_(0),
diff --git a/webrtc/modules/rtp_rtcp/source/tmmbr_help.cc b/webrtc/modules/rtp_rtcp/source/tmmbr_help.cc
index ecdf6b8..fb1ed62 100644
--- a/webrtc/modules/rtp_rtcp/source/tmmbr_help.cc
+++ b/webrtc/modules/rtp_rtcp/source/tmmbr_help.cc
@@ -266,180 +266,177 @@
                 numBoundingSet++;
             }
         }
-        if (numBoundingSet != 1)
-        {
-            numBoundingSet = -1;
-        }
-    } else
-    {
-        // 1. Sort by increasing packetOH
-        for (int i = candidateSet.sizeOfSet() - 1; i >= 0; i--)
-        {
-            for (int j = 1; j <= i; j++)
-            {
-                if (candidateSet.PacketOH(j-1) > candidateSet.PacketOH(j))
-                {
-                    candidateSet.SwapEntries(j-1, j);
-                }
-            }
-        }
-        // 2. For tuples with same OH, keep the one w/ the lowest bitrate
-        for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
-        {
-            if (candidateSet.Tmmbr(i) > 0)
-            {
-                // get min bitrate for packets w/ same OH
-                uint32_t currentPacketOH = candidateSet.PacketOH(i);
-                uint32_t currentMinTMMBR = candidateSet.Tmmbr(i);
-                uint32_t currentMinIndexTMMBR = i;
-                for (uint32_t j = i+1; j < candidateSet.sizeOfSet(); j++)
-                {
-                    if(candidateSet.PacketOH(j) == currentPacketOH)
-                    {
-                        if(candidateSet.Tmmbr(j) < currentMinTMMBR)
-                        {
-                            currentMinTMMBR = candidateSet.Tmmbr(j);
-                            currentMinIndexTMMBR = j;
-                        }
-                    }
-                }
-                // keep lowest bitrate
-                for (uint32_t j = 0; j < candidateSet.sizeOfSet(); j++)
-                {
-                  if(candidateSet.PacketOH(j) == currentPacketOH
-                     && j != currentMinIndexTMMBR)
-                    {
-                        candidateSet.ClearEntry(j);
-                    }
-                }
-            }
-        }
-        // 3. Select and remove tuple w/ lowest tmmbr.
-        // (If more than 1, choose the one w/ highest OH).
-        uint32_t minTMMBR = 0;
-        uint32_t minIndexTMMBR = 0;
-        for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
-        {
-            if (candidateSet.Tmmbr(i) > 0)
-            {
-                minTMMBR = candidateSet.Tmmbr(i);
-                minIndexTMMBR = i;
-                break;
-            }
-        }
-
-        for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
-        {
-            if (candidateSet.Tmmbr(i) > 0 && candidateSet.Tmmbr(i) <= minTMMBR)
-            {
-                // get min bitrate
-                minTMMBR = candidateSet.Tmmbr(i);
-                minIndexTMMBR = i;
-            }
-        }
-        // first member of selected list
-        _boundingSet.SetEntry(numBoundingSet,
-                              candidateSet.Tmmbr(minIndexTMMBR),
-                              candidateSet.PacketOH(minIndexTMMBR),
-                              candidateSet.Ssrc(minIndexTMMBR));
-
-        // set intersection value
-        _ptrIntersectionBoundingSet[numBoundingSet] = 0;
-        // calculate its maximum packet rate (where its line crosses x-axis)
-        _ptrMaxPRBoundingSet[numBoundingSet]
-            = _boundingSet.Tmmbr(numBoundingSet) * 1000
-            / float(8 * _boundingSet.PacketOH(numBoundingSet));
-        numBoundingSet++;
-        // remove from candidate list
-        candidateSet.ClearEntry(minIndexTMMBR);
-        numCandidates--;
-
-        // 4. Discard from candidate list all tuple w/ lower OH
-        // (next tuple must be steeper)
-        for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
-        {
-            if(candidateSet.Tmmbr(i) > 0
-               && candidateSet.PacketOH(i) < _boundingSet.PacketOH(0))
-            {
-                candidateSet.ClearEntry(i);
-                numCandidates--;
-            }
-        }
-
-        if (numCandidates == 0)
-        {
-            // Should be true already:_boundingSet.lengthOfSet = numBoundingSet;
-            assert(_boundingSet.lengthOfSet() == numBoundingSet);
-            return numBoundingSet;
-        }
-
-        bool getNewCandidate = true;
-        int curCandidateTMMBR = 0;
-        int curCandidateIndex = 0;
-        int curCandidatePacketOH = 0;
-        int curCandidateSSRC = 0;
-        do
-        {
-            if (getNewCandidate)
-            {
-                // 5. Remove first remaining tuple from candidate list
-                for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
-                {
-                    if (candidateSet.Tmmbr(i) > 0)
-                    {
-                        curCandidateTMMBR    = candidateSet.Tmmbr(i);
-                        curCandidatePacketOH = candidateSet.PacketOH(i);
-                        curCandidateSSRC     = candidateSet.Ssrc(i);
-                        curCandidateIndex    = i;
-                        candidateSet.ClearEntry(curCandidateIndex);
-                        break;
-                    }
-                }
-            }
-
-            // 6. Calculate packet rate and intersection of the current
-            // line with line of last tuple in selected list
-            float packetRate
-                = float(curCandidateTMMBR
-                        - _boundingSet.Tmmbr(numBoundingSet-1))*1000
-                / (8*(curCandidatePacketOH
-                      - _boundingSet.PacketOH(numBoundingSet-1)));
-
-            // 7. If the packet rate is equal or lower than intersection of
-            //    last tuple in selected list,
-            //    remove last tuple in selected list & go back to step 6
-            if(packetRate <= _ptrIntersectionBoundingSet[numBoundingSet-1])
-            {
-                // remove last tuple and goto step 6
-                numBoundingSet--;
-                _boundingSet.ClearEntry(numBoundingSet);
-                _ptrIntersectionBoundingSet[numBoundingSet] = 0;
-                _ptrMaxPRBoundingSet[numBoundingSet]        = 0;
-                getNewCandidate = false;
-            } else
-            {
-                // 8. If packet rate is lower than maximum packet rate of
-                // last tuple in selected list, add current tuple to selected
-                // list
-                if (packetRate < _ptrMaxPRBoundingSet[numBoundingSet-1])
-                {
-                    _boundingSet.SetEntry(numBoundingSet,
-                                          curCandidateTMMBR,
-                                          curCandidatePacketOH,
-                                          curCandidateSSRC);
-                    _ptrIntersectionBoundingSet[numBoundingSet] = packetRate;
-                    _ptrMaxPRBoundingSet[numBoundingSet]
-                        = _boundingSet.Tmmbr(numBoundingSet)*1000
-                        / float(8*_boundingSet.PacketOH(numBoundingSet));
-                    numBoundingSet++;
-                }
-                numCandidates--;
-                getNewCandidate = true;
-            }
-
-            // 9. Go back to step 5 if any tuple remains in candidate list
-        } while (numCandidates > 0);
+        return (numBoundingSet == 1) ? 1 : -1;
     }
+
+    // 1. Sort by increasing packetOH
+    for (int i = candidateSet.sizeOfSet() - 1; i >= 0; i--)
+    {
+        for (int j = 1; j <= i; j++)
+        {
+            if (candidateSet.PacketOH(j-1) > candidateSet.PacketOH(j))
+            {
+                candidateSet.SwapEntries(j-1, j);
+            }
+        }
+    }
+    // 2. For tuples with same OH, keep the one w/ the lowest bitrate
+    for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
+    {
+        if (candidateSet.Tmmbr(i) > 0)
+        {
+            // get min bitrate for packets w/ same OH
+            uint32_t currentPacketOH = candidateSet.PacketOH(i);
+            uint32_t currentMinTMMBR = candidateSet.Tmmbr(i);
+            uint32_t currentMinIndexTMMBR = i;
+            for (uint32_t j = i+1; j < candidateSet.sizeOfSet(); j++)
+            {
+                if(candidateSet.PacketOH(j) == currentPacketOH)
+                {
+                    if(candidateSet.Tmmbr(j) < currentMinTMMBR)
+                    {
+                        currentMinTMMBR = candidateSet.Tmmbr(j);
+                        currentMinIndexTMMBR = j;
+                    }
+                }
+            }
+            // keep lowest bitrate
+            for (uint32_t j = 0; j < candidateSet.sizeOfSet(); j++)
+            {
+              if(candidateSet.PacketOH(j) == currentPacketOH
+                  && j != currentMinIndexTMMBR)
+                {
+                    candidateSet.ClearEntry(j);
+                }
+            }
+        }
+    }
+    // 3. Select and remove tuple w/ lowest tmmbr.
+    // (If more than 1, choose the one w/ highest OH).
+    uint32_t minTMMBR = 0;
+    uint32_t minIndexTMMBR = 0;
+    for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
+    {
+        if (candidateSet.Tmmbr(i) > 0)
+        {
+            minTMMBR = candidateSet.Tmmbr(i);
+            minIndexTMMBR = i;
+            break;
+        }
+    }
+
+    for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
+    {
+        if (candidateSet.Tmmbr(i) > 0 && candidateSet.Tmmbr(i) <= minTMMBR)
+        {
+            // get min bitrate
+            minTMMBR = candidateSet.Tmmbr(i);
+            minIndexTMMBR = i;
+        }
+    }
+    // first member of selected list
+    _boundingSet.SetEntry(numBoundingSet,
+                          candidateSet.Tmmbr(minIndexTMMBR),
+                          candidateSet.PacketOH(minIndexTMMBR),
+                          candidateSet.Ssrc(minIndexTMMBR));
+
+    // set intersection value
+    _ptrIntersectionBoundingSet[numBoundingSet] = 0;
+    // calculate its maximum packet rate (where its line crosses x-axis)
+    _ptrMaxPRBoundingSet[numBoundingSet]
+        = _boundingSet.Tmmbr(numBoundingSet) * 1000
+        / float(8 * _boundingSet.PacketOH(numBoundingSet));
+    numBoundingSet++;
+    // remove from candidate list
+    candidateSet.ClearEntry(minIndexTMMBR);
+    numCandidates--;
+
+    // 4. Discard from candidate list all tuple w/ lower OH
+    // (next tuple must be steeper)
+    for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
+    {
+        if(candidateSet.Tmmbr(i) > 0
+            && candidateSet.PacketOH(i) < _boundingSet.PacketOH(0))
+        {
+            candidateSet.ClearEntry(i);
+            numCandidates--;
+        }
+    }
+
+    if (numCandidates == 0)
+    {
+        // Should be true already:_boundingSet.lengthOfSet = numBoundingSet;
+        assert(_boundingSet.lengthOfSet() == numBoundingSet);
+        return numBoundingSet;
+    }
+
+    bool getNewCandidate = true;
+    int curCandidateTMMBR = 0;
+    int curCandidateIndex = 0;
+    int curCandidatePacketOH = 0;
+    int curCandidateSSRC = 0;
+    do
+    {
+        if (getNewCandidate)
+        {
+            // 5. Remove first remaining tuple from candidate list
+            for (uint32_t i = 0; i < candidateSet.sizeOfSet(); i++)
+            {
+                if (candidateSet.Tmmbr(i) > 0)
+                {
+                    curCandidateTMMBR    = candidateSet.Tmmbr(i);
+                    curCandidatePacketOH = candidateSet.PacketOH(i);
+                    curCandidateSSRC     = candidateSet.Ssrc(i);
+                    curCandidateIndex    = i;
+                    candidateSet.ClearEntry(curCandidateIndex);
+                    break;
+                }
+            }
+        }
+
+        // 6. Calculate packet rate and intersection of the current
+        // line with line of last tuple in selected list
+        float packetRate
+            = float(curCandidateTMMBR
+                    - _boundingSet.Tmmbr(numBoundingSet-1))*1000
+            / (8*(curCandidatePacketOH
+                  - _boundingSet.PacketOH(numBoundingSet-1)));
+
+        // 7. If the packet rate is equal or lower than intersection of
+        //    last tuple in selected list,
+        //    remove last tuple in selected list & go back to step 6
+        if(packetRate <= _ptrIntersectionBoundingSet[numBoundingSet-1])
+        {
+            // remove last tuple and goto step 6
+            numBoundingSet--;
+            _boundingSet.ClearEntry(numBoundingSet);
+            _ptrIntersectionBoundingSet[numBoundingSet] = 0;
+            _ptrMaxPRBoundingSet[numBoundingSet]        = 0;
+            getNewCandidate = false;
+        } else
+        {
+            // 8. If packet rate is lower than maximum packet rate of
+            // last tuple in selected list, add current tuple to selected
+            // list
+            if (packetRate < _ptrMaxPRBoundingSet[numBoundingSet-1])
+            {
+                _boundingSet.SetEntry(numBoundingSet,
+                                      curCandidateTMMBR,
+                                      curCandidatePacketOH,
+                                      curCandidateSSRC);
+                _ptrIntersectionBoundingSet[numBoundingSet] = packetRate;
+                _ptrMaxPRBoundingSet[numBoundingSet]
+                    = _boundingSet.Tmmbr(numBoundingSet)*1000
+                    / float(8*_boundingSet.PacketOH(numBoundingSet));
+                numBoundingSet++;
+            }
+            numCandidates--;
+            getNewCandidate = true;
+        }
+
+        // 9. Go back to step 5 if any tuple remains in candidate list
+    } while (numCandidates > 0);
+
     return numBoundingSet;
 }
 
diff --git a/webrtc/system_wrappers/source/thread_win.cc b/webrtc/system_wrappers/source/thread_win.cc
index c68ee1a..bcb95e7 100644
--- a/webrtc/system_wrappers/source/thread_win.cc
+++ b/webrtc/system_wrappers/source/thread_win.cc
@@ -159,7 +159,7 @@
   if (set_thread_name_) {
     WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, id_,
                  "Thread with name:%s started ", name_);
-    SetThreadName(-1, name_); // -1, set thread name for the calling thread.
+    SetThreadName(static_cast<DWORD>(-1), name_); // -1 == caller thread.
   } else {
     WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, id_,
                  "Thread without name started");
diff --git a/webrtc/video_engine/vie_codec_impl.cc b/webrtc/video_engine/vie_codec_impl.cc
index 050958e..81736d6 100644
--- a/webrtc/video_engine/vie_codec_impl.cc
+++ b/webrtc/video_engine/vie_codec_impl.cc
@@ -421,7 +421,7 @@
   ViEChannel* vie_channel = cs.Channel(video_channel);
   if (!vie_channel) {
     shared_data_->SetLastError(kViECodecInvalidChannelId);
-    return -1;
+    return static_cast<unsigned int>(-1);
   }
   return vie_channel->DiscardedPackets();
 }
diff --git a/webrtc/video_engine/vie_defines.h b/webrtc/video_engine/vie_defines.h
index eb499fa..7bfed46 100644
--- a/webrtc/video_engine/vie_defines.h
+++ b/webrtc/video_engine/vie_defines.h
@@ -120,14 +120,6 @@
 #if defined(_WIN32)
   #define RENDER_MODULE_TYPE kRenderWindows
 
-  // Warning pragmas.
-  // new behavior: elements of array 'XXX' will be default initialized.
-  #pragma warning(disable: 4351)
-  // 'this' : used in base member initializer list.
-  #pragma warning(disable: 4355)
-  // Frame pointer register 'ebp' modified by inline assembly code.
-  #pragma warning(disable: 4731)
-
   // Include libraries.
   #pragma comment(lib, "winmm.lib")
 
diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc
index 72dd51a..2d4ba57 100644
--- a/webrtc/voice_engine/channel.cc
+++ b/webrtc/voice_engine/channel.cc
@@ -3765,7 +3765,7 @@
     {
         WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,_channelId),
                      "Channel::PrepareEncodeAndSend() invalid audio frame");
-        return -1;
+        return 0xFFFFFFFF;
     }
 
     if (channel_state_.Get().input_file_playing)
@@ -3819,7 +3819,7 @@
     {
         WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,_channelId),
                      "Channel::EncodeAndSend() invalid audio frame");
-        return -1;
+        return 0xFFFFFFFF;
     }
 
     _audioFrame.id_ = _channelId;
@@ -3832,7 +3832,7 @@
     {
         WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId,_channelId),
                      "Channel::EncodeAndSend() ACM encoding failed");
-        return -1;
+        return 0xFFFFFFFF;
     }
 
     _timeStamp += _audioFrame.samples_per_channel_;
@@ -4182,7 +4182,7 @@
         // Currently file stream is always mono.
         // TODO(xians): Change the code when FilePlayer supports real stereo.
         _audioFrame.UpdateFrame(_channelId,
-                                -1,
+                                0xFFFFFFFF,
                                 fileBuffer.get(),
                                 fileSamples,
                                 mixingFrequency,
diff --git a/webrtc/voice_engine/transmit_mixer.cc b/webrtc/voice_engine/transmit_mixer.cc
index 76b507f..2f1c9dc 100644
--- a/webrtc/voice_engine/transmit_mixer.cc
+++ b/webrtc/voice_engine/transmit_mixer.cc
@@ -1236,7 +1236,7 @@
         // Currently file stream is always mono.
         // TODO(xians): Change the code when FilePlayer supports real stereo.
         _audioFrame.UpdateFrame(-1,
-                                -1,
+                                0xFFFFFFFF,
                                 fileBuffer.get(),
                                 fileSamples,
                                 mixingFrequency,