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

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: explicit casts 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_type = GetCodecType();
99 return info; 100 return info;
100 } 101 }
101 102
102 void AudioEncoderPcm::Reset() { 103 void AudioEncoderPcm::Reset() {
103 speech_buffer_.clear(); 104 speech_buffer_.clear();
104 } 105 }
105 106
106 AudioEncoderPcmA::AudioEncoderPcmA(const CodecInst& codec_inst) 107 AudioEncoderPcmA::AudioEncoderPcmA(const CodecInst& codec_inst)
107 : AudioEncoderPcmA(CreateConfig<AudioEncoderPcmA>(codec_inst)) {} 108 : AudioEncoderPcmA(CreateConfig<AudioEncoderPcmA>(codec_inst)) {}
108 109
109 size_t AudioEncoderPcmA::EncodeCall(const int16_t* audio, 110 size_t AudioEncoderPcmA::EncodeCall(const int16_t* audio,
110 size_t input_len, 111 size_t input_len,
111 uint8_t* encoded) { 112 uint8_t* encoded) {
112 return WebRtcG711_EncodeA(audio, input_len, encoded); 113 return WebRtcG711_EncodeA(audio, input_len, encoded);
113 } 114 }
114 115
115 size_t AudioEncoderPcmA::BytesPerSample() const { 116 size_t AudioEncoderPcmA::BytesPerSample() const {
116 return 1; 117 return 1;
117 } 118 }
118 119
120 AudioEncoder::CodecType AudioEncoderPcmA::GetCodecType() const {
121 return AudioEncoder::CodecType::kPcmA;
122 }
123
119 AudioEncoderPcmU::AudioEncoderPcmU(const CodecInst& codec_inst) 124 AudioEncoderPcmU::AudioEncoderPcmU(const CodecInst& codec_inst)
120 : AudioEncoderPcmU(CreateConfig<AudioEncoderPcmU>(codec_inst)) {} 125 : AudioEncoderPcmU(CreateConfig<AudioEncoderPcmU>(codec_inst)) {}
121 126
122 size_t AudioEncoderPcmU::EncodeCall(const int16_t* audio, 127 size_t AudioEncoderPcmU::EncodeCall(const int16_t* audio,
123 size_t input_len, 128 size_t input_len,
124 uint8_t* encoded) { 129 uint8_t* encoded) {
125 return WebRtcG711_EncodeU(audio, input_len, encoded); 130 return WebRtcG711_EncodeU(audio, input_len, encoded);
126 } 131 }
127 132
128 size_t AudioEncoderPcmU::BytesPerSample() const { 133 size_t AudioEncoderPcmU::BytesPerSample() const {
129 return 1; 134 return 1;
130 } 135 }
131 136
137 AudioEncoder::CodecType AudioEncoderPcmU::GetCodecType() const {
138 return AudioEncoder::CodecType::kPcmU;
139 }
140
132 } // namespace webrtc 141 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698