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
This commit is contained in:
aquilescanta 2019-02-20 10:49:26 +00:00 committed by Andrew Lewis
parent 90c4cd2e71
commit 3c0ce056d9

View File

@ -68,6 +68,10 @@ import java.io.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;