Commit 34975a7a by andrewlewis Committed by tonihei

Increase transformer min API version to 21

This will remove the need to implement compat code handling very old API
versions where some symbols are not available, and it reduces the burden of
dealing with media framework issues around concurrent codec usage that are
worse on older API versions. Top apps that we've surveyed as potential users
for transformer library features are using API 21 or later.

PiperOrigin-RevId: 413341540
parent 0fdbff43
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
([#2882](https://github.com/google/ExoPlayer/issues/2882)). ([#2882](https://github.com/google/ExoPlayer/issues/2882)).
* Correctly populate `Format.label` for audio only HLS streams * Correctly populate `Format.label` for audio only HLS streams
([#9608](https://github.com/google/ExoPlayer/issues/9608)). ([#9608](https://github.com/google/ExoPlayer/issues/9608)).
* Transformer: increase required min API version to 21.
* MediaSession extension * MediaSession extension
* Remove deprecated call to `onStop(/* reset= */ true)` and provide an * Remove deprecated call to `onStop(/* reset= */ true)` and provide an
opt-out flag for apps that don't want to clear the playlist on stop. opt-out flag for apps that don't want to clear the playlist on stop.
......
...@@ -15,6 +15,7 @@ apply from: "$gradle.ext.exoplayerSettingsDir/common_library_config.gradle" ...@@ -15,6 +15,7 @@ apply from: "$gradle.ext.exoplayerSettingsDir/common_library_config.gradle"
android { android {
defaultConfig { defaultConfig {
minSdkVersion 21
// The following argument makes the Android Test Orchestrator run its // The following argument makes the Android Test Orchestrator run its
// "pm clear" command after each test invocation. This command ensures // "pm clear" command after each test invocation. This command ensures
// that the app's state is completely cleared between tests. // that the app's state is completely cleared between tests.
......
...@@ -23,7 +23,6 @@ import static java.lang.Math.min; ...@@ -23,7 +23,6 @@ import static java.lang.Math.min;
import android.media.MediaCodec.BufferInfo; import android.media.MediaCodec.BufferInfo;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
...@@ -41,7 +40,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -41,7 +40,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
/** /**
* Pipeline to decode audio samples, apply transformations on the raw samples, and re-encode them. * Pipeline to decode audio samples, apply transformations on the raw samples, and re-encode them.
*/ */
@RequiresApi(18)
/* package */ final class AudioSamplePipeline implements SamplePipeline { /* package */ final class AudioSamplePipeline implements SamplePipeline {
private static final String TAG = "AudioSamplePipeline"; private static final String TAG = "AudioSamplePipeline";
......
...@@ -24,7 +24,6 @@ import android.opengl.EGLExt; ...@@ -24,7 +24,6 @@ import android.opengl.EGLExt;
import android.opengl.EGLSurface; import android.opengl.EGLSurface;
import android.opengl.GLES20; import android.opengl.GLES20;
import android.view.Surface; import android.view.Surface;
import androidx.annotation.RequiresApi;
import com.google.android.exoplayer2.util.GlUtil; import com.google.android.exoplayer2.util.GlUtil;
import java.io.IOException; import java.io.IOException;
...@@ -32,7 +31,6 @@ import java.io.IOException; ...@@ -32,7 +31,6 @@ import java.io.IOException;
* FrameEditor applies changes to individual video frames. Changes include just resolution for now, * FrameEditor applies changes to individual video frames. Changes include just resolution for now,
* but may later include brightness, cropping, rotation, etc. * but may later include brightness, cropping, rotation, etc.
*/ */
@RequiresApi(18)
/* package */ final class FrameEditor { /* package */ final class FrameEditor {
static { static {
......
...@@ -36,7 +36,6 @@ import java.lang.reflect.Field; ...@@ -36,7 +36,6 @@ import java.lang.reflect.Field;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
/** Muxer implementation that uses a {@link MediaMuxer}. */ /** Muxer implementation that uses a {@link MediaMuxer}. */
@RequiresApi(18)
/* package */ final class FrameworkMuxer implements Muxer { /* package */ final class FrameworkMuxer implements Muxer {
public static final class Factory implements Muxer.Factory { public static final class Factory implements Muxer.Factory {
......
...@@ -26,7 +26,6 @@ import android.media.MediaCodecInfo.CodecCapabilities; ...@@ -26,7 +26,6 @@ import android.media.MediaCodecInfo.CodecCapabilities;
import android.media.MediaFormat; import android.media.MediaFormat;
import android.view.Surface; import android.view.Surface;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.decoder.DecoderInputBuffer; import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
...@@ -50,7 +49,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -50,7 +49,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* through {@link MediaCodecAdapter}. This is done by simplifying the calls needed to queue and * through {@link MediaCodecAdapter}. This is done by simplifying the calls needed to queue and
* dequeue buffers, removing the need to track buffer indices and codec events. * dequeue buffers, removing the need to track buffer indices and codec events.
*/ */
@RequiresApi(18)
/* package */ final class MediaCodecAdapterWrapper { /* package */ final class MediaCodecAdapterWrapper {
// MediaCodec decoders always output 16 bit PCM, unless configured to output PCM float. // MediaCodec decoders always output 16 bit PCM, unless configured to output PCM float.
...@@ -303,7 +301,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -303,7 +301,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
inputBuffer.data = null; inputBuffer.data = null;
} }
@RequiresApi(18)
public void signalEndOfInputStream() { public void signalEndOfInputStream() {
codec.signalEndOfInputStream(); codec.signalEndOfInputStream();
} }
......
...@@ -22,7 +22,6 @@ import static com.google.android.exoplayer2.util.Util.minValue; ...@@ -22,7 +22,6 @@ import static com.google.android.exoplayer2.util.Util.minValue;
import android.util.SparseIntArray; import android.util.SparseIntArray;
import android.util.SparseLongArray; import android.util.SparseLongArray;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.util.MimeTypes; import com.google.android.exoplayer2.util.MimeTypes;
...@@ -34,7 +33,6 @@ import java.nio.ByteBuffer; ...@@ -34,7 +33,6 @@ import java.nio.ByteBuffer;
* *
* <p>This wrapper can contain at most one video track and one audio track. * <p>This wrapper can contain at most one video track and one audio track.
*/ */
@RequiresApi(18)
/* package */ final class MuxerWrapper { /* package */ final class MuxerWrapper {
/** /**
......
...@@ -79,7 +79,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -79,7 +79,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* of the application's main thread is used. In all cases the Looper of the thread from which the * of the application's main thread is used. In all cases the Looper of the thread from which the
* transformer must be accessed can be queried using {@link #getApplicationLooper()}. * transformer must be accessed can be queried using {@link #getApplicationLooper()}.
*/ */
@RequiresApi(18)
public final class Transformer { public final class Transformer {
static { static {
......
...@@ -20,7 +20,6 @@ import static com.google.android.exoplayer2.source.SampleStream.FLAG_REQUIRE_FOR ...@@ -20,7 +20,6 @@ import static com.google.android.exoplayer2.source.SampleStream.FLAG_REQUIRE_FOR
import static com.google.android.exoplayer2.util.Assertions.checkNotNull; import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
...@@ -30,7 +29,6 @@ import com.google.android.exoplayer2.metadata.Metadata; ...@@ -30,7 +29,6 @@ import com.google.android.exoplayer2.metadata.Metadata;
import com.google.android.exoplayer2.metadata.mp4.SlowMotionData; import com.google.android.exoplayer2.metadata.mp4.SlowMotionData;
import com.google.android.exoplayer2.source.SampleStream.ReadDataResult; import com.google.android.exoplayer2.source.SampleStream.ReadDataResult;
@RequiresApi(18)
/* package */ final class TransformerAudioRenderer extends TransformerBaseRenderer { /* package */ final class TransformerAudioRenderer extends TransformerBaseRenderer {
private static final String TAG = "TransformerAudioRenderer"; private static final String TAG = "TransformerAudioRenderer";
......
...@@ -19,7 +19,6 @@ package com.google.android.exoplayer2.transformer; ...@@ -19,7 +19,6 @@ package com.google.android.exoplayer2.transformer;
import static com.google.android.exoplayer2.util.Assertions.checkStateNotNull; import static com.google.android.exoplayer2.util.Assertions.checkStateNotNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.google.android.exoplayer2.BaseRenderer; import com.google.android.exoplayer2.BaseRenderer;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlaybackException;
...@@ -34,7 +33,6 @@ import org.checkerframework.checker.nullness.qual.EnsuresNonNullIf; ...@@ -34,7 +33,6 @@ import org.checkerframework.checker.nullness.qual.EnsuresNonNullIf;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.RequiresNonNull; import org.checkerframework.checker.nullness.qual.RequiresNonNull;
@RequiresApi(18)
/* package */ abstract class TransformerBaseRenderer extends BaseRenderer { /* package */ abstract class TransformerBaseRenderer extends BaseRenderer {
protected final MuxerWrapper muxerWrapper; protected final MuxerWrapper muxerWrapper;
......
...@@ -18,12 +18,10 @@ package com.google.android.exoplayer2.transformer; ...@@ -18,12 +18,10 @@ package com.google.android.exoplayer2.transformer;
import static com.google.android.exoplayer2.util.Util.minValue; import static com.google.android.exoplayer2.util.Util.minValue;
import android.util.SparseLongArray; import android.util.SparseLongArray;
import androidx.annotation.RequiresApi;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.util.MediaClock; import com.google.android.exoplayer2.util.MediaClock;
@RequiresApi(18)
/* package */ final class TransformerMediaClock implements MediaClock { /* package */ final class TransformerMediaClock implements MediaClock {
private final SparseLongArray trackTypeToTimeUs; private final SparseLongArray trackTypeToTimeUs;
......
...@@ -20,7 +20,6 @@ import static com.google.android.exoplayer2.source.SampleStream.FLAG_REQUIRE_FOR ...@@ -20,7 +20,6 @@ import static com.google.android.exoplayer2.source.SampleStream.FLAG_REQUIRE_FOR
import static com.google.android.exoplayer2.util.Assertions.checkNotNull; import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
import android.content.Context; import android.content.Context;
import androidx.annotation.RequiresApi;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
...@@ -31,7 +30,6 @@ import java.nio.ByteBuffer; ...@@ -31,7 +30,6 @@ import java.nio.ByteBuffer;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.RequiresNonNull; import org.checkerframework.checker.nullness.qual.RequiresNonNull;
@RequiresApi(18)
/* package */ final class TransformerVideoRenderer extends TransformerBaseRenderer { /* package */ final class TransformerVideoRenderer extends TransformerBaseRenderer {
private static final String TAG = "TransformerTranscodingVideoRenderer"; private static final String TAG = "TransformerTranscodingVideoRenderer";
......
...@@ -21,7 +21,6 @@ import static com.google.android.exoplayer2.util.Assertions.checkNotNull; ...@@ -21,7 +21,6 @@ import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
import android.content.Context; import android.content.Context;
import android.media.MediaCodec; import android.media.MediaCodec;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
...@@ -33,7 +32,6 @@ import java.io.IOException; ...@@ -33,7 +32,6 @@ import java.io.IOException;
/** /**
* Pipeline to decode video samples, apply transformations on the raw samples, and re-encode them. * Pipeline to decode video samples, apply transformations on the raw samples, and re-encode them.
*/ */
@RequiresApi(18)
/* package */ final class VideoSamplePipeline implements SamplePipeline { /* package */ final class VideoSamplePipeline implements SamplePipeline {
private static final String TAG = "VideoSamplePipeline"; private static final String TAG = "VideoSamplePipeline";
......
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