Change preview player code also.

Adapt to 32 bit aligned decoder buffers

Change-Id: I631f7e60b8e424af496f45d0e5e292bf9e8a9dde
diff --git a/libvideoeditor/lvpp/PreviewPlayer.cpp b/libvideoeditor/lvpp/PreviewPlayer.cpp
index 2f46e4c..4738fdd 100755
--- a/libvideoeditor/lvpp/PreviewPlayer.cpp
+++ b/libvideoeditor/lvpp/PreviewPlayer.cpp
@@ -141,7 +141,9 @@
 PreviewPlayer::PreviewPlayer()
     : AwesomePlayer(),
       mFrameRGBBuffer(NULL),
-      mFrameYUVBuffer(NULL) {
+      mFrameYUVBuffer(NULL),
+      mReportedWidth(0),
+      mReportedHeight(0) {
 
     mVideoRenderer = NULL;
     mLastVideoBuffer = NULL;
@@ -308,6 +310,9 @@
 
     mVideoSource = DummyVideoSource::Create(mVideoWidth, mVideoHeight,
                                             mDurationUs, mUri);
+    mReportedWidth = mVideoWidth;
+    mReportedHeight = mVideoHeight;
+
     setVideoSource(mVideoSource);
     status_t err1 = mVideoSource->start();
     if (err1 != OK) {
@@ -648,6 +653,9 @@
         CHECK(mVideoTrack->getFormat()->findInt32(kKeyWidth, &mVideoWidth));
         CHECK(mVideoTrack->getFormat()->findInt32(kKeyHeight, &mVideoHeight));
 
+        mReportedWidth = mVideoWidth;
+        mReportedHeight = mVideoHeight;
+
         status_t err = mVideoSource->start();
 
         if (err != OK) {
@@ -720,7 +728,10 @@
                 if (err == INFO_FORMAT_CHANGED) {
                     LOGV("LV PLAYER VideoSource signalled format change");
                     notifyVideoSize_l();
+                    sp<MetaData> meta = mVideoSource->getFormat();
 
+                    CHECK(meta->findInt32(kKeyWidth, &mReportedWidth));
+                    CHECK(meta->findInt32(kKeyHeight, &mReportedHeight));
                     if (mVideoRenderer != NULL) {
                         mVideoRendererIsPreview = false;
                         initRenderer_l();
@@ -1397,7 +1408,7 @@
 
     /* In plane*/
     prepareYUV420ImagePlane(planeIn, mVideoWidth,
-      mVideoHeight, (M4VIFI_UInt8 *)inBuffer);
+      mVideoHeight, (M4VIFI_UInt8 *)inBuffer, mReportedWidth, mReportedHeight);
 
     // Set the output YUV420 plane to be compatible with YV12 format
     // W & H even
@@ -1588,7 +1599,7 @@
     postProcessParams.overlayFrameRGBBuffer = mFrameRGBBuffer;
     postProcessParams.overlayFrameYUVBuffer = mFrameYUVBuffer;
     mVideoRenderer->getBuffer(&(postProcessParams.pOutBuffer), &(postProcessParams.outBufferStride));
-    err = applyEffectsAndRenderingMode(&postProcessParams);
+    err = applyEffectsAndRenderingMode(&postProcessParams, mReportedWidth, mReportedHeight);
 
     return err;
 }
@@ -1615,6 +1626,10 @@
                 if (err == INFO_FORMAT_CHANGED) {
                     LOGV("LV PLAYER VideoSource signalled format change");
                     notifyVideoSize_l();
+                    sp<MetaData> meta = mVideoSource->getFormat();
+
+                    CHECK(meta->findInt32(kKeyWidth, &mReportedWidth));
+                    CHECK(meta->findInt32(kKeyHeight, &mReportedHeight));
 
                     if (mVideoRenderer != NULL) {
                         mVideoRendererIsPreview = false;