add patch for microphone fix
authorStricted <info@stricted.net>
Tue, 1 May 2018 14:55:09 +0000 (16:55 +0200)
committerStricted <info@stricted.net>
Tue, 1 May 2018 14:55:09 +0000 (16:55 +0200)
Change-Id: I32c9098c16b05982c29c637dfdd760f13d304152

patches/frameworks/av/0003-MediaTek-Fix-Microphone.patch [new file with mode: 0644]

diff --git a/patches/frameworks/av/0003-MediaTek-Fix-Microphone.patch b/patches/frameworks/av/0003-MediaTek-Fix-Microphone.patch
new file mode 100644 (file)
index 0000000..6b2d5e6
--- /dev/null
@@ -0,0 +1,50 @@
+From 7a3e536a584ecfa5aa9c12aaf0a166d3fa9b5c8b Mon Sep 17 00:00:00 2001
+From: adi766 <adityakumarteli7846@gmail.com>
+Date: Sat, 23 Sep 2017 16:07:34 +0000
+Subject: [PATCH] MediaTek: Fix Microphone
+
+---
+ services/audioflinger/Android.mk  | 4 ++++
+ services/audioflinger/Threads.cpp | 4 ++--
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/services/audioflinger/Android.mk b/services/audioflinger/Android.mk
+index 886421516..1d09376ec 100644
+--- a/services/audioflinger/Android.mk
++++ b/services/audioflinger/Android.mk
+@@ -87,6 +87,10 @@ endif
+ endif
+ #QTI Resampler
++ifeq ($(BOARD_HAS_MTK_HARDWARE),true)
++LOCAL_CFLAGS += -DLEGACY_AUDIO_BLOB
++endif
++
+ LOCAL_MODULE:= libaudioflinger
+ LOCAL_SRC_FILES += \
+diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
+index e8c80c17c..a6c02dc98 100644
+--- a/services/audioflinger/Threads.cpp
++++ b/services/audioflinger/Threads.cpp
+@@ -6461,7 +6461,7 @@ reacquire_wakelock:
+         // systemTime() is optional if the hardware supports timestamps.
+         mTimestamp.mPosition[ExtendedTimestamp::LOCATION_SERVER] += framesRead;
+         mTimestamp.mTimeNs[ExtendedTimestamp::LOCATION_SERVER] = systemTime();
+-
++#ifndef LEGACY_AUDIO_BLOB
+         // Update server timestamp with kernel stats
+         if (mInput->stream->get_capture_position != nullptr
+                 && mPipeSource.get() == nullptr /* don't obtain for FastCapture, could block */) {
+@@ -6479,7 +6479,7 @@ reacquire_wakelock:
+         }
+         // Use this to track timestamp information
+         // ALOGD("%s", mTimestamp.toString().c_str());
+-
++#endif
+         if (framesRead < 0 || (framesRead == 0 && mPipeSource == 0)) {
+             ALOGE("read failed: framesRead=%zd", framesRead);
+             // Force input into standby so that it tries to recover at next read attempt
+-- 
+2.15.0.windows.1
+