Chromium Code Reviews| 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( | 48 if (acm_->RegisterReceiveCodec(codec_inst, [&] { | 
| 
 
perkj_webrtc
2016/06/01 20:04:40
FYI capture all lambdas are not allowed according
 
kwiberg-webrtc
2016/06/02 08:23:16
They relaxed the rules slightly (some months ago I
 
 | |
| 49 codec_inst, [&] { return rent_a_codec_.RentIsacDecoder(); }) == -1) { | 49 return rent_a_codec_.RentIsacDecoder(codec_inst.plfreq); | 
| 50 }) == -1) { | |
| 50 return -1; | 51 return -1; | 
| 51 } | 52 } | 
| 52 memcpy(&receive_codec_, &codec_inst, sizeof(CodecInst)); | 53 memcpy(&receive_codec_, &codec_inst, sizeof(CodecInst)); | 
| 53 return 0; | 54 return 0; | 
| 54 } | 55 } | 
| 55 | 56 | 
| 56 int32_t AudioCoder::Decode(AudioFrame& decoded_audio, | 57 int32_t AudioCoder::Decode(AudioFrame& decoded_audio, | 
| 57 uint32_t samp_freq_hz, | 58 uint32_t samp_freq_hz, | 
| 58 const int8_t* incoming_payload, | 59 const int8_t* incoming_payload, | 
| 59 size_t payload_length) { | 60 size_t payload_length) { | 
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 uint32_t /* time_stamp */, | 107 uint32_t /* time_stamp */, | 
| 107 const uint8_t* payload_data, | 108 const uint8_t* payload_data, | 
| 108 size_t payload_size, | 109 size_t payload_size, | 
| 109 const RTPFragmentationHeader* /* fragmentation*/) { | 110 const RTPFragmentationHeader* /* fragmentation*/) { | 
| 110 memcpy(encoded_data_, payload_data, sizeof(uint8_t) * payload_size); | 111 memcpy(encoded_data_, payload_data, sizeof(uint8_t) * payload_size); | 
| 111 encoded_length_in_bytes_ = payload_size; | 112 encoded_length_in_bytes_ = payload_size; | 
| 112 return 0; | 113 return 0; | 
| 113 } | 114 } | 
| 114 | 115 | 
| 115 } // namespace webrtc | 116 } // namespace webrtc | 
| OLD | NEW |