Chromium Code Reviews

Side by Side Diff: webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.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 64 matching lines...)
75 } 75 }
76 76
77 int AudioEncoderG722::Num10MsFramesInNextPacket() const { 77 int AudioEncoderG722::Num10MsFramesInNextPacket() const {
78 return num_10ms_frames_per_packet_; 78 return num_10ms_frames_per_packet_;
79 } 79 }
80 80
81 int AudioEncoderG722::Max10MsFramesInAPacket() const { 81 int AudioEncoderG722::Max10MsFramesInAPacket() const {
82 return num_10ms_frames_per_packet_; 82 return num_10ms_frames_per_packet_;
83 } 83 }
84 84
85 int AudioEncoderG722::SetTargetBitrate(int bits_per_second) {
86 return 64000 * NumChannels();
kwiberg-webrtc 2015/06/16 19:22:54 16 kHz times 4 bits per sample, right?
hlundin-webrtc 2015/06/16 21:38:50 Acknowledged.
87 }
88
85 AudioEncoder::EncodedInfo AudioEncoderG722::EncodeInternal( 89 AudioEncoder::EncodedInfo AudioEncoderG722::EncodeInternal(
86 uint32_t rtp_timestamp, 90 uint32_t rtp_timestamp,
87 const int16_t* audio, 91 const int16_t* audio,
88 size_t max_encoded_bytes, 92 size_t max_encoded_bytes,
89 uint8_t* encoded) { 93 uint8_t* encoded) {
90 CHECK_GE(max_encoded_bytes, MaxEncodedBytes()); 94 CHECK_GE(max_encoded_bytes, MaxEncodedBytes());
91 95
92 if (num_10ms_frames_buffered_ == 0) 96 if (num_10ms_frames_buffered_ == 0)
93 first_timestamp_in_buffer_ = rtp_timestamp; 97 first_timestamp_in_buffer_ = rtp_timestamp;
94 98
(...skipping 52 matching lines...)
147 config.payload_type = codec_inst.pltype; 151 config.payload_type = codec_inst.pltype;
148 return config; 152 return config;
149 } 153 }
150 } // namespace 154 } // namespace
151 155
152 AudioEncoderMutableG722::AudioEncoderMutableG722(const CodecInst& codec_inst) 156 AudioEncoderMutableG722::AudioEncoderMutableG722(const CodecInst& codec_inst)
153 : AudioEncoderMutableImpl<AudioEncoderG722>(CreateConfig(codec_inst)) { 157 : AudioEncoderMutableImpl<AudioEncoderG722>(CreateConfig(codec_inst)) {
154 } 158 }
155 159
156 } // namespace webrtc 160 } // namespace webrtc
OLDNEW

Powered by Google App Engine