Files
Arch-R/projects/WeTek_Play/patches/kodi/0001-Fix-ALSA-sound-output-for-Amlogic-based-devices.patch
T
2016-04-18 00:51:02 -07:00

53 lines
1.7 KiB
Diff

From fde3d3d609e570aa3a8691a4e66e07dce1c80b25 Mon Sep 17 00:00:00 2001
From: Alex Deryskyba <alex@codesnake.com>
Date: Wed, 16 Apr 2014 22:02:01 +0300
Subject: [PATCH] [aml] Fix ALSA sound output for Amlogic-based devices.
---
xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
index fbccce0..6bf2c53 100644
--- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
@@ -84,6 +84,17 @@ static unsigned int ALSASampleRateList[] =
0
};
+static int CheckNP2(unsigned x)
+{
+ --x;
+ x |= x >> 1;
+ x |= x >> 2;
+ x |= x >> 4;
+ x |= x >> 8;
+ x |= x >> 16;
+ return ++x;
+}
+
CAESinkALSA::CAESinkALSA() :
m_bufferSize(0),
m_formatSampleRateMul(0.0),
@@ -748,12 +759,20 @@ bool CAESinkALSA::InitializeHW(const ALSAConfig &inconfig, ALSAConfig &outconfig
*/
periodSize = std::min(periodSize, (snd_pcm_uframes_t) sampleRate / 20);
bufferSize = std::min(bufferSize, (snd_pcm_uframes_t) sampleRate / 5);
+#if defined(HAS_LIBAMCODEC)
+ // must be pot for pivos.
+ bufferSize = CheckNP2(bufferSize);
+#endif
/*
According to upstream we should set buffer size first - so make sure it is always at least
4x period size to not get underruns (some systems seem to have issues with only 2 periods)
*/
periodSize = std::min(periodSize, bufferSize / 4);
+#if defined(HAS_LIBAMCODEC)
+ // must be pot for pivos.
+ periodSize = CheckNP2(periodSize);
+#endif
CLog::Log(LOGDEBUG, "CAESinkALSA::InitializeHW - Request: periodSize %lu, bufferSize %lu", periodSize, bufferSize);