From c9670a0ef3a91361432864fee8c5db5ceeff49e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Mon, 12 Oct 2020 12:29:28 -0400
Subject: [PATCH] opensl: avoid stopping record if buffer queue is empty

Change-Id: I0c2a06afd0a3c73bb64a64ece119f7ea65f54064
---
 src/media/audio/opensl/audio_common.h     | 2 +-
 src/media/audio/opensl/audio_recorder.cpp | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/media/audio/opensl/audio_common.h b/src/media/audio/opensl/audio_common.h
index ece9cb3186..87272d5e4a 100644
--- a/src/media/audio/opensl/audio_common.h
+++ b/src/media/audio/opensl/audio_common.h
@@ -27,7 +27,7 @@ namespace opensl {
 /*
  * Sample Buffer Controls...
  */
-#define RECORD_DEVICE_KICKSTART_BUF_COUNT 2
+#define RECORD_DEVICE_KICKSTART_BUF_COUNT 4
 #define PLAY_KICKSTART_BUFFER_COUNT       8
 #define DEVICE_SHADOW_BUFFER_QUEUE_LEN    4
 #define BUF_COUNT                         16
diff --git a/src/media/audio/opensl/audio_recorder.cpp b/src/media/audio/opensl/audio_recorder.cpp
index 39bda0c6ca..97d0416a25 100644
--- a/src/media/audio/opensl/audio_recorder.cpp
+++ b/src/media/audio/opensl/audio_recorder.cpp
@@ -51,9 +51,9 @@ AudioRecorder::processSLCallback(SLAndroidSimpleBufferQueueItf bq)
         }
 
         // should leave the device to sleep to save power if no buffers
-        if (devShadowQueue_.size() == 0) {
+        /*if (devShadowQueue_.size() == 0) {
             (*recItf_)->SetRecordState(recItf_, SL_RECORDSTATE_STOPPED);
-        }
+        }*/
         callback_();
     } catch (const std::exception& e) {
         JAMI_ERR("processSLCallback exception: %s", e.what());
-- 
GitLab