Hi all,

These patches fix some alsa issue. Please comment on it, on the mailing list and commit with
the patch author sign-off.

Regards Michael
Start playing without waiting the threshold. The touch sound are
under the buffer threshold.

Signed-off-by: Michael Trimarchi <[email protected]>

---
diff --git a/AudioHardwareALSA.cpp b/AudioHardwareALSA.cpp
index 5fe7fd1..1d85f43 100644
--- a/AudioHardwareALSA.cpp
+++ b/AudioHardwareALSA.cpp
@@ -830,6 +830,7 @@ ssize_t AudioStreamOutALSA::write(const void *buffer, size_t bytes)
         // an error, or -errno if the error was unrecoverable.
         n = snd_pcm_recover(mHandle, n, 0);
     }
+    snd_pcm_start(mHandle);
 
     return static_cast<ssize_t>(n);
 }
@@ -1194,7 +1195,7 @@ status_t ALSAMixer::setMasterGain(float gain)
 
 status_t ALSAMixer::setVolume(mixer_types mixer, float volume)
 {
-	mixer_info_t *info = mInfo[mixer][SND_PCM_STREAM_PLAYBACK];
+	mixer_info_t *info = mInfo[SND_PCM_STREAM_PLAYBACK][mixer];
     if (!info || !info->elem) return INVALID_OPERATION;
 
     long minVol = info->min;
@@ -1213,7 +1214,7 @@ status_t ALSAMixer::setVolume(mixer_types mixer, float volume)
 
 status_t ALSAMixer::setGain(mixer_types mixer, float gain)
 {
-	mixer_info_t *info = mInfo[mixer][SND_PCM_STREAM_CAPTURE];
+	mixer_info_t *info = mInfo[SND_PCM_STREAM_CAPTURE][mixer];
     if (!info || !info->elem) return INVALID_OPERATION;
 
     long minVol = info->min;
@@ -1232,7 +1233,7 @@ status_t ALSAMixer::setGain(mixer_types mixer, float gain)
 
 status_t ALSAMixer::setCaptureMuteState(mixer_types mixer, bool state)
 {
-	mixer_info_t *info = mInfo[mixer][SND_PCM_STREAM_CAPTURE];
+	mixer_info_t *info = mInfo[SND_PCM_STREAM_CAPTURE][mixer];
     if (!info || !info->elem) return INVALID_OPERATION;
 
     if (info->mute == state) return NO_ERROR;
@@ -1253,7 +1254,7 @@ status_t ALSAMixer::setCaptureMuteState(mixer_types mixer, bool state)
 
 status_t ALSAMixer::getCaptureMuteState(mixer_types mixer, bool *state)
 {
-	mixer_info_t *info = mInfo[mixer][SND_PCM_STREAM_CAPTURE];
+	mixer_info_t *info = mInfo[SND_PCM_STREAM_CAPTURE][mixer];
     if (!info || !info->elem) return INVALID_OPERATION;
 
     if (! state) return BAD_VALUE;
@@ -1265,7 +1266,7 @@ status_t ALSAMixer::getCaptureMuteState(mixer_types mixer, bool *state)
 
 status_t ALSAMixer::setPlaybackMuteState(mixer_types mixer, bool state)
 {
-	mixer_info_t *info = mInfo[mixer][SND_PCM_STREAM_PLAYBACK];
+	mixer_info_t *info = mInfo[SND_PCM_STREAM_PLAYBACK][mixer];
     if (!info || !info->elem) return INVALID_OPERATION;
 
     if (snd_mixer_selem_has_playback_switch (info->elem)) {
Reduce the autoidle time for the audio flinger from 3 seconds to 1 second

Signed-off-by: Michael Trimarchi <[email protected]>

---
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index fb21629..084a1a8 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -43,7 +43,7 @@
 
 namespace android {
 
-static const nsecs_t kStandbyTimeInNsecs = seconds(3);
+static const nsecs_t kStandbyTimeInNsecs = seconds(1);
 static const unsigned long kBufferRecoveryInUsecs = 2000;
 static const unsigned long kMaxBufferRecoveryInUsecs = 20000;
 static const float MAX_GAIN = 4096.0f;

Reply via email to