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

Side by Side Diff: webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.cc

Issue 1967503002: Audio codec usage statistics (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Minor fixes 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/g722/audio_encoder_g722.h" 11 #include "webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h"
12 12
13 #include <limits> 13 #include <limits>
14 #include "webrtc/base/checks.h" 14 #include "webrtc/base/checks.h"
15 #include "webrtc/common_types.h" 15 #include "webrtc/common_types.h"
16 #include "webrtc/modules/audio_coding/codecs/g722/g722_interface.h" 16 #include "webrtc/modules/audio_coding/codecs/g722/g722_interface.h"
17 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
hlundin-webrtc 2016/05/13 09:54:23 You don't have to include audio_encoder.h. From th
aleloi 2016/05/13 10:56:07 Done.
17 18
18 namespace webrtc { 19 namespace webrtc {
19 20
20 namespace { 21 namespace {
21 22
22 const size_t kSampleRateHz = 16000; 23 const size_t kSampleRateHz = 16000;
23 24
24 AudioEncoderG722::Config CreateConfig(const CodecInst& codec_inst) { 25 AudioEncoderG722::Config CreateConfig(const CodecInst& codec_inst) {
25 AudioEncoderG722::Config config; 26 AudioEncoderG722::Config config;
26 config.num_channels = codec_inst.channels; 27 config.num_channels = codec_inst.channels;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 for (size_t j = 0; j < num_channels_; ++j) 139 for (size_t j = 0; j < num_channels_; ++j)
139 encoded[i * num_channels_ + j] = 140 encoded[i * num_channels_ + j] =
140 interleave_buffer_.data()[2 * j] << 4 | 141 interleave_buffer_.data()[2 * j] << 4 |
141 interleave_buffer_.data()[2 * j + 1]; 142 interleave_buffer_.data()[2 * j + 1];
142 } 143 }
143 144
144 return bytes_to_encode; 145 return bytes_to_encode;
145 }); 146 });
146 info.encoded_timestamp = first_timestamp_in_buffer_; 147 info.encoded_timestamp = first_timestamp_in_buffer_;
147 info.payload_type = payload_type_; 148 info.payload_type = payload_type_;
149 info.encoder_type = CodecType::kG722;
148 return info; 150 return info;
149 } 151 }
150 152
151 AudioEncoderG722::EncoderState::EncoderState() { 153 AudioEncoderG722::EncoderState::EncoderState() {
152 RTC_CHECK_EQ(0, WebRtcG722_CreateEncoder(&encoder)); 154 RTC_CHECK_EQ(0, WebRtcG722_CreateEncoder(&encoder));
153 } 155 }
154 156
155 AudioEncoderG722::EncoderState::~EncoderState() { 157 AudioEncoderG722::EncoderState::~EncoderState() {
156 RTC_CHECK_EQ(0, WebRtcG722_FreeEncoder(encoder)); 158 RTC_CHECK_EQ(0, WebRtcG722_FreeEncoder(encoder));
157 } 159 }
158 160
159 size_t AudioEncoderG722::SamplesPerChannel() const { 161 size_t AudioEncoderG722::SamplesPerChannel() const {
160 return kSampleRateHz / 100 * num_10ms_frames_per_packet_; 162 return kSampleRateHz / 100 * num_10ms_frames_per_packet_;
161 } 163 }
162 164
163 } // namespace webrtc 165 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698