Switch to using AudioEncoderOpus instead of ACMOpus
This change switches from the old codec wrapper ACMOpus to the new AudioEncoderOpus wrapped in an ACMGenericCodecWrapper. BUG=4228 TEST=Please, try the Opus codec extensively. COAUTHOR=kwiberg@webrtc.org R=tina.legrand@webrtc.org Review URL: https://webrtc-codereview.appspot.com/33259004 Cr-Commit-Position: refs/heads/master@{#8341} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8341 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
1226e926e6
commit
6c68c85b46
@ -20,6 +20,16 @@ namespace {
|
||||
const int kMinBitrateBps = 500;
|
||||
const int kMaxBitrateBps = 512000;
|
||||
|
||||
// TODO(tlegrand): Remove this code when we have proper APIs to set the
|
||||
// complexity at a higher level.
|
||||
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) || defined(WEBRTC_ARCH_ARM)
|
||||
// If we are on Android, iOS and/or ARM, use a lower complexity setting as
|
||||
// default, to save encoder complexity.
|
||||
const int kDefaultComplexity = 5;
|
||||
#else
|
||||
const int kDefaultComplexity = 9;
|
||||
#endif
|
||||
|
||||
// We always encode at 48 kHz.
|
||||
const int kSampleRateHz = 48000;
|
||||
|
||||
@ -42,7 +52,8 @@ AudioEncoderOpus::Config::Config()
|
||||
application(kVoip),
|
||||
bitrate_bps(64000),
|
||||
fec_enabled(false),
|
||||
max_playback_rate_hz(48000) {
|
||||
max_playback_rate_hz(48000),
|
||||
complexity(kDefaultComplexity) {
|
||||
}
|
||||
|
||||
bool AudioEncoderOpus::Config::IsOk() const {
|
||||
@ -52,6 +63,8 @@ bool AudioEncoderOpus::Config::IsOk() const {
|
||||
return false;
|
||||
if (bitrate_bps < kMinBitrateBps || bitrate_bps > kMaxBitrateBps)
|
||||
return false;
|
||||
if (complexity < 0 || complexity > 10)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -75,6 +88,8 @@ AudioEncoderOpus::AudioEncoderOpus(const Config& config)
|
||||
}
|
||||
CHECK_EQ(0,
|
||||
WebRtcOpus_SetMaxPlaybackRate(inst_, config.max_playback_rate_hz));
|
||||
CHECK_EQ(0, WebRtcOpus_SetComplexity(inst_, config.complexity));
|
||||
|
||||
}
|
||||
|
||||
AudioEncoderOpus::~AudioEncoderOpus() {
|
||||
|
@ -38,6 +38,7 @@ class AudioEncoderOpus final : public AudioEncoder {
|
||||
int bitrate_bps;
|
||||
bool fec_enabled;
|
||||
int max_playback_rate_hz;
|
||||
int complexity;
|
||||
};
|
||||
|
||||
explicit AudioEncoderOpus(const Config& config);
|
||||
|
@ -695,7 +695,9 @@ ACMGenericCodec* ACMCodecDB::CreateCodecInstance(const CodecInst& codec_inst,
|
||||
#endif
|
||||
} else if (!STR_CASE_CMP(codec_inst.plname, "opus")) {
|
||||
#ifdef WEBRTC_CODEC_OPUS
|
||||
return new ACMOpus(kOpus, enable_red);
|
||||
return new ACMGenericCodecWrapper(codec_inst, cng_pt_nb, cng_pt_wb,
|
||||
cng_pt_swb, cng_pt_fb, enable_red,
|
||||
red_payload_type);
|
||||
#endif
|
||||
} else if (!STR_CASE_CMP(codec_inst.plname, "speex")) {
|
||||
#ifdef WEBRTC_CODEC_SPEEX
|
||||
|
Loading…
x
Reference in New Issue
Block a user