Remove copybara exclusions and add extension to the demo app

Issue: #3353
PiperOrigin-RevId: 273949689
This commit is contained in:
sofijajvc 2019-10-10 14:41:14 +01:00 committed by Ian Baker
parent 60566721d4
commit 62618f24ec
7 changed files with 43 additions and 4 deletions

View File

@ -2,6 +2,9 @@
### dev-v2 (not yet released) ###
* AV1 extension: Uses libgav1 to decode AV1 videos. Android 10 includes an AV1
decoder, but the older versions of Android require this extension for playback
of AV1 streams ([#3353](https://github.com/google/ExoPlayer/issues/3353)).
* UI
* Setting `app:played_color` on `PlayerView` and `PlayerControlView` no longer
adjusts the colors of the scrubber handle , buffered and unplayed parts of

View File

@ -24,6 +24,7 @@ include modulePrefix + 'library-hls'
include modulePrefix + 'library-smoothstreaming'
include modulePrefix + 'library-ui'
include modulePrefix + 'testutils'
include modulePrefix + 'extension-av1'
include modulePrefix + 'extension-ffmpeg'
include modulePrefix + 'extension-flac'
include modulePrefix + 'extension-gvr'
@ -46,6 +47,7 @@ project(modulePrefix + 'library-hls').projectDir = new File(rootDir, 'library/hl
project(modulePrefix + 'library-smoothstreaming').projectDir = new File(rootDir, 'library/smoothstreaming')
project(modulePrefix + 'library-ui').projectDir = new File(rootDir, 'library/ui')
project(modulePrefix + 'testutils').projectDir = new File(rootDir, 'testutils')
project(modulePrefix + 'extension-av1').projectDir = new File(rootDir, 'extensions/av1')
project(modulePrefix + 'extension-ffmpeg').projectDir = new File(rootDir, 'extensions/ffmpeg')
project(modulePrefix + 'extension-flac').projectDir = new File(rootDir, 'extensions/flac')
project(modulePrefix + 'extension-gvr').projectDir = new File(rootDir, 'extensions/gvr')

View File

@ -69,6 +69,7 @@ dependencies {
implementation project(modulePrefix + 'library-hls')
implementation project(modulePrefix + 'library-smoothstreaming')
implementation project(modulePrefix + 'library-ui')
withExtensionsImplementation project(path: modulePrefix + 'extension-av1')
withExtensionsImplementation project(path: modulePrefix + 'extension-ffmpeg')
withExtensionsImplementation project(path: modulePrefix + 'extension-flac')
withExtensionsImplementation project(path: modulePrefix + 'extension-ima')

View File

@ -5,7 +5,3 @@
native <methods>;
}
# Some members of this class are being accessed from native methods. Keep them unobfuscated.
-keep class com.google.android.exoplayer2.ext.av1.Gav1OutputBuffer {
*;
}

View File

@ -521,6 +521,7 @@ public final class C {
/** Indicates that a buffer should be decoded but not rendered. */
public static final int BUFFER_FLAG_DECODE_ONLY = 1 << 31; // 0x80000000
// LINT.IfChange
/**
* Video decoder output modes. Possible modes are {@link #VIDEO_OUTPUT_MODE_NONE}, {@link
* #VIDEO_OUTPUT_MODE_YUV} and {@link #VIDEO_OUTPUT_MODE_SURFACE_YUV}.
@ -535,6 +536,10 @@ public final class C {
public static final int VIDEO_OUTPUT_MODE_YUV = 0;
/** Video decoder output mode that renders 4:2:0 YUV planes directly to a surface. */
public static final int VIDEO_OUTPUT_MODE_SURFACE_YUV = 1;
// LINT.ThenChange(
// ../../../../../../../../../extensions/av1/src/main/jni/gav1_jni.cc,
// ../../../../../../../../../extensions/vp9/src/main/jni/vpx_jni.cc
// )
/**
* Video scaling modes for {@link MediaCodec}-based {@link Renderer}s. One of {@link

View File

@ -365,6 +365,33 @@ public class DefaultRenderersFactory implements RenderersFactory {
// The extension is present, but instantiation failed.
throw new RuntimeException("Error instantiating VP9 extension", e);
}
try {
// Full class names used for constructor args so the LINT rule triggers if any of them move.
// LINT.IfChange
Class<?> clazz = Class.forName("com.google.android.exoplayer2.ext.av1.Libgav1VideoRenderer");
Constructor<?> constructor =
clazz.getConstructor(
long.class,
android.os.Handler.class,
com.google.android.exoplayer2.video.VideoRendererEventListener.class,
int.class);
// LINT.ThenChange(../../../../../../../proguard-rules.txt)
Renderer renderer =
(Renderer)
constructor.newInstance(
allowedVideoJoiningTimeMs,
eventHandler,
eventListener,
MAX_DROPPED_VIDEO_FRAME_COUNT_TO_NOTIFY);
out.add(extensionRendererIndex++, renderer);
Log.i(TAG, "Loaded Libgav1VideoRenderer.");
} catch (ClassNotFoundException e) {
// Expected if the app was built without the extension.
} catch (Exception e) {
// The extension is present, but instantiation failed.
throw new RuntimeException("Error instantiating AV1 extension", e);
}
}
/**

View File

@ -34,10 +34,15 @@ public class VideoDecoderOutputBuffer extends OutputBuffer {
void releaseOutputBuffer(VideoDecoderOutputBuffer outputBuffer);
}
// LINT.IfChange
public static final int COLORSPACE_UNKNOWN = 0;
public static final int COLORSPACE_BT601 = 1;
public static final int COLORSPACE_BT709 = 2;
public static final int COLORSPACE_BT2020 = 3;
// LINT.ThenChange(
// ../../../../../../../../../../extensions/av1/src/main/jni/gav1_jni.cc,
// ../../../../../../../../../../extensions/vp9/src/main/jni/vpx_jni.cc
// )
/** Decoder private data. */
public int decoderPrivate;