enable meta data mode on FUGU

Use meta data mode for adaptive playback.

Bug: 19197299

Change-Id: I13d992a1c74c11ce5b2fd7a9f1e543789befc947
Signed-off-by: Tianmi Chen <[email protected]>
diff --git a/videodecoder/VideoDecoderMPEG2.cpp b/videodecoder/VideoDecoderMPEG2.cpp
index 5b79a58..928ee9b 100644
--- a/videodecoder/VideoDecoderMPEG2.cpp
+++ b/videodecoder/VideoDecoderMPEG2.cpp
@@ -103,15 +103,31 @@
         (data->codec_data->frame_width > 0) && (data->codec_data->frame_height)) {
         // update  encoded image size
         ITRACE("Video size is changed. from %dx%d to %dx%d\n",mVideoFormatInfo.width,mVideoFormatInfo.height, data->codec_data->frame_width,data->codec_data->frame_height);
-        bool needFlush = false;
+        if (useGraphicbuffer && mStoreMetaData) {
+            pthread_mutex_lock(&mFormatLock);
+        }
         mVideoFormatInfo.width = data->codec_data->frame_width;
         mVideoFormatInfo.height = data->codec_data->frame_height;
+        bool needFlush = false;
         if (useGraphicbuffer) {
-            needFlush = (mVideoFormatInfo.width > mVideoFormatInfo.surfaceWidth)
-                    || (mVideoFormatInfo.height > mVideoFormatInfo.surfaceHeight);
+            if (mStoreMetaData) {
+                needFlush = true;
+
+                mVideoFormatInfo.valid = false;
+                pthread_mutex_unlock(&mFormatLock);
+            } else {
+                needFlush = (mVideoFormatInfo.width > mVideoFormatInfo.surfaceWidth)
+                         || (mVideoFormatInfo.height > mVideoFormatInfo.surfaceHeight);
+            }
         }
+
         if (needFlush) {
-            flushSurfaceBuffers();
+            if (mStoreMetaData) {
+                status = endDecodingFrame(false);
+                CHECK_STATUS("endDecodingFrame");
+            } else {
+                flushSurfaceBuffers();
+            }
             mSizeChanged = false;
             return DECODE_FORMAT_CHANGE;
         } else {
@@ -119,6 +135,10 @@
         }
 
         setRenderRect();
+    } else {
+        if (useGraphicbuffer && mStoreMetaData) {
+            mVideoFormatInfo.valid = true;
+        }
     }
 
     VideoDecoderBase::setRotationDegrees(buffer->rotationDegrees);