Merge "goldfish-codecs: handle width and height change from decoded frame"
am: 474de1ad2d

Change-Id: Ifbe60d326ec49670c6a906dc270b3f746057f1ec
diff --git a/system/codecs/omx/avcdec/GoldfishAVCDec.cpp b/system/codecs/omx/avcdec/GoldfishAVCDec.cpp
index bf6cbba..1da4cf0 100644
--- a/system/codecs/omx/avcdec/GoldfishAVCDec.cpp
+++ b/system/codecs/omx/avcdec/GoldfishAVCDec.cpp
@@ -357,6 +357,15 @@
             }
 
             if (img.data != nullptr) {
+                int myWidth = img.width;
+                int myHeight = img.height;
+                if (myWidth != mWidth || myHeight != mHeight) {
+                    bool portWillReset = false;
+                    handlePortSettingsChange(&portWillReset, myWidth, myHeight);
+                    resetPlugin();
+                    mWidth = myWidth;
+                    mHeight = myHeight;
+                }
                 outHeader->nFilledLen =  (outputBufferWidth() * outputBufferHeight() * 3) / 2;
                 int myStride = outputBufferWidth();
                 for (int i=0; i < mHeight; ++i) {