From 5a5c3ce3bd4a6b906e8ddc6cbdbfcf2d7f4ee71f Mon Sep 17 00:00:00 2001 From: ibaker Date: Tue, 23 May 2023 16:42:28 +0100 Subject: [PATCH] Remove four deprecated AnalyticsListener decoder methods Use the audio or video specific variants instead. #minor-release PiperOrigin-RevId: 534436644 --- RELEASENOTES.md | 12 ++ .../analytics/AnalyticsListener.java | 33 ---- .../analytics/DefaultAnalyticsCollector.java | 14 -- .../DefaultAnalyticsCollectorTest.java | 147 ------------------ 4 files changed, 12 insertions(+), 194 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index d093fea8aa..69c02c5536 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -98,6 +98,18 @@ * Remove deprecated `OfflineLicenseHelper` constructor, use `OfflineLicenseHelper(DefaultDrmSessionManager, DrmSessionEventListener.EventDispatcher)` instead. + * Remove four deprecated `AnalyticsListener` methods: + * `onDecoderEnabled`, use `onAudioEnabled` and/or `onVideoEnabled` + instead. + * `onDecoderInitialized`, use `onAudioDecoderInitialized` and/or + `onVideoDecoderInitialized` instead. + * `onDecoderInputFormatChanged`, use `onAudioInputFormatChanged` + and/or `onVideoInputFormatChanged` instead. + * `onDecoderDisabled`, use `onAudioDisabled` and/or `onVideoDisabled` + instead. +* Core library: + * Add `ExoPlayer.setVideoFrameProcessorFactory()` for using `Effect` with + a custom `VideoFrameProcessor.Factory` during video playback. * Remove `ExoPlayer.setHandleWakeLock(boolean)`, use `setWakeMode(int)` instead. * Remove deprecated diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/AnalyticsListener.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/AnalyticsListener.java index 454588936a..656afd02ce 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/AnalyticsListener.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/AnalyticsListener.java @@ -899,39 +899,6 @@ public interface AnalyticsListener { @UnstableApi default void onCues(EventTime eventTime, CueGroup cueGroup) {} - /** - * @deprecated Use {@link #onAudioEnabled} and {@link #onVideoEnabled} instead. - */ - @Deprecated - @UnstableApi - default void onDecoderEnabled( - EventTime eventTime, int trackType, DecoderCounters decoderCounters) {} - - /** - * @deprecated Use {@link #onAudioDecoderInitialized} and {@link #onVideoDecoderInitialized} - * instead. - */ - @UnstableApi - @Deprecated - default void onDecoderInitialized( - EventTime eventTime, int trackType, String decoderName, long initializationDurationMs) {} - - /** - * @deprecated Use {@link #onAudioInputFormatChanged(EventTime, Format, DecoderReuseEvaluation)} - * and {@link #onVideoInputFormatChanged(EventTime, Format, DecoderReuseEvaluation)}. instead. - */ - @UnstableApi - @Deprecated - default void onDecoderInputFormatChanged(EventTime eventTime, int trackType, Format format) {} - - /** - * @deprecated Use {@link #onAudioDisabled} and {@link #onVideoDisabled} instead. - */ - @UnstableApi - @Deprecated - default void onDecoderDisabled( - EventTime eventTime, int trackType, DecoderCounters decoderCounters) {} - /** * Called when an audio renderer is enabled. * diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector.java index 5044d8fa56..6721366ee2 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector.java @@ -165,7 +165,6 @@ public class DefaultAnalyticsCollector implements AnalyticsCollector { // Audio events. - @SuppressWarnings("deprecation") // Calling deprecated listener method. @Override public final void onAudioEnabled(DecoderCounters counters) { EventTime eventTime = generateReadingMediaPeriodEventTime(); @@ -174,7 +173,6 @@ public class DefaultAnalyticsCollector implements AnalyticsCollector { AnalyticsListener.EVENT_AUDIO_ENABLED, listener -> { listener.onAudioEnabled(eventTime, counters); - listener.onDecoderEnabled(eventTime, C.TRACK_TYPE_AUDIO, counters); }); } @@ -190,8 +188,6 @@ public class DefaultAnalyticsCollector implements AnalyticsCollector { listener.onAudioDecoderInitialized(eventTime, decoderName, initializationDurationMs); listener.onAudioDecoderInitialized( eventTime, decoderName, initializedTimestampMs, initializationDurationMs); - listener.onDecoderInitialized( - eventTime, C.TRACK_TYPE_AUDIO, decoderName, initializationDurationMs); }); } @@ -206,7 +202,6 @@ public class DefaultAnalyticsCollector implements AnalyticsCollector { listener -> { listener.onAudioInputFormatChanged(eventTime, format); listener.onAudioInputFormatChanged(eventTime, format, decoderReuseEvaluation); - listener.onDecoderInputFormatChanged(eventTime, C.TRACK_TYPE_AUDIO, format); }); } @@ -240,7 +235,6 @@ public class DefaultAnalyticsCollector implements AnalyticsCollector { } @Override - @SuppressWarnings("deprecation") // Calling deprecated listener method. public final void onAudioDisabled(DecoderCounters counters) { EventTime eventTime = generatePlayingMediaPeriodEventTime(); sendEvent( @@ -248,7 +242,6 @@ public class DefaultAnalyticsCollector implements AnalyticsCollector { AnalyticsListener.EVENT_AUDIO_DISABLED, listener -> { listener.onAudioDisabled(eventTime, counters); - listener.onDecoderDisabled(eventTime, C.TRACK_TYPE_AUDIO, counters); }); } @@ -282,7 +275,6 @@ public class DefaultAnalyticsCollector implements AnalyticsCollector { // Video events. @Override - @SuppressWarnings("deprecation") // Calling deprecated listener method. public final void onVideoEnabled(DecoderCounters counters) { EventTime eventTime = generateReadingMediaPeriodEventTime(); sendEvent( @@ -290,7 +282,6 @@ public class DefaultAnalyticsCollector implements AnalyticsCollector { AnalyticsListener.EVENT_VIDEO_ENABLED, listener -> { listener.onVideoEnabled(eventTime, counters); - listener.onDecoderEnabled(eventTime, C.TRACK_TYPE_VIDEO, counters); }); } @@ -306,8 +297,6 @@ public class DefaultAnalyticsCollector implements AnalyticsCollector { listener.onVideoDecoderInitialized(eventTime, decoderName, initializationDurationMs); listener.onVideoDecoderInitialized( eventTime, decoderName, initializedTimestampMs, initializationDurationMs); - listener.onDecoderInitialized( - eventTime, C.TRACK_TYPE_VIDEO, decoderName, initializationDurationMs); }); } @@ -322,7 +311,6 @@ public class DefaultAnalyticsCollector implements AnalyticsCollector { listener -> { listener.onVideoInputFormatChanged(eventTime, format); listener.onVideoInputFormatChanged(eventTime, format, decoderReuseEvaluation); - listener.onDecoderInputFormatChanged(eventTime, C.TRACK_TYPE_VIDEO, format); }); } @@ -345,7 +333,6 @@ public class DefaultAnalyticsCollector implements AnalyticsCollector { } @Override - @SuppressWarnings("deprecation") // Calling deprecated listener method. public final void onVideoDisabled(DecoderCounters counters) { EventTime eventTime = generatePlayingMediaPeriodEventTime(); sendEvent( @@ -353,7 +340,6 @@ public class DefaultAnalyticsCollector implements AnalyticsCollector { AnalyticsListener.EVENT_VIDEO_DISABLED, listener -> { listener.onVideoDisabled(eventTime, counters); - listener.onDecoderDisabled(eventTime, C.TRACK_TYPE_VIDEO, counters); }); } diff --git a/libraries/exoplayer/src/test/java/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollectorTest.java b/libraries/exoplayer/src/test/java/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollectorTest.java index eb5daa2d0a..68950d008e 100644 --- a/libraries/exoplayer/src/test/java/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollectorTest.java +++ b/libraries/exoplayer/src/test/java/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollectorTest.java @@ -148,10 +148,6 @@ public final class DefaultAnalyticsCollectorTest { private static final long EVENT_PLAYER_STATE_CHANGED = 1L << 63; private static final long EVENT_SEEK_STARTED = 1L << 62; private static final long EVENT_SEEK_PROCESSED = 1L << 61; - private static final long EVENT_DECODER_ENABLED = 1L << 60; - private static final long EVENT_DECODER_INIT = 1L << 59; - private static final long EVENT_DECODER_FORMAT_CHANGED = 1L << 58; - private static final long EVENT_DECODER_DISABLED = 1L << 57; private static final UUID DRM_SCHEME_UUID = UUID.nameUUIDFromBytes(TestUtil.createByteArray(7, 8, 9)); @@ -274,15 +270,6 @@ public final class DefaultAnalyticsCollectorTest { assertThat(listener.getEvents(EVENT_DOWNSTREAM_FORMAT_CHANGED)) .containsExactly(period0 /* audio */, period0 /* video */) .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_ENABLED)) - .containsExactly(period0 /* audio */, period0 /* video */) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_INIT)) - .containsExactly(period0 /* audio */, period0 /* video */) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_FORMAT_CHANGED)) - .containsExactly(period0 /* audio */, period0 /* video */) - .inOrder(); assertThat(listener.getEvents(EVENT_AUDIO_ENABLED)).containsExactly(period0); assertThat(listener.getEvents(EVENT_AUDIO_DECODER_INITIALIZED)).containsExactly(period0); assertThat(listener.getEvents(EVENT_AUDIO_INPUT_FORMAT_CHANGED)).containsExactly(period0); @@ -354,17 +341,6 @@ public final class DefaultAnalyticsCollectorTest { .containsExactly( period0 /* audio */, period0 /* video */, period1 /* audio */, period1 /* video */) .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_ENABLED)) - .containsExactly(period0 /* audio */, period0 /* video */) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_INIT)) - .containsExactly( - period0 /* audio */, period0 /* video */, period1 /* audio */, period1 /* video */) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_FORMAT_CHANGED)) - .containsExactly( - period0 /* audio */, period0 /* video */, period1 /* audio */, period1 /* video */) - .inOrder(); assertThat(listener.getEvents(EVENT_AUDIO_ENABLED)).containsExactly(period0); assertThat(listener.getEvents(EVENT_AUDIO_DECODER_INITIALIZED)) .containsExactly(period0, period1) @@ -439,16 +415,6 @@ public final class DefaultAnalyticsCollectorTest { assertThat(listener.getEvents(EVENT_DOWNSTREAM_FORMAT_CHANGED)) .containsExactly(period0 /* video */, period1 /* audio */) .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_ENABLED)) - .containsExactly(period0 /* video */, period1 /* audio */) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_INIT)) - .containsExactly(period0 /* video */, period1 /* audio */) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_FORMAT_CHANGED)) - .containsExactly(period0 /* video */, period1 /* audio */) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_DISABLED)).containsExactly(period0 /* video */); assertThat(listener.getEvents(EVENT_AUDIO_ENABLED)).containsExactly(period1); assertThat(listener.getEvents(EVENT_AUDIO_DECODER_INITIALIZED)).containsExactly(period1); assertThat(listener.getEvents(EVENT_AUDIO_INPUT_FORMAT_CHANGED)).containsExactly(period1); @@ -529,18 +495,6 @@ public final class DefaultAnalyticsCollectorTest { assertThat(listener.getEvents(EVENT_DOWNSTREAM_FORMAT_CHANGED)) .containsExactly(period0 /* video */, period0 /* audio */, period1 /* audio */) .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_ENABLED)) - .containsExactly(period0 /* video */, period0 /* audio */, period1 /* audio */) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_INIT)) - .containsExactly(period0 /* video */, period0 /* audio */, period1 /* audio */) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_FORMAT_CHANGED)) - .containsExactly(period0 /* video */, period0 /* audio */, period1 /* audio */) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_DISABLED)) - .containsExactly(period0 /* video */, period0 /* audio */) - .inOrder(); assertThat(listener.getEvents(EVENT_AUDIO_ENABLED)).containsExactly(period0, period1).inOrder(); assertThat(listener.getEvents(EVENT_AUDIO_DECODER_INITIALIZED)) .containsExactly(period0, period1) @@ -634,16 +588,6 @@ public final class DefaultAnalyticsCollectorTest { assertThat(listener.getEvents(EVENT_DOWNSTREAM_FORMAT_CHANGED)) .containsExactly(period0, period1Seq1, period1Seq1, period1Seq2, period1Seq2) .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_ENABLED)) - .containsExactly(period0, period1, period0, period1Seq2) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_INIT)) - .containsExactly(period0, period1Seq1, period1Seq1, period1Seq2, period1Seq2) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_FORMAT_CHANGED)) - .containsExactly(period0, period1Seq1, period1Seq1, period1Seq2, period1Seq2) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_DISABLED)).containsExactly(period0, period0); assertThat(listener.getEvents(EVENT_AUDIO_ENABLED)) .containsExactly(period1, period1Seq2) .inOrder(); @@ -753,16 +697,6 @@ public final class DefaultAnalyticsCollectorTest { assertThat(listener.getEvents(EVENT_DOWNSTREAM_FORMAT_CHANGED)) .containsExactly(period0Seq0, period0Seq1) .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_ENABLED)) - .containsExactly(period0Seq0, period0Seq1) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_INIT)) - .containsExactly(period0Seq0, period0Seq1) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_FORMAT_CHANGED)) - .containsExactly(period0Seq0, period0Seq1) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_DISABLED)).containsExactly(period0Seq0); assertThat(listener.getEvents(EVENT_VIDEO_ENABLED)) .containsExactly(period0Seq0, period0Seq1) .inOrder(); @@ -850,11 +784,6 @@ public final class DefaultAnalyticsCollectorTest { .inOrder(); assertThat(listener.getEvents(EVENT_DOWNSTREAM_FORMAT_CHANGED)) .containsExactly(period0Seq0, period0Seq0); - assertThat(listener.getEvents(EVENT_DECODER_ENABLED)).containsExactly(period0Seq0, period0Seq0); - assertThat(listener.getEvents(EVENT_DECODER_INIT)).containsExactly(period0Seq0, period0Seq0); - assertThat(listener.getEvents(EVENT_DECODER_FORMAT_CHANGED)) - .containsExactly(period0Seq0, period0Seq0); - assertThat(listener.getEvents(EVENT_DECODER_DISABLED)).containsExactly(period0Seq0); assertThat(listener.getEvents(EVENT_VIDEO_ENABLED)).containsExactly(period0Seq0, period0Seq0); assertThat(listener.getEvents(EVENT_VIDEO_DECODER_INITIALIZED)) .containsExactly(period0Seq0, period0Seq0); @@ -926,16 +855,6 @@ public final class DefaultAnalyticsCollectorTest { assertThat(listener.getEvents(EVENT_DOWNSTREAM_FORMAT_CHANGED)) .containsExactly(window0Period1Seq0, window1Period0Seq1) .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_ENABLED)) - .containsExactly(window0Period1Seq0, window0Period1Seq0) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_INIT)) - .containsExactly(window0Period1Seq0, window1Period0Seq1) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_FORMAT_CHANGED)) - .containsExactly(window0Period1Seq0, window1Period0Seq1) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_DISABLED)).containsExactly(window0Period1Seq0); assertThat(listener.getEvents(EVENT_VIDEO_ENABLED)) .containsExactly(window0Period1Seq0, window0Period1Seq0) .inOrder(); @@ -1028,16 +947,6 @@ public final class DefaultAnalyticsCollectorTest { assertThat(listener.getEvents(EVENT_DOWNSTREAM_FORMAT_CHANGED)) .containsExactly(period0Seq0, period1Seq1) .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_ENABLED)) - .containsExactly(period0Seq0, period0Seq1) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_INIT)) - .containsExactly(period0Seq0, period1Seq1) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_FORMAT_CHANGED)) - .containsExactly(period0Seq0, period1Seq1) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_DISABLED)).containsExactly(period0Seq0); assertThat(listener.getEvents(EVENT_VIDEO_ENABLED)) .containsExactly(period0Seq0, period0Seq1) .inOrder(); @@ -1257,25 +1166,6 @@ public final class DefaultAnalyticsCollectorTest { postrollAd, contentAfterPostroll) .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_ENABLED)).containsExactly(prerollAd); - assertThat(listener.getEvents(EVENT_DECODER_INIT)) - .containsExactly( - prerollAd, - contentAfterPreroll, - midrollAd, - contentAfterMidroll, - postrollAd, - contentAfterPostroll) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_FORMAT_CHANGED)) - .containsExactly( - prerollAd, - contentAfterPreroll, - midrollAd, - contentAfterMidroll, - postrollAd, - contentAfterPostroll) - .inOrder(); assertThat(listener.getEvents(EVENT_VIDEO_ENABLED)).containsExactly(prerollAd); assertThat(listener.getEvents(EVENT_VIDEO_DECODER_INITIALIZED)) .containsExactly( @@ -1428,16 +1318,6 @@ public final class DefaultAnalyticsCollectorTest { assertThat(listener.getEvents(EVENT_DOWNSTREAM_FORMAT_CHANGED)) .containsExactly(contentBeforeMidroll, midrollAd, contentAfterMidroll) .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_ENABLED)) - .containsExactly(contentBeforeMidroll, midrollAd) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_INIT)) - .containsExactly(contentBeforeMidroll, midrollAd, contentAfterMidroll) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_FORMAT_CHANGED)) - .containsExactly(contentBeforeMidroll, midrollAd, contentAfterMidroll) - .inOrder(); - assertThat(listener.getEvents(EVENT_DECODER_DISABLED)).containsExactly(contentBeforeMidroll); assertThat(listener.getEvents(EVENT_VIDEO_ENABLED)) .containsExactly(contentBeforeMidroll, midrollAd) .inOrder(); @@ -2335,33 +2215,6 @@ public final class DefaultAnalyticsCollectorTest { reportedEvents.add(new ReportedEvent(EVENT_METADATA, eventTime)); } - @SuppressWarnings("deprecation") - @Override - public void onDecoderEnabled( - EventTime eventTime, int trackType, DecoderCounters decoderCounters) { - reportedEvents.add(new ReportedEvent(EVENT_DECODER_ENABLED, eventTime)); - } - - @SuppressWarnings("deprecation") - @Override - public void onDecoderInitialized( - EventTime eventTime, int trackType, String decoderName, long initializationDurationMs) { - reportedEvents.add(new ReportedEvent(EVENT_DECODER_INIT, eventTime)); - } - - @SuppressWarnings("deprecation") - @Override - public void onDecoderInputFormatChanged(EventTime eventTime, int trackType, Format format) { - reportedEvents.add(new ReportedEvent(EVENT_DECODER_FORMAT_CHANGED, eventTime)); - } - - @SuppressWarnings("deprecation") - @Override - public void onDecoderDisabled( - EventTime eventTime, int trackType, DecoderCounters decoderCounters) { - reportedEvents.add(new ReportedEvent(EVENT_DECODER_DISABLED, eventTime)); - } - @Override public void onAudioEnabled(EventTime eventTime, DecoderCounters decoderCounters) { reportedEvents.add(new ReportedEvent(EVENT_AUDIO_ENABLED, eventTime));