Fixed the timestamp mismatching issue for 2 GTS cases.

Bug: 30945285
BZ: 50789

Check Adaptive when flag is not informed by upper layer.

When AdaptivePlayBack is enabled, close low delay mode to keep
right PTS order.

Change-Id: I6c5609ae795ebceaa3a98e8d537f477e07abb5d8
Signed-off-by: Xin Wang <xin1.wang@intel.com>
Signed-off-by: Austin Hu <austin.hu@intel.com>
diff --git a/videodecoder/VideoDecoderAVC.cpp b/videodecoder/VideoDecoderAVC.cpp
index 283442e..f0e047e 100644
--- a/videodecoder/VideoDecoderAVC.cpp
+++ b/videodecoder/VideoDecoderAVC.cpp
@@ -28,7 +28,8 @@
 VideoDecoderAVC::VideoDecoderAVC(const char *mimeType)
     : VideoDecoderBase(mimeType, VBP_H264),
       mToggleDPB(0),
-      mErrorConcealment(false){
+      mErrorConcealment(false),
+      mAdaptive(false){
 
     invalidateDPB(0);
     invalidateDPB(1);
@@ -681,7 +682,7 @@
     //Use high profile for all kinds of H.264 profiles (baseline, main and high) except for constrained baseline
     VAProfile vaProfile = VAProfileH264High;
 
-    if (mConfigBuffer.flag & WANT_ADAPTIVE_PLAYBACK) {
+    if ((mConfigBuffer.flag & WANT_ADAPTIVE_PLAYBACK) || mAdaptive) {
         // When Adaptive playback is enabled, turn off low delay mode.
         // Otherwise there may be a 240ms stuttering if the output mode is changed from LowDelay to Delay.
         enableLowDelayMode(false);
@@ -741,6 +742,7 @@
         if (VideoDecoderBase::alignMB(mVideoFormatInfo.width) != width ||
             VideoDecoderBase::alignMB(mVideoFormatInfo.height) != height) {
             mSizeChanged = true;
+            mAdaptive = true;
             ITRACE("Video size is changed.");
         }
         mVideoFormatInfo.width = width;
diff --git a/videodecoder/VideoDecoderAVC.h b/videodecoder/VideoDecoderAVC.h
index 6129703..19135af 100755
--- a/videodecoder/VideoDecoderAVC.h
+++ b/videodecoder/VideoDecoderAVC.h
@@ -77,6 +77,7 @@
     uint32_t mLastPictureFlags;
     VideoExtensionBuffer mExtensionBuffer;
     PackedFrameData mPackedFrame;
+    bool mAdaptive;
 };