From 89f66924d514732ffa74689d22c97b0fe3c16a38 Mon Sep 17 00:00:00 2001 From: olly Date: Tue, 19 Sep 2017 09:48:28 -0700 Subject: [PATCH] Use IntDef for MediaCodecRenderer internal states ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=169254794 --- .../exoplayer2/mediacodec/MediaCodecRenderer.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java index d6725e373a..761b23fe58 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java @@ -23,6 +23,7 @@ import android.media.MediaCrypto; import android.media.MediaFormat; import android.os.Looper; import android.os.SystemClock; +import android.support.annotation.IntDef; import android.support.annotation.Nullable; import android.util.Log; import com.google.android.exoplayer2.BaseRenderer; @@ -42,6 +43,8 @@ import com.google.android.exoplayer2.util.Assertions; import com.google.android.exoplayer2.util.NalUnitUtil; import com.google.android.exoplayer2.util.TraceUtil; import com.google.android.exoplayer2.util.Util; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; @@ -126,6 +129,10 @@ public abstract class MediaCodecRenderer extends BaseRenderer { */ private static final long MAX_CODEC_HOTSWAP_TIME_MS = 1000; + @Retention(RetentionPolicy.SOURCE) + @IntDef({RECONFIGURATION_STATE_NONE, RECONFIGURATION_STATE_WRITE_PENDING, + RECONFIGURATION_STATE_QUEUE_PENDING}) + private @interface ReconfigurationState {} /** * There is no pending adaptive reconfiguration work. */ @@ -140,6 +147,10 @@ public abstract class MediaCodecRenderer extends BaseRenderer { */ private static final int RECONFIGURATION_STATE_QUEUE_PENDING = 2; + @Retention(RetentionPolicy.SOURCE) + @IntDef({REINITIALIZATION_STATE_NONE, REINITIALIZATION_STATE_SIGNAL_END_OF_STREAM, + REINITIALIZATION_STATE_WAIT_END_OF_STREAM}) + private @interface ReinitializationState {} /** * The codec does not need to be re-initialized. */ @@ -198,8 +209,8 @@ public abstract class MediaCodecRenderer extends BaseRenderer { private int outputIndex; private boolean shouldSkipOutputBuffer; private boolean codecReconfigured; - private int codecReconfigurationState; - private int codecReinitializationState; + private @ReconfigurationState int codecReconfigurationState; + private @ReinitializationState int codecReinitializationState; private boolean codecReceivedBuffers; private boolean codecReceivedEos;