Fix miscellanous AudioTrack::getTimestamp() bugs
Check that get_presentation_position is non-NULL before calling.
AudioTrack::getTimestamp not implemented for fast tracks.
Fix typo in Track::getTimestamp().
Fix bugs in AudioTrack::getTimestamp after stop:
- getTimestamp while stopped is not allowed.
- stop, start, getTimestamp now returns the correct value.
Change-Id: Ie8d9dc1f28d8927634e04175a68b147ffc2ea8eb
diff --git a/media/libnbaio/AudioStreamOutSink.cpp b/media/libnbaio/AudioStreamOutSink.cpp
index b2de8a2..e4341d7 100644
--- a/media/libnbaio/AudioStreamOutSink.cpp
+++ b/media/libnbaio/AudioStreamOutSink.cpp
@@ -81,6 +81,9 @@
status_t AudioStreamOutSink::getTimestamp(AudioTimestamp& timestamp)
{
+ if (mStream->get_presentation_position == NULL) {
+ return INVALID_OPERATION;
+ }
// FIXME position64 won't be needed after AudioTimestamp.mPosition is changed to uint64_t
uint64_t position64;
int ok = mStream->get_presentation_position(mStream, &position64, ×tamp.mTime);