Chromium Code Reviews

Side by Side Diff: webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.cc

Issue 1184313002: Add AudioEncoder::GetTargetBitrate (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Getting rid of erroneous code Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 48 matching lines...)
59 } 59 }
60 60
61 int AudioEncoderIlbc::Num10MsFramesInNextPacket() const { 61 int AudioEncoderIlbc::Num10MsFramesInNextPacket() const {
62 return num_10ms_frames_per_packet_; 62 return num_10ms_frames_per_packet_;
63 } 63 }
64 64
65 int AudioEncoderIlbc::Max10MsFramesInAPacket() const { 65 int AudioEncoderIlbc::Max10MsFramesInAPacket() const {
66 return num_10ms_frames_per_packet_; 66 return num_10ms_frames_per_packet_;
67 } 67 }
68 68
69 int AudioEncoderIlbc::SetTargetBitrate(int bits_per_second) {
70 switch (num_10ms_frames_per_packet_) {
71 case 2: case 4: return 15200;
72 case 3: case 6: return 13333;
kwiberg-webrtc 2015/06/16 19:22:54 I'd recommend an explanation here. Otherwise these
hlundin-webrtc 2015/06/16 21:38:50 Done.
73 default: FATAL();
74 }
75 }
76
69 AudioEncoder::EncodedInfo AudioEncoderIlbc::EncodeInternal( 77 AudioEncoder::EncodedInfo AudioEncoderIlbc::EncodeInternal(
70 uint32_t rtp_timestamp, 78 uint32_t rtp_timestamp,
71 const int16_t* audio, 79 const int16_t* audio,
72 size_t max_encoded_bytes, 80 size_t max_encoded_bytes,
73 uint8_t* encoded) { 81 uint8_t* encoded) {
74 DCHECK_GE(max_encoded_bytes, RequiredOutputSizeBytes()); 82 DCHECK_GE(max_encoded_bytes, RequiredOutputSizeBytes());
75 83
76 // Save timestamp if starting a new packet. 84 // Save timestamp if starting a new packet.
77 if (num_10ms_frames_buffered_ == 0) 85 if (num_10ms_frames_buffered_ == 0)
78 first_timestamp_in_buffer_ = rtp_timestamp; 86 first_timestamp_in_buffer_ = rtp_timestamp;
(...skipping 43 matching lines...)
122 config.payload_type = codec_inst.pltype; 130 config.payload_type = codec_inst.pltype;
123 return config; 131 return config;
124 } 132 }
125 } // namespace 133 } // namespace
126 134
127 AudioEncoderMutableIlbc::AudioEncoderMutableIlbc(const CodecInst& codec_inst) 135 AudioEncoderMutableIlbc::AudioEncoderMutableIlbc(const CodecInst& codec_inst)
128 : AudioEncoderMutableImpl<AudioEncoderIlbc>(CreateConfig(codec_inst)) { 136 : AudioEncoderMutableImpl<AudioEncoderIlbc>(CreateConfig(codec_inst)) {
129 } 137 }
130 138
131 } // namespace webrtc 139 } // namespace webrtc
OLDNEW

Powered by Google App Engine