Commit 9a5096ee by andrewlewis Committed by Andrew Lewis

Disable post processing on Nvidia devices

PiperOrigin-RevId: 224291309
parent 556dd7e9
...@@ -9,9 +9,11 @@ ...@@ -9,9 +9,11 @@
([#3314](https://github.com/google/ExoPlayer/issues/3314)). ([#3314](https://github.com/google/ExoPlayer/issues/3314)).
* Do not retry failed loads whose error is `FileNotFoundException`. * Do not retry failed loads whose error is `FileNotFoundException`.
* Prevent Cea608Decoder from generating Subtitles with null Cues list * Prevent Cea608Decoder from generating Subtitles with null Cues list
* Caching: Cache data with unknown length by default. The previous flag to opt in * Caching: Cache data with unknown length by default. The previous flag to opt
to this behavior (`DataSpec.FLAG_ALLOW_CACHING_UNKNOWN_LENGTH`) has been in to this behavior (`DataSpec.FLAG_ALLOW_CACHING_UNKNOWN_LENGTH`) has been
replaced with an opt out flag (`DataSpec.FLAG_DONT_CACHE_IF_LENGTH_UNKNOWN`). replaced with an opt out flag (`DataSpec.FLAG_DONT_CACHE_IF_LENGTH_UNKNOWN`).
* Disable post processing on Nvidia devices, as it breaks decode-only frame
skippping.
### 2.9.2 ### ### 2.9.2 ###
......
...@@ -98,7 +98,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -98,7 +98,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
private final EventDispatcher eventDispatcher; private final EventDispatcher eventDispatcher;
private final long allowedJoiningTimeMs; private final long allowedJoiningTimeMs;
private final int maxDroppedFramesToNotify; private final int maxDroppedFramesToNotify;
private final boolean deviceNeedsAutoFrcWorkaround; private final boolean deviceNeedsNoPostProcessWorkaround;
private final long[] pendingOutputStreamOffsetsUs; private final long[] pendingOutputStreamOffsetsUs;
private final long[] pendingOutputStreamSwitchTimesUs; private final long[] pendingOutputStreamSwitchTimesUs;
...@@ -226,7 +226,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -226,7 +226,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
this.context = context.getApplicationContext(); this.context = context.getApplicationContext();
frameReleaseTimeHelper = new VideoFrameReleaseTimeHelper(this.context); frameReleaseTimeHelper = new VideoFrameReleaseTimeHelper(this.context);
eventDispatcher = new EventDispatcher(eventHandler, eventListener); eventDispatcher = new EventDispatcher(eventHandler, eventListener);
deviceNeedsAutoFrcWorkaround = deviceNeedsAutoFrcWorkaround(); deviceNeedsNoPostProcessWorkaround = deviceNeedsNoPostProcessWorkaround();
pendingOutputStreamOffsetsUs = new long[MAX_PENDING_OUTPUT_STREAM_OFFSET_COUNT]; pendingOutputStreamOffsetsUs = new long[MAX_PENDING_OUTPUT_STREAM_OFFSET_COUNT];
pendingOutputStreamSwitchTimesUs = new long[MAX_PENDING_OUTPUT_STREAM_OFFSET_COUNT]; pendingOutputStreamSwitchTimesUs = new long[MAX_PENDING_OUTPUT_STREAM_OFFSET_COUNT];
outputStreamOffsetUs = C.TIME_UNSET; outputStreamOffsetUs = C.TIME_UNSET;
...@@ -484,7 +484,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -484,7 +484,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
format, format,
codecMaxValues, codecMaxValues,
codecOperatingRate, codecOperatingRate,
deviceNeedsAutoFrcWorkaround, deviceNeedsNoPostProcessWorkaround,
tunnelingAudioSessionId); tunnelingAudioSessionId);
if (surface == null) { if (surface == null) {
Assertions.checkState(shouldUseDummySurface(codecInfo)); Assertions.checkState(shouldUseDummySurface(codecInfo));
...@@ -1036,8 +1036,8 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -1036,8 +1036,8 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
* @param codecMaxValues Codec max values that should be used when configuring the decoder. * @param codecMaxValues Codec max values that should be used when configuring the decoder.
* @param codecOperatingRate The codec operating rate, or {@link #CODEC_OPERATING_RATE_UNSET} if * @param codecOperatingRate The codec operating rate, or {@link #CODEC_OPERATING_RATE_UNSET} if
* no codec operating rate should be set. * no codec operating rate should be set.
* @param deviceNeedsAutoFrcWorkaround Whether the device is known to enable frame-rate conversion * @param deviceNeedsNoPostProcessWorkaround Whether the device is known to do post processing by
* logic that negatively impacts ExoPlayer. * default that isn't compatible with ExoPlayer.
* @param tunnelingAudioSessionId The audio session id to use for tunneling, or {@link * @param tunnelingAudioSessionId The audio session id to use for tunneling, or {@link
* C#AUDIO_SESSION_ID_UNSET} if tunneling should not be enabled. * C#AUDIO_SESSION_ID_UNSET} if tunneling should not be enabled.
* @return The framework {@link MediaFormat} that should be used to configure the decoder. * @return The framework {@link MediaFormat} that should be used to configure the decoder.
...@@ -1047,7 +1047,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -1047,7 +1047,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
Format format, Format format,
CodecMaxValues codecMaxValues, CodecMaxValues codecMaxValues,
float codecOperatingRate, float codecOperatingRate,
boolean deviceNeedsAutoFrcWorkaround, boolean deviceNeedsNoPostProcessWorkaround,
int tunnelingAudioSessionId) { int tunnelingAudioSessionId) {
MediaFormat mediaFormat = new MediaFormat(); MediaFormat mediaFormat = new MediaFormat();
// Set format parameters that should always be set. // Set format parameters that should always be set.
...@@ -1071,7 +1071,8 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -1071,7 +1071,8 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
mediaFormat.setFloat(MediaFormat.KEY_OPERATING_RATE, codecOperatingRate); mediaFormat.setFloat(MediaFormat.KEY_OPERATING_RATE, codecOperatingRate);
} }
} }
if (deviceNeedsAutoFrcWorkaround) { if (deviceNeedsNoPostProcessWorkaround) {
mediaFormat.setInteger("no-post-process", 1);
mediaFormat.setInteger("auto-frc", 0); mediaFormat.setInteger("auto-frc", 0);
} }
if (tunnelingAudioSessionId != C.AUDIO_SESSION_ID_UNSET) { if (tunnelingAudioSessionId != C.AUDIO_SESSION_ID_UNSET) {
...@@ -1265,21 +1266,21 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -1265,21 +1266,21 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
} }
/** /**
* Returns whether the device is known to enable frame-rate conversion logic that negatively * Returns whether the device is known to do post processing by default that isn't compatible with
* impacts ExoPlayer. * ExoPlayer.
* <p>
* If true is returned then we explicitly disable the feature.
* *
* @return True if the device is known to enable frame-rate conversion logic that negatively * @return Whether the device is known to do post processing by default that isn't compatible with
* impacts ExoPlayer. False otherwise. * ExoPlayer.
*/ */
private static boolean deviceNeedsAutoFrcWorkaround() { private static boolean deviceNeedsNoPostProcessWorkaround() {
// nVidia Shield prior to M tries to adjust the playback rate to better map the frame-rate of // Nvidia devices prior to M try to adjust the playback rate to better map the frame-rate of
// content to the refresh rate of the display. For example playback of 23.976fps content is // content to the refresh rate of the display. For example playback of 23.976fps content is
// adjusted to play at 1.001x speed when the output display is 60Hz. Unfortunately the // adjusted to play at 1.001x speed when the output display is 60Hz. Unfortunately the
// implementation causes ExoPlayer's reported playback position to drift out of sync. Captions // implementation causes ExoPlayer's reported playback position to drift out of sync. Captions
// also lose sync [Internal: b/26453592]. // also lose sync [Internal: b/26453592]. Even after M, the devices may apply post processing
return Util.SDK_INT <= 22 && "foster".equals(Util.DEVICE) && "NVIDIA".equals(Util.MANUFACTURER); // operations that can modify frame output timestamps, which is incompatible with ExoPlayer's
// logic for skipping decode-only frames.
return "NVIDIA".equals(Util.MANUFACTURER);
} }
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment