Index: webrtc/modules/utility/source/coder.cc |
diff --git a/webrtc/modules/utility/source/coder.cc b/webrtc/modules/utility/source/coder.cc |
index 18b690dc67c2ed154d3b2c079970859ec18f11aa..1476e02d9c5057fac58d46511582acdb3b5a982f 100644 |
--- a/webrtc/modules/utility/source/coder.cc |
+++ b/webrtc/modules/utility/source/coder.cc |
@@ -29,23 +29,19 @@ AudioCoder::~AudioCoder() |
{ |
} |
-int32_t AudioCoder::SetEncodeCodec(const CodecInst& codecInst) |
-{ |
- if(_acm->RegisterSendCodec((CodecInst&)codecInst) == -1) |
- { |
- return -1; |
- } |
- return 0; |
+int32_t AudioCoder::SetEncodeCodec(const CodecInst& codecInst) { |
+ const bool success = codec_manager_.RegisterEncoder(codecInst) && |
+ codec_manager_.MakeEncoder(&rent_a_codec_, _acm.get()); |
+ return success ? 0 : -1; |
} |
-int32_t AudioCoder::SetDecodeCodec(const CodecInst& codecInst) |
-{ |
- if(_acm->RegisterReceiveCodec((CodecInst&)codecInst) == -1) |
- { |
- return -1; |
- } |
- memcpy(&_receiveCodec,&codecInst,sizeof(CodecInst)); |
- return 0; |
+int32_t AudioCoder::SetDecodeCodec(const CodecInst& codecInst) { |
+ if (_acm->RegisterReceiveCodec( |
+ codecInst, [&] { return rent_a_codec_.RentIsacDecoder(); }) == -1) { |
+ return -1; |
+ } |
+ memcpy(&_receiveCodec, &codecInst, sizeof(CodecInst)); |
+ return 0; |
} |
int32_t AudioCoder::Decode(AudioFrame& decodedAudio, |