Set pixel aspect ratio from output media format if set
This commit is contained in:
parent
9c5ea4f1ba
commit
f0463bff8a
@ -1342,7 +1342,12 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||
? mediaFormat.getInteger(KEY_CROP_BOTTOM) - mediaFormat.getInteger(KEY_CROP_TOP) + 1
|
||||
: mediaFormat.getInteger(MediaFormat.KEY_HEIGHT);
|
||||
}
|
||||
pixelWidthHeightRatio = format.pixelWidthHeightRatio;
|
||||
boolean hasPixelAspectRatio = mediaFormat.containsKey(MediaFormat.KEY_PIXEL_ASPECT_RATIO_WIDTH)
|
||||
&& mediaFormat.containsKey(MediaFormat.KEY_PIXEL_ASPECT_RATIO_HEIGHT);
|
||||
pixelWidthHeightRatio = hasPixelAspectRatio ?
|
||||
mediaFormat.getInteger(MediaFormat.KEY_PIXEL_ASPECT_RATIO_WIDTH) /
|
||||
mediaFormat.getInteger(MediaFormat.KEY_PIXEL_ASPECT_RATIO_HEIGHT)
|
||||
: format.pixelWidthHeightRatio;
|
||||
// The decoder applies the rotation when rendering to the surface. For 90 and 270 degree
|
||||
// rotations, we need to flip the width, height and pixel aspect ratio to reflect the rotation
|
||||
// that was applied.
|
||||
|
Loading…
x
Reference in New Issue
Block a user