codec2: Fix width and height when output is cropped
Return cropped width and height instead of block's width
and height
Test: cts-tradefed run cts -m CtsMediaBitstreamsTestCases \
-t android.media.cts.bitstreams.H264Yuv420_8bitBpBitstreamsTest
Bug: 132042537
Change-Id: I72538248fff4aeb9f0ad51e6e0d8844f66f20f92
diff --git a/media/codec2/sfplugin/utils/Codec2BufferUtils.cpp b/media/codec2/sfplugin/utils/Codec2BufferUtils.cpp
index 6b8663f..1e884ef 100644
--- a/media/codec2/sfplugin/utils/Codec2BufferUtils.cpp
+++ b/media/codec2/sfplugin/utils/Codec2BufferUtils.cpp
@@ -118,7 +118,7 @@
} // namespace
status_t ImageCopy(uint8_t *imgBase, const MediaImage2 *img, const C2GraphicView &view) {
- if (view.width() != img->mWidth || view.height() != img->mHeight) {
+ if (view.crop().width != img->mWidth || view.crop().height != img->mHeight) {
return BAD_VALUE;
}
if ((IsNV12(view) && IsI420(img)) || (IsI420(view) && IsNV12(img))) {
@@ -153,7 +153,7 @@
}
status_t ImageCopy(C2GraphicView &view, const uint8_t *imgBase, const MediaImage2 *img) {
- if (view.width() != img->mWidth || view.height() != img->mHeight) {
+ if (view.crop().width != img->mWidth || view.crop().height != img->mHeight) {
return BAD_VALUE;
}
if ((IsNV12(img) && IsI420(view)) || (IsI420(img) && IsNV12(view))) {