From b8e7e1077ec2635de84428edf51f5df29e45f9ea Mon Sep 17 00:00:00 2001 From: Oliver Woodman Date: Wed, 25 Nov 2015 16:42:12 +0000 Subject: [PATCH] Fix bad pixel w:h ratio calculation in H262 reader. It appears the spec calculation gives the h:w pixel ratio, where-as we want w:h. It's pretty easy to convince oneself that this way round is correct. Consider a video that's 100px by 100px, and setting aspectRatioCode=3 to achieve this. The pixelWidthHeightRatio needs to be 16/9 and not 9/16 :). Issue: #965 --- .../google/android/exoplayer/extractor/ts/H262Reader.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/src/main/java/com/google/android/exoplayer/extractor/ts/H262Reader.java b/library/src/main/java/com/google/android/exoplayer/extractor/ts/H262Reader.java index c61205d8d6..8e94411814 100644 --- a/library/src/main/java/com/google/android/exoplayer/extractor/ts/H262Reader.java +++ b/library/src/main/java/com/google/android/exoplayer/extractor/ts/H262Reader.java @@ -148,13 +148,13 @@ import java.util.Collections; int aspectRatioCode = (csdData[7] & 0xF0) >> 4; switch(aspectRatioCode) { case 2: - pixelWidthHeightRatio = (3 * width) / (float) (4 * height); + pixelWidthHeightRatio = (4 * height) / (float) (3 * width); break; case 3: - pixelWidthHeightRatio = (9 * width) / (float) (16 * height); + pixelWidthHeightRatio = (16 * height) / (float) (9 * width); break; case 4: - pixelWidthHeightRatio = (100 * width) / (float) (121 * height); + pixelWidthHeightRatio = (121 * height) / (float) (100 * width); break; default: // Do nothing.