Merge pull request #8215 from TiVo:p-fix-apple-iframe-bug
PiperOrigin-RevId: 345202157
This commit is contained in:
commit
b22b53f6f1
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -428,6 +428,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();
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import android.annotation.SuppressLint;
|
||||
import android.media.MediaFormat;
|
||||
import android.media.MediaParser;
|
||||
import android.media.MediaParser.OutputConsumer;
|
||||
import android.media.MediaParser.SeekPoint;
|
||||
import android.text.TextUtils;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@ -211,6 +212,11 @@ public final class MediaParserHlsMediaChunkExtractor implements HlsMediaChunkExt
|
||||
/* leadingBytesToSkip= */ 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTruncatedSegmentParsed() {
|
||||
mediaParser.seek(SeekPoint.START);
|
||||
}
|
||||
|
||||
// Allow constants that are not part of the public MediaParser API.
|
||||
@SuppressLint({"WrongConstant"})
|
||||
private static MediaParser createMediaParserInstance(
|
||||
|
Loading…
x
Reference in New Issue
Block a user