From 563d3c20ab32a8f4bdf46d8f9e6dcd62fb6aaccf Mon Sep 17 00:00:00 2001 From: tonihei Date: Mon, 21 Jan 2019 12:15:30 +0000 Subject: [PATCH] Add max video size workaround for Amlogic decoder. The Amlogic awesome decoder reduces the video size of interlaced videos by half if the internal configuration isn't force reset with new maximum input size values. The product of these new values must exceed 1920x1088 to force the reset. Issue:#5003 PiperOrigin-RevId: 230206675 --- RELEASENOTES.md | 14 ++++++++------ .../video/MediaCodecVideoRenderer.java | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 28d7fb5597..31129f3b71 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -8,6 +8,14 @@ ([#5378](https://github.com/google/ExoPlayer/issues/5378)). * FFmpeg extension: Treat invalid data errors as non-fatal to match the behavior of MediaCodec ([#5293](https://github.com/google/ExoPlayer/issues/5293)). +* Add `startPositionUs` to `MediaSource.createPeriod`. This fixes an issue where + using lazy preparation in `ConcatenatingMediaSource` with an + `ExtractorMediaSource` overrides initial seek positions + ([#5350](https://github.com/google/ExoPlayer/issues/5350)). +* Add subtext to the `MediaDescriptionAdapter` of the + `PlayerNotificationManager`. +* Add workaround for video quality problems with Amlogic decoders + ([#5003](https://github.com/google/ExoPlayer/issues/5003)). * Fix issue where sending callbacks for playlist changes may cause problems because of parallel player access ([#5240](https://github.com/google/ExoPlayer/issues/5240)). @@ -16,12 +24,6 @@ ([#5351](https://github.com/google/ExoPlayer/issues/5351)). * Fix issue where uneven track durations in MP4 streams can cause OOM problems ([#3670](https://github.com/google/ExoPlayer/issues/3670)). -* Add `startPositionUs` to `MediaSource.createPeriod`. This fixes an issue where - using lazy preparation in `ConcatenatingMediaSource` with an - `ExtractorMediaSource` overrides initial seek positions - ([#5350](https://github.com/google/ExoPlayer/issues/5350)). -* Add subtext to the `MediaDescriptionAdapter` of the - `PlayerNotificationManager`. ### 2.9.3 ### diff --git a/library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java b/library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java index 9d0aae4fcf..388aa29ce9 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java @@ -1087,6 +1087,10 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { throws DecoderQueryException { int maxWidth = format.width; int maxHeight = format.height; + if (codecNeedsMaxVideoSizeResetWorkaround(codecInfo.name)) { + maxWidth = Math.max(maxWidth, 1920); + maxHeight = Math.max(maxHeight, 1089); + } int maxInputSize = getMaxInputSize(codecInfo, format); if (streamFormats.length == 1) { // The single entry in streamFormats must correspond to the format for which the codec is @@ -1274,6 +1278,18 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { return "NVIDIA".equals(Util.MANUFACTURER); } + /** + * Returns whether the codec is known to have problems with the configuration for interlaced + * content and needs minimum values for the maximum video size to force reset the configuration. + * + *

See https://github.com/google/ExoPlayer/issues/5003. + * + * @param name The name of the codec. + */ + private static boolean codecNeedsMaxVideoSizeResetWorkaround(String name) { + return "OMX.amlogic.avc.decoder.awesome".equals(name) && Util.SDK_INT <= 25; + } + /* * TODO: *