Chromium Code Reviews| Index: webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc |
| diff --git a/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc b/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc |
| index 26c78388613b5d505c158a433b00864173f5440e..032323b55bbeadc3653124c13421c747a84cb74d 100644 |
| --- a/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc |
| +++ b/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc |
| @@ -20,11 +20,13 @@ namespace webrtc { |
| namespace { |
| -int16_t NumSamplesPerFrame(int num_channels, |
| +int16_t NumSamplesPerFrame(size_t num_channels, |
| int frame_size_ms, |
| int sample_rate_hz) { |
| - int samples_per_frame = num_channels * frame_size_ms * sample_rate_hz / 1000; |
| - RTC_CHECK_LE(samples_per_frame, std::numeric_limits<int16_t>::max()) |
| + size_t samples_per_frame = |
|
minyue-webrtc
2015/12/29 10:42:47
but why not casting |num_channels| to int and keep
Peter Kasting
2015/12/30 00:55:45
What? How can that be negative? You'd have to ha
minyue-webrtc
2016/01/04 09:06:02
sorry for ambiguity. I meant that there is no chec
Peter Kasting
2016/01/04 19:49:42
Looking at its use, it should be, yes. I can make
minyue-webrtc
2016/01/04 22:03:18
I guess that check is to make sure that casting on
Peter Kasting
2016/01/08 02:45:06
I simplified everything to just do this calculatio
|
| + num_channels * frame_size_ms * sample_rate_hz / 1000; |
| + RTC_CHECK_LE(samples_per_frame, |
| + static_cast<size_t>(std::numeric_limits<int16_t>::max())) |
| << "Frame size too large."; |
| return static_cast<int16_t>(samples_per_frame); |
| } |
| @@ -70,7 +72,7 @@ int AudioEncoderPcm::SampleRateHz() const { |
| return sample_rate_hz_; |
| } |
| -int AudioEncoderPcm::NumChannels() const { |
| +size_t AudioEncoderPcm::NumChannels() const { |
| return num_channels_; |
| } |