mirror of
https://github.com/androidx/media.git
synced 2025-05-08 08:00:49 +08:00
Merge pull request #8215 from TiVo:p-fix-apple-iframe-bug
PiperOrigin-RevId: 345202157
This commit is contained in:
parent
eb38a63e36
commit
495347d3c0
@ -101,4 +101,9 @@ public final class BundledHlsMediaChunkExtractor implements HlsMediaChunkExtract
|
||||
return new BundledHlsMediaChunkExtractor(
|
||||
newExtractorInstance, masterPlaylistFormat, timestampAdjuster);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTruncatedSegmentParsed() {
|
||||
extractor.seek(/* position= */ 0, /* timeUs= */ 0);
|
||||
}
|
||||
}
|
||||
|
@ -403,6 +403,14 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
||||
}
|
||||
try {
|
||||
while (!loadCanceled && extractor.read(input)) {}
|
||||
} catch (EOFException e) {
|
||||
if ((trackFormat.roleFlags & C.ROLE_FLAG_TRICK_PLAY) != 0) {
|
||||
// See onTruncatedSegmentParsed's javadoc for more info on why we are swallowing the EOF
|
||||
// exception for trick play tracks.
|
||||
extractor.onTruncatedSegmentParsed();
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
} finally {
|
||||
nextLoadPosition = (int) (input.getPosition() - dataSpec.position);
|
||||
}
|
||||
|
@ -59,4 +59,15 @@ public interface HlsMediaChunkExtractor {
|
||||
* instances that are not {@link #isReusable() reusable}.
|
||||
*/
|
||||
HlsMediaChunkExtractor recreate();
|
||||
|
||||
/**
|
||||
* Resets the sample parsing state.
|
||||
*
|
||||
* <p>Resetting the parsing state allows support for Fragmented MP4 EXT-X-I-FRAME-STREAM-INF
|
||||
* segments. EXT-X-I-FRAME-STREAM-INF segments are truncated to include only a leading key frame.
|
||||
* After parsing said keyframe, an extractor may reach an unexpected end of file. By resetting its
|
||||
* state, we can continue feeding samples from the following segments to the extractor. See <a
|
||||
* href="https://github.com/google/ExoPlayer/issues/7512">#7512</a> for context.
|
||||
*/
|
||||
void onTruncatedSegmentParsed();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user