Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Unified Diff: media/base/android/java/src/org/chromium/media/MediaCodecBridge.java

Issue 2260913003: Disable automatic frame rate conversion for MediaCodec on nVidia shields (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: All android version Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
diff --git a/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java b/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
index 0c012de85d6262bebf419bea6da5cb0539ca488f..660c37f15c7b1809c2e0438b521e5960f2842f49 100644
--- a/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
+++ b/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
@@ -489,6 +489,7 @@ class MediaCodecBridge {
MediaFormat.KEY_MAX_HEIGHT, format.getInteger(MediaFormat.KEY_HEIGHT));
}
maybeSetMaxInputSize(format);
+ disableAutomaticFrameRateConversion(format);
mMediaCodec.configure(format, surface, crypto, flags);
return true;
} catch (IllegalArgumentException e) {
@@ -561,6 +562,19 @@ class MediaCodecBridge {
format.setInteger(MediaFormat.KEY_MAX_INPUT_SIZE, maxInputSize);
}
+ /** Disables automatic frame rate conversion logic if the device uses it. */
+ private void disableAutomaticFrameRateConversion(MediaFormat format) {
+ // MediaCodec on nVidia Shield tablets changes frame timestamps to adjust the playback rate
+ // to better map the frame rate of the 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. We have to disable it because we rely on the timestamps passing through
+ // MediaCodec unaltered. For more details see b/26453592 and the ExoPlayer code:
+ // https://github.com/google/ExoPlayer/blob/706c6908ec57005044f4b4a9f5b80266cad9eda3/library/src/main/java/com/google/android/exoplayer/MediaCodecTrackRenderer.java#L1169
+ if ("foster".equals(Build.MODEL) && "NVIDIA".equals(Build.MANUFACTURER)) {
+ format.setInteger("auto-frc", 0);
+ }
+ }
+
@CalledByNative
private static MediaFormat createVideoEncoderFormat(String mime, int width, int height,
int bitRate, int frameRate, int iFrameInterval, int colorFormat) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698