summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJohn Grossman <johngro@google.com>2011-08-29 10:26:47 -0700
committerMike Lockwood <lockwood@android.com>2011-10-28 10:14:48 -0400
commit8659bd107fbe6ff3a3b2bd7f07b655876a872d2d (patch)
treebc5039102e4049987c02ad76fa6dcbb8ed05f6d8 /services
parent7bce396226455ee22714c9e5967bae6cea7e4b23 (diff)
downloadframeworks_base-8659bd107fbe6ff3a3b2bd7f07b655876a872d2d.zip
frameworks_base-8659bd107fbe6ff3a3b2bd7f07b655876a872d2d.tar.gz
frameworks_base-8659bd107fbe6ff3a3b2bd7f07b655876a872d2d.tar.bz2
Add a missing NULL check.
The get_next_write_timestamp method introduced to the audio HAL is optional. HALs which do not implement it leave it set to NULL. Callers (there is currently only one in the AudioMixer code) need to be certain to check for NULL before invoking it. Change-Id: I88ba43bb53bec081c98c9a8842936c4fbfdd44f6
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/AudioFlinger.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index a0f1e67..778e409 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -2033,8 +2033,13 @@ bool AudioFlinger::MixerThread::threadLoop()
if (LIKELY(mixerStatus == MIXER_TRACKS_READY)) {
// obtain the presentation timestamp of the next output buffer
int64_t pts;
- status_t status = mOutput->stream->get_next_write_timestamp(
- mOutput->stream, &pts);
+ status_t status = INVALID_OPERATION;
+
+ if (NULL != mOutput->stream->get_next_write_timestamp) {
+ status = mOutput->stream->get_next_write_timestamp(
+ mOutput->stream, &pts);
+ }
+
if (status != NO_ERROR) {
pts = AudioBufferProvider::kInvalidPTS;
}