From 3c0ce056d95d6d92e01cb1335fee560249a90ff2 Mon Sep 17 00:00:00 2001 From: aquilescanta Date: Wed, 20 Feb 2019 10:49:26 +0000 Subject: [PATCH] Fix HlsSampleStream#read non-fatal lack of mapping HlsSampleStream#read should return end of stream when there is no mapping for the sample stream, instead of nothing read. This allows the player to transition to ended. Issue:#5524 PiperOrigin-RevId: 234764027 --- .../google/android/exoplayer2/source/hls/HlsSampleStream.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsSampleStream.java b/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsSampleStream.java index f43d119018b..cf879e91c6a 100644 --- a/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsSampleStream.java +++ b/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsSampleStream.java @@ -68,6 +68,10 @@ public void maybeThrowError() throws IOException { @Override public int readData(FormatHolder formatHolder, DecoderInputBuffer buffer, boolean requireFormat) { + if (sampleQueueIndex == HlsSampleStreamWrapper.SAMPLE_QUEUE_INDEX_NO_MAPPING_NON_FATAL) { + buffer.addFlag(C.BUFFER_FLAG_END_OF_STREAM); + return C.RESULT_BUFFER_READ; + } return hasValidSampleQueueIndex() ? sampleStreamWrapper.readData(sampleQueueIndex, formatHolder, buffer, requireFormat) : C.RESULT_NOTHING_READ;