libmix: refine decoder for adaptive video playback

BZ: 177230

Set the output window size to the max value and disable low delay mode when Adaptive Video Playback is enabled.

Change-Id: I13dfdde755a5a6f31f81539d1ba39f271256912b
Signed-off-by: Dan Liang <dan.liang@intel.com>
diff --git a/videodecoder/VideoDecoderAVC.cpp b/videodecoder/VideoDecoderAVC.cpp
old mode 100755
new mode 100644
index def0649..a029468
--- a/videodecoder/VideoDecoderAVC.cpp
+++ b/videodecoder/VideoDecoderAVC.cpp
@@ -237,6 +237,7 @@
     mAcquiredBuffer->renderBuffer.flag = 0;
     mAcquiredBuffer->renderBuffer.timeStamp = mCurrentPTS;
     mAcquiredBuffer->pictureOrder = getPOC(picture);
+
     if (mSizeChanged) {
         mAcquiredBuffer->renderBuffer.flag |= IS_RESOLUTION_CHANGE;
         mSizeChanged = false;
@@ -677,7 +678,7 @@
         }
     }
 
-    VideoDecoderBase::setOutputWindowSize(DPBSize);
+    VideoDecoderBase::setOutputWindowSize(mConfigBuffer.flag & WANT_ADAPTIVE_PLAYBACK ? OUTPUT_WINDOW_SIZE : DPBSize);
     updateFormatInfo(data);
 
    // for 1080p, limit the total surface to 19, according the hardware limitation
@@ -687,10 +688,15 @@
         DPBSize = 19 - AVC_EXTRA_SURFACE_NUMBER;
     }
 
-    // for baseline profile, enable low delay mode automatically
-    if (data->codec_data->profile_idc == 66) {
-        enableLowDelayMode(true);
+    if (mConfigBuffer.flag & WANT_ADAPTIVE_PLAYBACK) {
+        // 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);
+    } else {
+        // for baseline profile, enable low delay mode automatically
+        enableLowDelayMode(data->codec_data->profile_idc == 66);
     }
+
     return VideoDecoderBase::setupVA(DPBSize + AVC_EXTRA_SURFACE_NUMBER, vaProfile);
 }
 
@@ -713,8 +719,6 @@
         mVideoFormatInfo.height = height;
     }
 
-
-
     // video_range has default value of 0.
     mVideoFormatInfo.videoRange = data->codec_data->video_full_range_flag;
 
diff --git a/videodecoder/VideoDecoderDefs.h b/videodecoder/VideoDecoderDefs.h
index c74acf6..67139f0 100644
--- a/videodecoder/VideoDecoderDefs.h
+++ b/videodecoder/VideoDecoderDefs.h
@@ -113,6 +113,9 @@
 
     // indicate whether video decoder buffer contains only one field
     IS_SINGLE_FIELD = 0x80000,
+
+    // indicate adaptive playback mode
+    WANT_ADAPTIVE_PLAYBACK = 0x100000,
 } VIDEO_BUFFER_FLAG;
 
 typedef enum