diff options
author | Glenn Kasten <gkasten@google.com> | 2014-01-08 08:56:06 -0800 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2014-01-08 11:05:41 -0800 |
commit | f94006ca0f30c27868c284e553f57bf467ae92bc (patch) | |
tree | 9e164b25b8db71ce5b970307d05979e8cdf9e2bd /media/libmedia/AudioSystem.cpp | |
parent | 4d973f3894a50413f21e7db284e96afc87f57698 (diff) | |
download | frameworks_av-f94006ca0f30c27868c284e553f57bf467ae92bc.zip frameworks_av-f94006ca0f30c27868c284e553f57bf467ae92bc.tar.gz frameworks_av-f94006ca0f30c27868c284e553f57bf467ae92bc.tar.bz2 |
Cleanup error handling in AudioSystem get methods
Don't return zero sample rate or frame count without an error.
Change-Id: I052d841080ed33e4f081ae9825a2f33dff444fb9
Diffstat (limited to 'media/libmedia/AudioSystem.cpp')
-rw-r--r-- | media/libmedia/AudioSystem.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp index 9a76111..e37888b 100644 --- a/media/libmedia/AudioSystem.cpp +++ b/media/libmedia/AudioSystem.cpp @@ -259,6 +259,11 @@ status_t AudioSystem::getSamplingRate(audio_io_handle_t output, *samplingRate = outputDesc->samplingRate; gLock.unlock(); } + if (*samplingRate == 0) { + ALOGE("AudioSystem::getSamplingRate failed for output %d stream type %d", + output, streamType); + return BAD_VALUE; + } ALOGV("getSamplingRate() streamType %d, output %d, sampling rate %u", streamType, output, *samplingRate); @@ -299,6 +304,11 @@ status_t AudioSystem::getFrameCount(audio_io_handle_t output, *frameCount = outputDesc->frameCount; gLock.unlock(); } + if (*frameCount == 0) { + ALOGE("AudioSystem::getFrameCount failed for output %d stream type %d", + output, streamType); + return BAD_VALUE; + } ALOGV("getFrameCount() streamType %d, output %d, frameCount %d", streamType, output, *frameCount); |