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

Side by Side Diff: webrtc/modules/utility/source/coder.cc

Issue 2388153004: Stop using old AudioCodingModule::RegisterReceiveCodec overloads (Closed)
Patch Set: rebase Created 4 years, 2 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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/common_types.h" 11 #include "webrtc/common_types.h"
12 #include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h"
12 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" 13 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h"
13 #include "webrtc/modules/include/module_common_types.h" 14 #include "webrtc/modules/include/module_common_types.h"
14 #include "webrtc/modules/utility/source/coder.h" 15 #include "webrtc/modules/utility/source/coder.h"
15 16
16 namespace webrtc { 17 namespace webrtc {
17 namespace { 18 namespace {
18 AudioCodingModule::Config GetAcmConfig(uint32_t id) { 19 AudioCodingModule::Config GetAcmConfig(uint32_t id) {
19 AudioCodingModule::Config config; 20 AudioCodingModule::Config config;
20 // This class does not handle muted output. 21 // This class does not handle muted output.
21 config.neteq_config.enable_muted_state = false; 22 config.neteq_config.enable_muted_state = false;
(...skipping 16 matching lines...) Expand all
38 39
39 AudioCoder::~AudioCoder() {} 40 AudioCoder::~AudioCoder() {}
40 41
41 int32_t AudioCoder::SetEncodeCodec(const CodecInst& codec_inst) { 42 int32_t AudioCoder::SetEncodeCodec(const CodecInst& codec_inst) {
42 const bool success = codec_manager_.RegisterEncoder(codec_inst) && 43 const bool success = codec_manager_.RegisterEncoder(codec_inst) &&
43 codec_manager_.MakeEncoder(&rent_a_codec_, acm_.get()); 44 codec_manager_.MakeEncoder(&rent_a_codec_, acm_.get());
44 return success ? 0 : -1; 45 return success ? 0 : -1;
45 } 46 }
46 47
47 int32_t AudioCoder::SetDecodeCodec(const CodecInst& codec_inst) { 48 int32_t AudioCoder::SetDecodeCodec(const CodecInst& codec_inst) {
48 if (acm_->RegisterReceiveCodec(codec_inst, [&] { 49 if (!acm_->RegisterReceiveCodec(codec_inst.pltype,
49 return rent_a_codec_.RentIsacDecoder(codec_inst.plfreq); 50 CodecInstToSdp(codec_inst))) {
50 }) == -1) {
51 return -1; 51 return -1;
52 } 52 }
53 memcpy(&receive_codec_, &codec_inst, sizeof(CodecInst)); 53 memcpy(&receive_codec_, &codec_inst, sizeof(CodecInst));
54 return 0; 54 return 0;
55 } 55 }
56 56
57 int32_t AudioCoder::Decode(AudioFrame* decoded_audio, 57 int32_t AudioCoder::Decode(AudioFrame* decoded_audio,
58 uint32_t samp_freq_hz, 58 uint32_t samp_freq_hz,
59 const int8_t* incoming_payload, 59 const int8_t* incoming_payload,
60 size_t payload_length) { 60 size_t payload_length) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 uint32_t /* time_stamp */, 107 uint32_t /* time_stamp */,
108 const uint8_t* payload_data, 108 const uint8_t* payload_data,
109 size_t payload_size, 109 size_t payload_size,
110 const RTPFragmentationHeader* /* fragmentation*/) { 110 const RTPFragmentationHeader* /* fragmentation*/) {
111 memcpy(encoded_data_, payload_data, sizeof(uint8_t) * payload_size); 111 memcpy(encoded_data_, payload_data, sizeof(uint8_t) * payload_size);
112 encoded_length_in_bytes_ = payload_size; 112 encoded_length_in_bytes_ = payload_size;
113 return 0; 113 return 0;
114 } 114 }
115 115
116 } // namespace webrtc 116 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698