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

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

Issue 1172163004: Reformat existing code. There should be no functional effects. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 6 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return kSampleRateHz; 107 return kSampleRateHz;
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 int frame_size_ms = num_10ms_frames_per_packet_ * 10;
118 size_t bytes_per_millisecond = 117 size_t bytes_per_millisecond =
119 static_cast<size_t>(bitrate_bps_ / (1000 * 8) + 1); 118 static_cast<size_t>(bitrate_bps_ / (1000 * 8) + 1);
120 size_t approx_encoded_bytes = frame_size_ms * bytes_per_millisecond; 119 size_t approx_encoded_bytes =
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 {
129 return num_10ms_frames_per_packet_; 129 return num_10ms_frames_per_packet_;
130 } 130 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 return Reconstruct(conf); 256 return Reconstruct(conf);
257 } 257 }
258 258
259 bool AudioEncoderMutableOpus::SetMaxPlaybackRate(int frequency_hz) { 259 bool AudioEncoderMutableOpus::SetMaxPlaybackRate(int frequency_hz) {
260 auto conf = config(); 260 auto conf = config();
261 conf.max_playback_rate_hz = frequency_hz; 261 conf.max_playback_rate_hz = frequency_hz;
262 return Reconstruct(conf); 262 return Reconstruct(conf);
263 } 263 }
264 264
265 } // namespace webrtc 265 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698