Chromium Code Reviews

Side by Side Diff: webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.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 42 matching lines...)
53 53
54 int AudioEncoderPcm::SampleRateHz() const { 54 int AudioEncoderPcm::SampleRateHz() const {
55 return sample_rate_hz_; 55 return sample_rate_hz_;
56 } 56 }
57 57
58 int AudioEncoderPcm::NumChannels() const { 58 int AudioEncoderPcm::NumChannels() const {
59 return num_channels_; 59 return num_channels_;
60 } 60 }
61 61
62 size_t AudioEncoderPcm::MaxEncodedBytes() const { 62 size_t AudioEncoderPcm::MaxEncodedBytes() const {
63 return full_frame_samples_; 63 return full_frame_samples_;
kwiberg-webrtc 2015/06/16 19:22:54 Oooh. This isn't correct for pcm16b, so needs to b
hlundin-webrtc 2015/06/16 21:38:50 Done.
64 } 64 }
65 65
66 int AudioEncoderPcm::Num10MsFramesInNextPacket() const { 66 int AudioEncoderPcm::Num10MsFramesInNextPacket() const {
67 return num_10ms_frames_per_packet_; 67 return num_10ms_frames_per_packet_;
68 } 68 }
69 69
70 int AudioEncoderPcm::Max10MsFramesInAPacket() const { 70 int AudioEncoderPcm::Max10MsFramesInAPacket() const {
71 return num_10ms_frames_per_packet_; 71 return num_10ms_frames_per_packet_;
72 } 72 }
73 73
74 int AudioEncoderPcm::SetTargetBitrate(int /*bits_per_second*/) {
75 return 64000 * NumChannels();
kwiberg-webrtc 2015/06/16 19:22:54 See suggestion above about how this can be made to
hlundin-webrtc 2015/06/16 21:38:50 Done.
76 }
77
74 AudioEncoder::EncodedInfo AudioEncoderPcm::EncodeInternal( 78 AudioEncoder::EncodedInfo AudioEncoderPcm::EncodeInternal(
75 uint32_t rtp_timestamp, 79 uint32_t rtp_timestamp,
76 const int16_t* audio, 80 const int16_t* audio,
77 size_t max_encoded_bytes, 81 size_t max_encoded_bytes,
78 uint8_t* encoded) { 82 uint8_t* encoded) {
79 const int num_samples = SampleRateHz() / 100 * NumChannels(); 83 const int num_samples = SampleRateHz() / 100 * NumChannels();
80 if (speech_buffer_.empty()) { 84 if (speech_buffer_.empty()) {
81 first_timestamp_in_buffer_ = rtp_timestamp; 85 first_timestamp_in_buffer_ = rtp_timestamp;
82 } 86 }
83 for (int i = 0; i < num_samples; ++i) { 87 for (int i = 0; i < num_samples; ++i) {
(...skipping 41 matching lines...)
125 : AudioEncoderMutableImpl<AudioEncoderPcmU>( 129 : AudioEncoderMutableImpl<AudioEncoderPcmU>(
126 CreateConfig<AudioEncoderPcmU>(codec_inst)) { 130 CreateConfig<AudioEncoderPcmU>(codec_inst)) {
127 } 131 }
128 132
129 AudioEncoderMutablePcmA::AudioEncoderMutablePcmA(const CodecInst& codec_inst) 133 AudioEncoderMutablePcmA::AudioEncoderMutablePcmA(const CodecInst& codec_inst)
130 : AudioEncoderMutableImpl<AudioEncoderPcmA>( 134 : AudioEncoderMutableImpl<AudioEncoderPcmA>(
131 CreateConfig<AudioEncoderPcmA>(codec_inst)) { 135 CreateConfig<AudioEncoderPcmA>(codec_inst)) {
132 } 136 }
133 137
134 } // namespace webrtc 138 } // namespace webrtc
OLDNEW

Powered by Google App Engine