Remove deprecated format changed methods

Use the overloads with an additional `@Nullable DecoderReuseEvaluation`
parameter instead.

PiperOrigin-RevId: 637851937
This commit is contained in:
ibaker 2024-05-28 04:28:29 -07:00 committed by Copybara-Service
parent aadcbe332b
commit c87b7d86cc
6 changed files with 22 additions and 48 deletions

View File

@ -218,6 +218,11 @@
boolean)`. Use `MediaCodecInfo.canReuseCodec(Format, Format)` instead. boolean)`. Use `MediaCodecInfo.canReuseCodec(Format, Format)` instead.
* Remove `DrmSessionManager.DUMMY` and `getDummyDrmSessionManager()` * Remove `DrmSessionManager.DUMMY` and `getDummyDrmSessionManager()`
method. Use `DrmSessionManager.DRM_UNSUPPORTED` instead. method. Use `DrmSessionManager.DRM_UNSUPPORTED` instead.
* Remove `AnalyticsListener.onAudioInputFormatChanged(EventTime, Format)`,
`AnalyticsListener.onVideoInputFormatChanged(EventTime, Format)`,
`AudioRendererEventListener.onAudioInputFormatChanged(Format)`,
`VideoRendererEventListener.onVideoInputFormatChanged(Format)`. Use the
overloads that take a `DecoderReuseEvaluation` instead.
## 1.4 ## 1.4

View File

@ -996,13 +996,6 @@ public interface AnalyticsListener {
default void onAudioDecoderInitialized( default void onAudioDecoderInitialized(
EventTime eventTime, String decoderName, long initializationDurationMs) {} EventTime eventTime, String decoderName, long initializationDurationMs) {}
/**
* @deprecated Use {@link #onAudioInputFormatChanged(EventTime, Format, DecoderReuseEvaluation)}.
*/
@UnstableApi
@Deprecated
default void onAudioInputFormatChanged(EventTime eventTime, Format format) {}
/** /**
* Called when the format of the media being consumed by an audio renderer changes. * Called when the format of the media being consumed by an audio renderer changes.
* *
@ -1206,13 +1199,6 @@ public interface AnalyticsListener {
default void onVideoDecoderInitialized( default void onVideoDecoderInitialized(
EventTime eventTime, String decoderName, long initializationDurationMs) {} EventTime eventTime, String decoderName, long initializationDurationMs) {}
/**
* @deprecated Use {@link #onVideoInputFormatChanged(EventTime, Format, DecoderReuseEvaluation)}.
*/
@UnstableApi
@Deprecated
default void onVideoInputFormatChanged(EventTime eventTime, Format format) {}
/** /**
* Called when the format of the media being consumed by a video renderer changes. * Called when the format of the media being consumed by a video renderer changes.
* *

View File

@ -192,7 +192,6 @@ public class DefaultAnalyticsCollector implements AnalyticsCollector {
}); });
} }
@SuppressWarnings("deprecation") // Calling deprecated listener method.
@Override @Override
public final void onAudioInputFormatChanged( public final void onAudioInputFormatChanged(
Format format, @Nullable DecoderReuseEvaluation decoderReuseEvaluation) { Format format, @Nullable DecoderReuseEvaluation decoderReuseEvaluation) {
@ -200,10 +199,7 @@ public class DefaultAnalyticsCollector implements AnalyticsCollector {
sendEvent( sendEvent(
eventTime, eventTime,
AnalyticsListener.EVENT_AUDIO_INPUT_FORMAT_CHANGED, AnalyticsListener.EVENT_AUDIO_INPUT_FORMAT_CHANGED,
listener -> { listener -> listener.onAudioInputFormatChanged(eventTime, format, decoderReuseEvaluation));
listener.onAudioInputFormatChanged(eventTime, format);
listener.onAudioInputFormatChanged(eventTime, format, decoderReuseEvaluation);
});
} }
@Override @Override
@ -320,17 +316,13 @@ public class DefaultAnalyticsCollector implements AnalyticsCollector {
} }
@Override @Override
@SuppressWarnings("deprecation") // Calling deprecated listener method.
public final void onVideoInputFormatChanged( public final void onVideoInputFormatChanged(
Format format, @Nullable DecoderReuseEvaluation decoderReuseEvaluation) { Format format, @Nullable DecoderReuseEvaluation decoderReuseEvaluation) {
EventTime eventTime = generateReadingMediaPeriodEventTime(); EventTime eventTime = generateReadingMediaPeriodEventTime();
sendEvent( sendEvent(
eventTime, eventTime,
AnalyticsListener.EVENT_VIDEO_INPUT_FORMAT_CHANGED, AnalyticsListener.EVENT_VIDEO_INPUT_FORMAT_CHANGED,
listener -> { listener -> listener.onVideoInputFormatChanged(eventTime, format, decoderReuseEvaluation));
listener.onVideoInputFormatChanged(eventTime, format);
listener.onVideoInputFormatChanged(eventTime, format, decoderReuseEvaluation);
});
} }
@Override @Override

View File

@ -59,12 +59,6 @@ public interface AudioRendererEventListener {
default void onAudioDecoderInitialized( default void onAudioDecoderInitialized(
String decoderName, long initializedTimestampMs, long initializationDurationMs) {} String decoderName, long initializedTimestampMs, long initializationDurationMs) {}
/**
* @deprecated Use {@link #onAudioInputFormatChanged(Format, DecoderReuseEvaluation)}.
*/
@Deprecated
default void onAudioInputFormatChanged(Format format) {}
/** /**
* Called when the format of the media being consumed by the renderer changes. * Called when the format of the media being consumed by the renderer changes.
* *
@ -202,16 +196,15 @@ public interface AudioRendererEventListener {
} }
} }
/** Invokes {@link AudioRendererEventListener#onAudioInputFormatChanged(Format)}. */ /**
@SuppressWarnings("deprecation") // Calling deprecated listener method. * Invokes {@link AudioRendererEventListener#onAudioInputFormatChanged(Format,
* DecoderReuseEvaluation)}.
*/
public void inputFormatChanged( public void inputFormatChanged(
Format format, @Nullable DecoderReuseEvaluation decoderReuseEvaluation) { Format format, @Nullable DecoderReuseEvaluation decoderReuseEvaluation) {
if (handler != null) { if (handler != null) {
handler.post( handler.post(
() -> { () -> castNonNull(listener).onAudioInputFormatChanged(format, decoderReuseEvaluation));
castNonNull(listener).onAudioInputFormatChanged(format);
castNonNull(listener).onAudioInputFormatChanged(format, decoderReuseEvaluation);
});
} }
} }

View File

@ -59,12 +59,6 @@ public interface VideoRendererEventListener {
default void onVideoDecoderInitialized( default void onVideoDecoderInitialized(
String decoderName, long initializedTimestampMs, long initializationDurationMs) {} String decoderName, long initializedTimestampMs, long initializationDurationMs) {}
/**
* @deprecated Use {@link #onVideoInputFormatChanged(Format, DecoderReuseEvaluation)}.
*/
@Deprecated
default void onVideoInputFormatChanged(Format format) {}
/** /**
* Called when the format of the media being consumed by the renderer changes. * Called when the format of the media being consumed by the renderer changes.
* *
@ -200,10 +194,7 @@ public interface VideoRendererEventListener {
Format format, @Nullable DecoderReuseEvaluation decoderReuseEvaluation) { Format format, @Nullable DecoderReuseEvaluation decoderReuseEvaluation) {
if (handler != null) { if (handler != null) {
handler.post( handler.post(
() -> { () -> castNonNull(listener).onVideoInputFormatChanged(format, decoderReuseEvaluation));
castNonNull(listener).onVideoInputFormatChanged(format);
castNonNull(listener).onVideoInputFormatChanged(format, decoderReuseEvaluation);
});
} }
} }

View File

@ -96,6 +96,7 @@ import androidx.media3.common.util.ConditionVariable;
import androidx.media3.common.util.HandlerWrapper; import androidx.media3.common.util.HandlerWrapper;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
import androidx.media3.exoplayer.DecoderCounters; import androidx.media3.exoplayer.DecoderCounters;
import androidx.media3.exoplayer.DecoderReuseEvaluation;
import androidx.media3.exoplayer.ExoPlaybackException; import androidx.media3.exoplayer.ExoPlaybackException;
import androidx.media3.exoplayer.ExoPlayer; import androidx.media3.exoplayer.ExoPlayer;
import androidx.media3.exoplayer.Renderer; import androidx.media3.exoplayer.Renderer;
@ -2212,7 +2213,10 @@ public final class DefaultAnalyticsCollectorTest {
} }
@Override @Override
public void onAudioInputFormatChanged(EventTime eventTime, Format format) { public void onAudioInputFormatChanged(
EventTime eventTime,
Format format,
@Nullable DecoderReuseEvaluation decoderReuseEvaluation) {
reportedEvents.add(new ReportedEvent(EVENT_AUDIO_INPUT_FORMAT_CHANGED, eventTime)); reportedEvents.add(new ReportedEvent(EVENT_AUDIO_INPUT_FORMAT_CHANGED, eventTime));
} }
@ -2252,7 +2256,10 @@ public final class DefaultAnalyticsCollectorTest {
} }
@Override @Override
public void onVideoInputFormatChanged(EventTime eventTime, Format format) { public void onVideoInputFormatChanged(
EventTime eventTime,
Format format,
@Nullable DecoderReuseEvaluation decoderReuseEvaluation) {
reportedEvents.add(new ReportedEvent(EVENT_VIDEO_INPUT_FORMAT_CHANGED, eventTime)); reportedEvents.add(new ReportedEvent(EVENT_VIDEO_INPUT_FORMAT_CHANGED, eventTime));
} }