mediaplayer: limit scheduling video frames into the future

This addresses when video timestamps jumps before an audio timestamp,
but still works on slideshow video clips (<=1fps).

This, however, will not skip time-changes on video-only live video
streams, as we cannot distinguish live slideshow video clips from
non-slideshow ones.

Bug: 18032127
Change-Id: I959a714edfe1c8cf3b84704c693dcd1b3e5b7855
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.h b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.h
index 7079f85..b15a266 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.h
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.h
@@ -101,6 +101,7 @@
     enum {
         kWhatDrainAudioQueue     = 'draA',
         kWhatDrainVideoQueue     = 'draV',
+        kWhatPostDrainVideoQueue = 'pDVQ',
         kWhatQueueBuffer         = 'queB',
         kWhatQueueEOS            = 'qEOS',
         kWhatFlush               = 'flus',
@@ -119,6 +120,7 @@
         sp<AMessage> mNotifyConsumed;
         size_t mOffset;
         status_t mFinalResult;
+        int32_t mBufferOrdinal;
     };
 
     static const int64_t kMinPositionUpdateDelayUs;
@@ -169,6 +171,9 @@
     bool mAudioOffloadTornDown;
     audio_offload_info_t mCurrentOffloadInfo;
 
+    int32_t mTotalBuffersQueued;
+    int32_t mLastAudioBufferDrained;
+
     size_t fillAudioBuffer(void *buffer, size_t size);
 
     bool onDrainAudioQueue();