Skip to content

Instantly share code, notes, and snippets.

@pawitp
Last active March 12, 2017 03:47
Show Gist options
  • Select an option

  • Save pawitp/7945188 to your computer and use it in GitHub Desktop.

Select an option

Save pawitp/7945188 to your computer and use it in GitHub Desktop.
From 916d3b4f678cbc99540f28772525b51a5003696d Mon Sep 17 00:00:00 2001
From: Pawit Pornkitprasan <[email protected]>
Date: Fri, 13 Dec 2013 21:37:01 +0700
Subject: [PATCH 1/2] AudioMixer: fix artifact on 2 short sounds
On the I9082, when 2 short sounds are played simultaneously, there will be artifact
on the speaker due to the buffer not being cleared.
Change-Id: I8a325175e8e326a638c7f29987ae272ae8af6b66
---
services/audioflinger/AudioMixer.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index 95f7381..5f80165 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -1128,8 +1128,13 @@ void AudioMixer::process__genericNoResampling(state_t* state, int64_t pts)
t.in = t.buffer.raw;
// t.in == NULL can happen if the track was flushed just after having
// been enabled for mixing.
- if (t.in == NULL)
+ if (t.in == NULL) {
enabledTracks &= ~(1<<i);
+
+ // We need to clear buffer here or there will be strange artifact
+ // on I9082's speaker
+ memset(t.mainBuffer, 0, sizeof(int16_t) * MAX_NUM_CHANNELS * state->frameCount);
+ }
}
e0 = enabledTracks;
--
1.8.3.4 (Apple Git-47)
From ec6dc5ebee04eb4570f91e02b851c3a223eac0ad Mon Sep 17 00:00:00 2001
From: Pawit Pornkitprasan <[email protected]>
Date: Tue, 17 Dec 2013 13:15:52 +0700
Subject: [PATCH 2/2] OMXCodec: set default input buffer size
Broadcom OMX only set the buffer size to 65536 by default which
is not enough for higher bitrate video
Change-Id: I74372f3d821e41feb38b9bc0cca4ef56aa019493
---
media/libstagefright/OMXCodec.cpp | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index d3be3bc..66d5907 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -801,6 +801,18 @@ status_t OMXCodec::configureCodec(const sp<MetaData> &meta) {
if (meta->findInt32(kKeyMaxInputSize, &maxInputSize)) {
setMinBufferSize(kPortIndexInput, (OMX_U32)maxInputSize);
}
+// Capri's OMX fail to set a reasonable default size from width and height
+#ifdef CAPRI_HWC
+ else {
+ int32_t width;
+ int32_t height;
+ if (meta->findInt32(kKeyWidth, &width) && meta->findInt32(kKeyHeight, &height)) {
+ setMinBufferSize(kPortIndexInput, (width * height * 3) / 2);
+ } else {
+ ALOGE("Failed to set min buffer size");
+ }
+ }
+#endif
initOutputFormat(meta);
--
1.8.3.4 (Apple Git-47)
@pawitp
Copy link
Author

pawitp commented Jul 14, 2014

Change log: removed AudioMixer patch as it's already included

@laddycc
Copy link

laddycc commented Feb 21, 2016

how to patch sir need tutorial

@Vladislav4KZ
Copy link

How to put patch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment