aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShraddha Basantwani <shraddha.basantwani@ittiam.com>2019-05-22 18:07:27 +0530
committerNick Chalko <nchalko@google.com>2019-09-16 15:52:58 -0700
commit906d4098e8264baf527b072179273517c1209eb5 (patch)
treedbd50ee67907fc5be392956de73bb6dcee56cd28 /src
parent5f6346e53981c847909d238d330805836052c4bc (diff)
downloadTV-906d4098e8264baf527b072179273517c1209eb5.tar.gz
Fix aspect ratio for recorded contentndk-sysroot-r21
The pixel aspect ratio for recorded content is not stored. The pixel aspect ratio is applied to the width and the modified width is stored. Bug: 133364485 Change-Id: I8f6de7a9719167fa3e6c47e403e2f21b494159c3 Test: manual
Diffstat (limited to 'src')
-rw-r--r--src/com/android/tv/dvr/ui/playback/DvrPlayer.java8
-rw-r--r--src/com/android/tv/ui/TunableTvView.java10
2 files changed, 11 insertions, 7 deletions
diff --git a/src/com/android/tv/dvr/ui/playback/DvrPlayer.java b/src/com/android/tv/dvr/ui/playback/DvrPlayer.java
index e8325e1f..6cfa2e20 100644
--- a/src/com/android/tv/dvr/ui/playback/DvrPlayer.java
+++ b/src/com/android/tv/dvr/ui/playback/DvrPlayer.java
@@ -521,13 +521,17 @@ public class DvrPlayer {
for (TvTrackInfo trackInfo : trackInfos) {
if (trackInfo.getId().equals(trackId)) {
float videoAspectRatio;
+ float videoPixelAspectRatio =
+ trackInfo.getVideoPixelAspectRatio();
int videoWidth = trackInfo.getVideoWidth();
int videoHeight = trackInfo.getVideoHeight();
if (videoWidth > 0 && videoHeight > 0) {
videoAspectRatio =
- trackInfo.getVideoPixelAspectRatio()
- * trackInfo.getVideoWidth()
+ (float) trackInfo.getVideoWidth()
/ trackInfo.getVideoHeight();
+ videoAspectRatio *=
+ videoPixelAspectRatio > 0 ?
+ videoPixelAspectRatio : 1;
} else {
// Aspect ratio is unknown. Pass the message to
// listeners.
diff --git a/src/com/android/tv/ui/TunableTvView.java b/src/com/android/tv/ui/TunableTvView.java
index 49f7d4c9..a736e79d 100644
--- a/src/com/android/tv/ui/TunableTvView.java
+++ b/src/com/android/tv/ui/TunableTvView.java
@@ -290,12 +290,12 @@ public class TunableTvView extends FrameLayout implements StreamInfo, TunableTvV
if (mVideoWidth <= 0 || mVideoHeight <= 0) {
mVideoDisplayAspectRatio = 0.0f;
} else {
- float VideoPixelAspectRatio =
+ float videoPixelAspectRatio =
track.getVideoPixelAspectRatio();
- mVideoDisplayAspectRatio =
- VideoPixelAspectRatio
- * mVideoWidth
- / mVideoHeight;
+ mVideoDisplayAspectRatio = (float) mVideoWidth
+ / mVideoHeight;
+ mVideoDisplayAspectRatio *= videoPixelAspectRatio > 0 ?
+ videoPixelAspectRatio : 1;
}
} else if (type == TvTrackInfo.TYPE_AUDIO) {
mAudioChannelCount = track.getAudioChannelCount();