From a3e8890a836fab2af599b65f67c219f26ee8192f Mon Sep 17 00:00:00 2001 From: Guoen Yong Date: Wed, 3 Apr 2024 16:17:03 +0800 Subject: [PATCH] Try to fix the playback issue for case x-discontinuity without init tag (#22) --- .../media3/exoplayer/hls/playlist/HlsPlaylistParser.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsPlaylistParser.java b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsPlaylistParser.java index 73a93052b8..fcd9a3e37b 100644 --- a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsPlaylistParser.java +++ b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsPlaylistParser.java @@ -820,6 +820,8 @@ private static HlsMediaPlaylist parseMediaPlaylist( if (METHOD_NONE.equals(method)) { currentSchemeDatas.clear(); cachedDrmInitData = null; + // To fix the playback issue on the mixed-ts-cmaf stream. + initializationSegment = null; } else /* !METHOD_NONE.equals(method) */ { fullSegmentEncryptionIV = parseOptionalStringAttr(line, REGEX_IV, variableDefinitions); if (KEYFORMAT_IDENTITY.equals(keyFormat)) { @@ -853,8 +855,6 @@ private static HlsMediaPlaylist parseMediaPlaylist( playlistDiscontinuitySequence = Integer.parseInt(line.substring(line.indexOf(':') + 1)); } else if (line.equals(TAG_DISCONTINUITY) && !discontinuityAfterSkip) { relativeDiscontinuitySequence++; - // To fix the playback issue on the mixed-ts-cmaf stream. - initializationSegment = null; } else if (line.startsWith(TAG_PROGRAM_DATE_TIME)) { segmentStartTimeUtcUs = Util.msToUs(Util.parseXsDateTime(line.substring(line.indexOf(':') + 1))); // Calc playlist start time with latest value of #EXT-X-PROGRAM-DATE-TIME tag, instead first value.