summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorjuha-h <jh@tutpro.com>2017-09-30 22:38:50 +0300
committerAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-09-30 21:38:50 +0200
commit743de3a8e9b5261d1e88fcdd38c25277b677ee66 (patch)
treef7ecee4542fcf1175b7c136941f261977778604a /modules
parent149b867d9514223059bd29166329046703f5552e (diff)
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
Diffstat (limited to 'modules')
-rw-r--r--modules/opensles/recorder.c7
1 files changed, 6 insertions, 1 deletions
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};