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: I9e06d688311c388446bb53993291ebc0f98cff89
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 48be620..ccac678 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -2008,8 +2008,13 @@
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;
}