summaryrefslogtreecommitdiffstats
path: root/libaudio2
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2010-11-11 14:15:35 -0800
committerEric Laurent <elaurent@google.com>2010-11-11 14:15:35 -0800
commit0825ee6b0bdb1042f0bb5d9c9f7c5aebd240fe15 (patch)
treeaa14c3e2c09df589934be4ed17bd0f7181d77e02 /libaudio2
parent6ab6d7021e5eb7ff43e56692a92b628a48add525 (diff)
downloaddevice_samsung_crespo-0825ee6b0bdb1042f0bb5d9c9f7c5aebd240fe15.zip
device_samsung_crespo-0825ee6b0bdb1042f0bb5d9c9f7c5aebd240fe15.tar.gz
device_samsung_crespo-0825ee6b0bdb1042f0bb5d9c9f7c5aebd240fe15.tar.bz2
Additional error checks in Audio HAL.
Added check in case re-opening the input driver fails when starting the output stream (and vice versa). Fixed bug in AudioStreamInALSA::getNextBuffer(): mReadStatus was not updated if device driver was null. Change-Id: I3068928c9f71b7f2a68763e8dced9d405665dbc7
Diffstat (limited to 'libaudio2')
-rw-r--r--libaudio2/AudioHardware.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/libaudio2/AudioHardware.cpp b/libaudio2/AudioHardware.cpp
index 333e3cc..3755e23 100644
--- a/libaudio2/AudioHardware.cpp
+++ b/libaudio2/AudioHardware.cpp
@@ -1006,7 +1006,9 @@ ssize_t AudioHardware::AudioStreamOutALSA::write(const void* buffer, size_t byte
open_l();
if (spIn != 0) {
- spIn->open_l();
+ if (spIn->open_l() != NO_ERROR) {
+ spIn->doStandby_l();
+ }
spIn->unlock();
}
if (mPcm == NULL) {
@@ -1324,7 +1326,9 @@ ssize_t AudioHardware::AudioStreamInALSA::read(void* buffer, ssize_t bytes)
// open output before input
if (spOut != 0) {
- spOut->open_l();
+ if (spOut->open_l() != NO_ERROR) {
+ spOut->doStandby_l();
+ }
spOut->unlock();
}
@@ -1432,7 +1436,7 @@ status_t AudioHardware::AudioStreamInALSA::open_l()
mPcm = pcm_open(flags);
TRACE_DRIVER_OUT
if (!pcm_ready(mPcm)) {
- LOGE("cannot open pcm_out driver: %s\n", pcm_error(mPcm));
+ LOGE("cannot open pcm_in driver: %s\n", pcm_error(mPcm));
TRACE_DRIVER_IN(DRV_PCM_CLOSE)
pcm_close(mPcm);
TRACE_DRIVER_OUT
@@ -1574,6 +1578,7 @@ status_t AudioHardware::AudioStreamInALSA::getNextBuffer(AudioHardware::BufferPr
if (mPcm == NULL) {
buffer->raw = NULL;
buffer->frameCount = 0;
+ mReadStatus = NO_INIT;
return NO_INIT;
}