From d0d41498a32c6723e74b7778d9600ec230fa4eb2 Mon Sep 17 00:00:00 2001 From: "tina.legrand@webrtc.org" Date: Thu, 20 Dec 2012 09:23:10 +0000 Subject: [PATCH] Adding AUDIO application as default for Opus stereo The Opus audio codec targets applications for pure conversations as well as other types of audio (e.g. music), and there are two different settings to use for this (VoIP and AUDIO). In the current implementation of Opus in WebRTC we use VoIP only. I this CL I have changed default setting to AUDIO in the case of stereo, and kept VoIP as default in case of mono. Next step is to add an API to choose application mode. BUG=issue1239 Review URL: https://webrtc-codereview.appspot.com/1007006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3319 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/modules/audio_coding/codecs/opus/opus_interface.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/webrtc/modules/audio_coding/codecs/opus/opus_interface.c b/webrtc/modules/audio_coding/codecs/opus/opus_interface.c index 75463fc504..6b6ab6dcd6 100644 --- a/webrtc/modules/audio_coding/codecs/opus/opus_interface.c +++ b/webrtc/modules/audio_coding/codecs/opus/opus_interface.c @@ -42,8 +42,11 @@ int16_t WebRtcOpus_EncoderCreate(OpusEncInst** inst, int32_t channels) { state = (OpusEncInst*) calloc(1, sizeof(OpusEncInst)); if (state) { int error; - state->encoder = opus_encoder_create(48000, channels, OPUS_APPLICATION_VOIP, - &error); + // Default to VoIP application for mono, and AUDIO for stereo. + int application = (channels == 1) ? + OPUS_APPLICATION_VOIP : OPUS_APPLICATION_AUDIO; + + state->encoder = opus_encoder_create(48000, channels, application, &error); if (error == OPUS_OK || state->encoder != NULL ) { *inst = state; return 0;