Fix for Apple's I-Frame-only stream playback.

See bug: https://github.com/google/ExoPlayer/issues/7512
This commit is contained in:
mdobrzyn71 2020-10-06 10:51:49 -07:00
parent 8b5ecdb98d
commit 4b1b924cf1
3 changed files with 22 additions and 0 deletions

View File

@ -67,6 +67,11 @@ public final class BundledHlsMediaChunkExtractor implements HlsMediaChunkExtract
return extractor.read(extractorInput, POSITION_HOLDER) == Extractor.RESULT_CONTINUE;
}
@Override
public void seek(long position, long timeUs) {
extractor.seek( position, timeUs );
}
@Override
public boolean isPackedAudioExtractor() {
return extractor instanceof AdtsExtractor

View File

@ -403,6 +403,15 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
}
try {
while (!loadCanceled && extractor.read(input)) {}
} catch(EOFException e) {
// See bug: https://github.com/google/ExoPlayer/issues/7512 for more details.
if( input.getPosition() == dataSpec.position + input.getLength() ) {
extractor.seek(0, C.TIME_UNSET);
}
else {
e.fillInStackTrace();
throw e;
}
} finally {
nextLoadPosition = (int) (input.getPosition() - dataSpec.position);
}

View File

@ -48,6 +48,14 @@ public interface HlsMediaChunkExtractor {
*/
boolean read(ExtractorInput extractorInput) throws IOException;
/**
* Notifies the extractor that a seek has occurred.
*
* @param position The byte offset in the stream from which data will be provided.
* @param timeUs The seek time in microseconds.
*/
void seek(long position, long timeUs);
/** Returns whether this is a packed audio extractor, as defined in RFC 8216, Section 3.4. */
boolean isPackedAudioExtractor();