Add NBAIO_Sink::getTimestamp()

with a real implementation in AudioStreamOutSink
for dummy implementation initially in MonoPipe.

Use in AudioFlinger::PlaybackThread::threadLoop_write()
to keep the input to the timestamp latch up-to-date.

Change-Id: I10ef277991b63bb43d55d6f3df75116ef32246cd
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 3921b68..fda4211 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -1820,7 +1820,7 @@
         } else {
             bytesWritten = framesWritten;
         }
-        status_t status = INVALID_OPERATION;    // mLatchD.mTimestamp is invalid
+        status_t status = mNormalSink->getTimestamp(mLatchD.mTimestamp);
         if (status == NO_ERROR) {
             size_t totalFramesWritten = mNormalSink->framesWritten();
             if (totalFramesWritten >= mLatchD.mTimestamp.mPosition) {
@@ -1837,6 +1837,8 @@
             ALOG_ASSERT(mCallbackThread != 0);
             mCallbackThread->setWriteBlocked(true);
         }
+        // FIXME We should have an implementation of timestamps for direct output threads.
+        // They are used e.g for multichannel PCM playback over HDMI.
         bytesWritten = mOutput->stream->write(mOutput->stream,
                                                    mMixBuffer + offset, mBytesRemaining);
         if (mUseAsyncWrite &&