Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Unified Diff: webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.cc

Issue 1230693002: Update audio code to use size_t more correctly, (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.cc
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.cc b/webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.cc
index 8dc9bdf4bdd06e94305b24d441665e5a81f1b54b..94f2f73731440e1e8d299d75bc9970b54014a482 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.cc
+++ b/webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.cc
@@ -20,10 +20,13 @@ namespace webrtc {
namespace {
-const int kSampleRateHz = 8000;
+const size_t kSampleRateHz = 8000;
kwiberg-webrtc 2015/08/11 09:33:21 It seems wrong to use size_t for sample rates. It'
Peter Kasting 2015/08/14 00:56:09 I agree, I'm not sure why I changed this. Fixed.
} // namespace
+// static
+const size_t AudioEncoderIlbc::kMaxSamplesPerPacket;
Peter Kasting 2015/07/23 19:17:04 Changing the type of this from int to size_t means
kwiberg-webrtc 2015/08/11 09:33:21 Acknowledged.
+
bool AudioEncoderIlbc::Config::IsOk() const {
return (frame_size_ms == 20 || frame_size_ms == 30 || frame_size_ms == 40 ||
frame_size_ms == 60) &&
@@ -32,7 +35,8 @@ bool AudioEncoderIlbc::Config::IsOk() const {
AudioEncoderIlbc::AudioEncoderIlbc(const Config& config)
: payload_type_(config.payload_type),
- num_10ms_frames_per_packet_(config.frame_size_ms / 10),
+ num_10ms_frames_per_packet_(
+ static_cast<size_t>(config.frame_size_ms / 10)),
num_10ms_frames_buffered_(0) {
CHECK(config.IsOk());
CHECK_EQ(0, WebRtcIlbcfix_EncoderCreate(&encoder_));
@@ -58,11 +62,11 @@ size_t AudioEncoderIlbc::MaxEncodedBytes() const {
return RequiredOutputSizeBytes();
}
-int AudioEncoderIlbc::Num10MsFramesInNextPacket() const {
+size_t AudioEncoderIlbc::Num10MsFramesInNextPacket() const {
return num_10ms_frames_per_packet_;
}
-int AudioEncoderIlbc::Max10MsFramesInAPacket() const {
+size_t AudioEncoderIlbc::Max10MsFramesInAPacket() const {
return num_10ms_frames_per_packet_;
}
@@ -111,7 +115,7 @@ AudioEncoder::EncodedInfo AudioEncoderIlbc::EncodeInternal(
encoded);
CHECK_GE(output_len, 0);
EncodedInfo info;
- info.encoded_bytes = output_len;
+ info.encoded_bytes = static_cast<size_t>(output_len);
DCHECK_EQ(info.encoded_bytes, RequiredOutputSizeBytes());
info.encoded_timestamp = first_timestamp_in_buffer_;
info.payload_type = payload_type_;

Powered by Google App Engine
This is Rietveld 408576698