From f0cdf8e75cc574fe37d737847c6336fa39a2b684 Mon Sep 17 00:00:00 2001 From: olly Date: Mon, 27 Jul 2020 17:04:23 +0100 Subject: [PATCH] FLV: Ignore invalid SCRIPTDATA name type, rather than fail playback Issue: #7675 PiperOrigin-RevId: 323371286 --- RELEASENOTES.md | 2 ++ .../exoplayer2/extractor/flv/ScriptTagPayloadReader.java | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 445f7e157de..b6c2b2ac100 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -9,6 +9,8 @@ * FMP4: Fix `saiz` and `senc` sample count checks, resolving a "length mismatch" `ParserException` when playing certain protected FMP4 streams ([#7592](https://github.com/google/ExoPlayer/issues/7592)). +* FLV: Ignore SCRIPTDATA segments with invalid name types, rather than failing + playback ([#7675](https://github.com/google/ExoPlayer/issues/7675)). * IMA extension: Upgrade to IMA SDK 3.19.4, bringing in a fix for setting the media load timeout ([#7170](https://github.com/google/ExoPlayer/issues/7170)). diff --git a/library/core/src/main/java/com/google/android/exoplayer2/extractor/flv/ScriptTagPayloadReader.java b/library/core/src/main/java/com/google/android/exoplayer2/extractor/flv/ScriptTagPayloadReader.java index 806cc9fad44..b7f94abb2b1 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/extractor/flv/ScriptTagPayloadReader.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/extractor/flv/ScriptTagPayloadReader.java @@ -17,7 +17,6 @@ import androidx.annotation.Nullable; import com.google.android.exoplayer2.C; -import com.google.android.exoplayer2.ParserException; import com.google.android.exoplayer2.extractor.DummyTrackOutput; import com.google.android.exoplayer2.util.ParsableByteArray; import java.util.ArrayList; @@ -65,11 +64,11 @@ protected boolean parseHeader(ParsableByteArray data) { } @Override - protected boolean parsePayload(ParsableByteArray data, long timeUs) throws ParserException { + protected boolean parsePayload(ParsableByteArray data, long timeUs) { int nameType = readAmfType(data); if (nameType != AMF_TYPE_STRING) { - // Should never happen. - throw new ParserException(); + // Ignore segments with unexpected name type. + return false; } String name = readAmfString(data); if (!NAME_METADATA.equals(name)) {