FrameDecoder: fix 180 rotation for HDR thumbnails
HDR thumbnails go through rendering pipeline, from which rotations are
already applied. Thus the frame should have the rotation degree
cleared to zero.
Bug: 237497501
Test: manual
Change-Id: I6dd0d8bdd06fecb4808c789ae99a678c7ebfa8e8
diff --git a/media/libstagefright/FrameDecoder.cpp b/media/libstagefright/FrameDecoder.cpp
index 3df8766..344456c 100644
--- a/media/libstagefright/FrameDecoder.cpp
+++ b/media/libstagefright/FrameDecoder.cpp
@@ -86,11 +86,14 @@
displayHeight = height;
}
- if (allocRotated && (rotationAngle == 90 || rotationAngle == 270)) {
- int32_t tmp;
- tmp = width; width = height; height = tmp;
- tmp = displayWidth; displayWidth = displayHeight; displayHeight = tmp;
- tmp = tileWidth; tileWidth = tileHeight; tileHeight = tmp;
+ if (allocRotated) {
+ if (rotationAngle == 90 || rotationAngle == 270) {
+ // swap width and height for 90 & 270 degrees rotation
+ std::swap(width, height);
+ std::swap(displayWidth, displayHeight);
+ std::swap(tileWidth, tileHeight);
+ }
+ // Rotation is already applied.
rotationAngle = 0;
}