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

Unified Diff: webrtc/modules/utility/source/coder.cc

Issue 1677013002: Switch to using new ACM methods for encoder management (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@acm-13
Patch Set: DCHECKs Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/utility/source/coder.h ('k') | webrtc/voice_engine/channel.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « webrtc/modules/utility/source/coder.h ('k') | webrtc/voice_engine/channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698