OLD | NEW |
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 |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 AudioCoder::~AudioCoder() {} | 39 AudioCoder::~AudioCoder() {} |
40 | 40 |
41 int32_t AudioCoder::SetEncodeCodec(const CodecInst& codec_inst) { | 41 int32_t AudioCoder::SetEncodeCodec(const CodecInst& codec_inst) { |
42 const bool success = codec_manager_.RegisterEncoder(codec_inst) && | 42 const bool success = codec_manager_.RegisterEncoder(codec_inst) && |
43 codec_manager_.MakeEncoder(&rent_a_codec_, acm_.get()); | 43 codec_manager_.MakeEncoder(&rent_a_codec_, acm_.get()); |
44 return success ? 0 : -1; | 44 return success ? 0 : -1; |
45 } | 45 } |
46 | 46 |
47 int32_t AudioCoder::SetDecodeCodec(const CodecInst& codec_inst) { | 47 int32_t AudioCoder::SetDecodeCodec(const CodecInst& codec_inst) { |
48 if (acm_->RegisterReceiveCodec(codec_inst, [&] { | 48 if (!acm_->RegisterReceiveCodec(codec_inst.pltype, |
49 return rent_a_codec_.RentIsacDecoder(codec_inst.plfreq); | 49 CodecInstToSdp(codec_inst))) { |
50 }) == -1) { | |
51 return -1; | 50 return -1; |
52 } | 51 } |
53 memcpy(&receive_codec_, &codec_inst, sizeof(CodecInst)); | 52 memcpy(&receive_codec_, &codec_inst, sizeof(CodecInst)); |
54 return 0; | 53 return 0; |
55 } | 54 } |
56 | 55 |
57 int32_t AudioCoder::Decode(AudioFrame* decoded_audio, | 56 int32_t AudioCoder::Decode(AudioFrame* decoded_audio, |
58 uint32_t samp_freq_hz, | 57 uint32_t samp_freq_hz, |
59 const int8_t* incoming_payload, | 58 const int8_t* incoming_payload, |
60 size_t payload_length) { | 59 size_t payload_length) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 uint32_t /* time_stamp */, | 106 uint32_t /* time_stamp */, |
108 const uint8_t* payload_data, | 107 const uint8_t* payload_data, |
109 size_t payload_size, | 108 size_t payload_size, |
110 const RTPFragmentationHeader* /* fragmentation*/) { | 109 const RTPFragmentationHeader* /* fragmentation*/) { |
111 memcpy(encoded_data_, payload_data, sizeof(uint8_t) * payload_size); | 110 memcpy(encoded_data_, payload_data, sizeof(uint8_t) * payload_size); |
112 encoded_length_in_bytes_ = payload_size; | 111 encoded_length_in_bytes_ = payload_size; |
113 return 0; | 112 return 0; |
114 } | 113 } |
115 | 114 |
116 } // namespace webrtc | 115 } // namespace webrtc |
OLD | NEW |