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

Side by Side Diff: webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc

Issue 1967503002: Audio codec usage statistics (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Moved logging to AudioCodingModuleImpl Created 4 years, 7 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 info.encoded_timestamp = first_timestamp_in_buffer_; 89 info.encoded_timestamp = first_timestamp_in_buffer_;
90 info.payload_type = payload_type_; 90 info.payload_type = payload_type_;
91 info.encoded_bytes = 91 info.encoded_bytes =
92 encoded->AppendData(full_frame_samples_ * BytesPerSample(), 92 encoded->AppendData(full_frame_samples_ * BytesPerSample(),
93 [&] (rtc::ArrayView<uint8_t> encoded) { 93 [&] (rtc::ArrayView<uint8_t> encoded) {
94 return EncodeCall(&speech_buffer_[0], 94 return EncodeCall(&speech_buffer_[0],
95 full_frame_samples_, 95 full_frame_samples_,
96 encoded.data()); 96 encoded.data());
97 }); 97 });
98 speech_buffer_.clear(); 98 speech_buffer_.clear();
99 info.encoder_name = GetCodecName();
99 return info; 100 return info;
100 } 101 }
101 102
103 const char* AudioEncoderPcm::GetCodecName() const {
104 return nullptr;
105 }
kwiberg-webrtc 2016/05/12 13:01:52 There are only three subclasses. It'll be easier t
106
102 void AudioEncoderPcm::Reset() { 107 void AudioEncoderPcm::Reset() {
103 speech_buffer_.clear(); 108 speech_buffer_.clear();
104 } 109 }
105 110
106 AudioEncoderPcmA::AudioEncoderPcmA(const CodecInst& codec_inst) 111 AudioEncoderPcmA::AudioEncoderPcmA(const CodecInst& codec_inst)
107 : AudioEncoderPcmA(CreateConfig<AudioEncoderPcmA>(codec_inst)) {} 112 : AudioEncoderPcmA(CreateConfig<AudioEncoderPcmA>(codec_inst)) {}
108 113
109 size_t AudioEncoderPcmA::EncodeCall(const int16_t* audio, 114 size_t AudioEncoderPcmA::EncodeCall(const int16_t* audio,
110 size_t input_len, 115 size_t input_len,
111 uint8_t* encoded) { 116 uint8_t* encoded) {
112 return WebRtcG711_EncodeA(audio, input_len, encoded); 117 return WebRtcG711_EncodeA(audio, input_len, encoded);
113 } 118 }
114 119
115 size_t AudioEncoderPcmA::BytesPerSample() const { 120 size_t AudioEncoderPcmA::BytesPerSample() const {
116 return 1; 121 return 1;
117 } 122 }
118 123
124 const char* AudioEncoderPcmA::GetCodecName() const {
125 return "g711A";
hlundin-webrtc 2016/05/12 12:23:39 Please, educate me. What is the lifetime of a lite
ossu 2016/05/12 12:50:14 FOREVER! Well, it's static data, so I guess until
aleloi 2016/05/12 12:52:18 The same as the lifetime of the whole program acco
126 }
127
119 AudioEncoderPcmU::AudioEncoderPcmU(const CodecInst& codec_inst) 128 AudioEncoderPcmU::AudioEncoderPcmU(const CodecInst& codec_inst)
120 : AudioEncoderPcmU(CreateConfig<AudioEncoderPcmU>(codec_inst)) {} 129 : AudioEncoderPcmU(CreateConfig<AudioEncoderPcmU>(codec_inst)) {}
121 130
122 size_t AudioEncoderPcmU::EncodeCall(const int16_t* audio, 131 size_t AudioEncoderPcmU::EncodeCall(const int16_t* audio,
123 size_t input_len, 132 size_t input_len,
124 uint8_t* encoded) { 133 uint8_t* encoded) {
125 return WebRtcG711_EncodeU(audio, input_len, encoded); 134 return WebRtcG711_EncodeU(audio, input_len, encoded);
126 } 135 }
127 136
128 size_t AudioEncoderPcmU::BytesPerSample() const { 137 size_t AudioEncoderPcmU::BytesPerSample() const {
129 return 1; 138 return 1;
130 } 139 }
131 140
141 const char* AudioEncoderPcmU::GetCodecName() const {
142 return "g711U";
143 }
144
132 } // namespace webrtc 145 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698