Chromium Code Reviews| Index: webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc |
| diff --git a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc |
| index a599e291d479b0ba3926e0d8d7e14e5dbaf5f75c..e57487c1d2f97c874b22cbd5d030d96d30af0e2f 100644 |
| --- a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc |
| +++ b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc |
| @@ -10,6 +10,8 @@ |
| #include "webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h" |
| +#include <algorithm> |
|
kwiberg-webrtc
2016/04/07 08:23:16
Why is this needed?
ossu
2016/04/07 08:52:53
It's for std::min and std::max. It's another lint
kwiberg-webrtc
2016/04/07 09:53:26
That would be ideal. (I won't insist, though, sinc
|
| + |
| #include "webrtc/base/checks.h" |
| #include "webrtc/base/safe_conversions.h" |
| #include "webrtc/common_types.h" |
| @@ -100,16 +102,6 @@ AudioEncoderOpus::~AudioEncoderOpus() { |
| RTC_CHECK_EQ(0, WebRtcOpus_EncoderFree(inst_)); |
| } |
| -size_t AudioEncoderOpus::MaxEncodedBytes() const { |
| - // Calculate the number of bytes we expect the encoder to produce, |
| - // then multiply by two to give a wide margin for error. |
| - const size_t bytes_per_millisecond = |
| - static_cast<size_t>(config_.bitrate_bps / (1000 * 8) + 1); |
| - const size_t approx_encoded_bytes = |
| - Num10msFramesPerPacket() * 10 * bytes_per_millisecond; |
| - return 2 * approx_encoded_bytes; |
| -} |
| - |
| int AudioEncoderOpus::SampleRateHz() const { |
| return kSampleRateHz; |
| } |
| @@ -231,6 +223,16 @@ size_t AudioEncoderOpus::SamplesPer10msFrame() const { |
| return rtc::CheckedDivExact(kSampleRateHz, 100) * config_.num_channels; |
| } |
| +size_t AudioEncoderOpus::MaxEncodedBytes() const { |
| + // Calculate the number of bytes we expect the encoder to produce, |
| + // then multiply by two to give a wide margin for error. |
| + const size_t bytes_per_millisecond = |
| + static_cast<size_t>(config_.bitrate_bps / (1000 * 8) + 1); |
| + const size_t approx_encoded_bytes = |
| + Num10msFramesPerPacket() * 10 * bytes_per_millisecond; |
| + return 2 * approx_encoded_bytes; |
| +} |
| + |
| // If the given config is OK, recreate the Opus encoder instance with those |
| // settings, save the config, and return true. Otherwise, do nothing and return |
| // false. |