From 743de3a8e9b5261d1e88fcdd38c25277b677ee66 Mon Sep 17 00:00:00 2001 From: juha-h Date: Sat, 30 Sep 2017 22:38:50 +0300 Subject: modules/opensles: fix recorder speaker setup (#306) * modules/opensles: fix recorder speaker setup - if there is more than one channel, use SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT speakers x# Please enter the commit message for your changes. Lines starting * modules/zrtp: make travis happy --- modules/opensles/recorder.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/opensles/recorder.c b/modules/opensles/recorder.c index b25a6b4..04a5744 100644 --- a/modules/opensles/recorder.c +++ b/modules/opensles/recorder.c @@ -79,11 +79,16 @@ static int createAudioRecorder(struct ausrc_st *st, struct ausrc_prm *prm) SLDataLocator_AndroidSimpleBufferQueue loc_bq = { SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2 }; + int speakers; + if (prm->ch > 1) + speakers = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT; + else + speakers = SL_SPEAKER_FRONT_CENTER; SLDataFormat_PCM format_pcm = {SL_DATAFORMAT_PCM, prm->ch, prm->srate * 1000, SL_PCMSAMPLEFORMAT_FIXED_16, SL_PCMSAMPLEFORMAT_FIXED_16, - SL_SPEAKER_FRONT_CENTER, + speakers, SL_BYTEORDER_LITTLEENDIAN}; SLDataSink audioSnk = {&loc_bq, &format_pcm}; const SLInterfaceID id[1] = {SL_IID_ANDROIDSIMPLEBUFFERQUEUE}; -- cgit v1.2.3