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

Side by Side Diff: webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc

Issue 1235643003: Miscellaneous changes split from https://codereview.webrtc.org/1230503003 . (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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 109
110 int AudioEncoderOpus::NumChannels() const { 110 int AudioEncoderOpus::NumChannels() const {
111 return num_channels_; 111 return num_channels_;
112 } 112 }
113 113
114 size_t AudioEncoderOpus::MaxEncodedBytes() const { 114 size_t AudioEncoderOpus::MaxEncodedBytes() const {
115 // Calculate the number of bytes we expect the encoder to produce, 115 // Calculate the number of bytes we expect the encoder to produce,
116 // then multiply by two to give a wide margin for error. 116 // then multiply by two to give a wide margin for error.
117 size_t bytes_per_millisecond = 117 size_t bytes_per_millisecond =
118 static_cast<size_t>(bitrate_bps_ / (1000 * 8) + 1); 118 static_cast<size_t>(bitrate_bps_ / (1000 * 8) + 1);
119 size_t approx_encoded_bytes = 119 size_t approx_encoded_bytes =
120 num_10ms_frames_per_packet_ * 10 * bytes_per_millisecond; 120 num_10ms_frames_per_packet_ * 10 * bytes_per_millisecond;
121 return 2 * approx_encoded_bytes; 121 return 2 * approx_encoded_bytes;
122 } 122 }
123 123
124 int AudioEncoderOpus::Num10MsFramesInNextPacket() const { 124 int AudioEncoderOpus::Num10MsFramesInNextPacket() const {
125 return num_10ms_frames_per_packet_; 125 return num_10ms_frames_per_packet_;
126 } 126 }
127 127
128 int AudioEncoderOpus::Max10MsFramesInAPacket() const { 128 int AudioEncoderOpus::Max10MsFramesInAPacket() const {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 return Reconstruct(conf); 260 return Reconstruct(conf);
261 } 261 }
262 262
263 bool AudioEncoderMutableOpus::SetMaxPlaybackRate(int frequency_hz) { 263 bool AudioEncoderMutableOpus::SetMaxPlaybackRate(int frequency_hz) {
264 auto conf = config(); 264 auto conf = config();
265 conf.max_playback_rate_hz = frequency_hz; 265 conf.max_playback_rate_hz = frequency_hz;
266 return Reconstruct(conf); 266 return Reconstruct(conf);
267 } 267 }
268 268
269 } // namespace webrtc 269 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/codecs/isac/main/test/simpleKenny.c ('k') | webrtc/modules/audio_coding/main/test/PCMFile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698