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

Side by Side Diff: webrtc/modules/audio_coding/codecs/pcm16b/audio_encoder_pcm16b.cc

Issue 1967503002: Audio codec usage statistics (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Hopefully last version, minimal changes. 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
11 #include "webrtc/modules/audio_coding/codecs/pcm16b/audio_encoder_pcm16b.h" 11 #include "webrtc/modules/audio_coding/codecs/pcm16b/audio_encoder_pcm16b.h"
12 12
13 #include "webrtc/base/checks.h" 13 #include "webrtc/base/checks.h"
14 #include "webrtc/common_types.h" 14 #include "webrtc/common_types.h"
15 #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h" 15 #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h"
16 16
17 namespace webrtc { 17 namespace webrtc {
18 18
19 size_t AudioEncoderPcm16B::EncodeCall(const int16_t* audio, 19 size_t AudioEncoderPcm16B::EncodeCall(const int16_t* audio,
20 size_t input_len, 20 size_t input_len,
21 uint8_t* encoded) { 21 uint8_t* encoded) {
22 return WebRtcPcm16b_Encode(audio, input_len, encoded); 22 return WebRtcPcm16b_Encode(audio, input_len, encoded);
23 } 23 }
24 24
25 size_t AudioEncoderPcm16B::BytesPerSample() const { 25 size_t AudioEncoderPcm16B::BytesPerSample() const {
26 return 2; 26 return 2;
27 } 27 }
28 28
29 AudioEncoder::CodecType AudioEncoderPcm16B::GetCodecType() const {
30 return AudioEncoder::CodecType::kOther;
kwiberg-webrtc 2016/05/16 08:13:26 And here.
aleloi 2016/05/16 08:20:49 Done.
31 }
32
29 namespace { 33 namespace {
30 AudioEncoderPcm16B::Config CreateConfig(const CodecInst& codec_inst) { 34 AudioEncoderPcm16B::Config CreateConfig(const CodecInst& codec_inst) {
31 AudioEncoderPcm16B::Config config; 35 AudioEncoderPcm16B::Config config;
32 config.num_channels = codec_inst.channels; 36 config.num_channels = codec_inst.channels;
33 config.sample_rate_hz = codec_inst.plfreq; 37 config.sample_rate_hz = codec_inst.plfreq;
34 config.frame_size_ms = rtc::CheckedDivExact( 38 config.frame_size_ms = rtc::CheckedDivExact(
35 codec_inst.pacsize, rtc::CheckedDivExact(config.sample_rate_hz, 1000)); 39 codec_inst.pacsize, rtc::CheckedDivExact(config.sample_rate_hz, 1000));
36 config.payload_type = codec_inst.pltype; 40 config.payload_type = codec_inst.pltype;
37 return config; 41 return config;
38 } 42 }
39 } // namespace 43 } // namespace
40 44
41 bool AudioEncoderPcm16B::Config::IsOk() const { 45 bool AudioEncoderPcm16B::Config::IsOk() const {
42 if ((sample_rate_hz != 8000) && (sample_rate_hz != 16000) && 46 if ((sample_rate_hz != 8000) && (sample_rate_hz != 16000) &&
43 (sample_rate_hz != 32000) && (sample_rate_hz != 48000)) 47 (sample_rate_hz != 32000) && (sample_rate_hz != 48000))
44 return false; 48 return false;
45 return AudioEncoderPcm::Config::IsOk(); 49 return AudioEncoderPcm::Config::IsOk();
46 } 50 }
47 51
48 AudioEncoderPcm16B::AudioEncoderPcm16B(const CodecInst& codec_inst) 52 AudioEncoderPcm16B::AudioEncoderPcm16B(const CodecInst& codec_inst)
49 : AudioEncoderPcm16B(CreateConfig(codec_inst)) {} 53 : AudioEncoderPcm16B(CreateConfig(codec_inst)) {}
50 54
51 } // namespace webrtc 55 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698