Commit 011342f4 by krocard Committed by Ian Baker

Explicitly fail playback if new format has no sampleMimeType

This avoids a NullPointerException later when the format is used.

Fixes https://github.com/google/ExoPlayer/issues/8283.

PiperOrigin-RevId: 348017149
parent c22fd76b
......@@ -1455,6 +1455,11 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
protected void onInputFormatChanged(FormatHolder formatHolder) throws ExoPlaybackException {
waitingForFirstSampleInFormat = true;
Format newFormat = Assertions.checkNotNull(formatHolder.format);
if (newFormat.sampleMimeType == null) {
// If the new format is invalid, it is either a media bug or it is not intended to be played.
// See also https://github.com/google/ExoPlayer/issues/8283.
throw createRendererException(new IllegalArgumentException(), newFormat);
}
setSourceDrmSession(formatHolder.drmSession);
inputFormat = newFormat;
......
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