Merge cherrypicks of [15818447, 15818448, 15817598, 15818379, 15818380, 15818381, 15818382, 15818383, 15818384, 15818385, 15818469, 15818035, 15818470, 15818471, 15818472, 15818397, 15818161, 15818386, 15818487, 15818488, 15818162, 15818163, 15818398, 15818399, 15818400, 15818401, 15818402, 15818403, 15818404, 15818405, 15818406, 15818527, 15818256, 15818257, 15818258, 15817906, 15817599, 15817600, 15818547] into sparse-7706357-L05800000951102060

Change-Id: Ib03aa590d05c6d6c3efc1e83447c2124c7bc1738
diff --git a/media/codec2/sfplugin/Codec2Buffer.cpp b/media/codec2/sfplugin/Codec2Buffer.cpp
index 4070478..62c8fcd 100644
--- a/media/codec2/sfplugin/Codec2Buffer.cpp
+++ b/media/codec2/sfplugin/Codec2Buffer.cpp
@@ -248,7 +248,10 @@
 
         // align width and height to support subsampling cleanly
         uint32_t stride = align(view.crop().width, 2) * divUp(layout.planes[0].allocatedDepth, 8u);
-        uint32_t vStride = align(view.crop().height, 2);
+
+        int32_t fmtHeight = mHeight;
+        format->findInt32(KEY_HEIGHT, &fmtHeight);
+        uint32_t vStride = align(fmtHeight, 2);
 
         bool tryWrapping = !copy;