Use MimeType.allSamplesAreSyncSamples in ClippingMediaPeriod

PiperOrigin-RevId: 325409392
This commit is contained in:
christosts 2020-08-07 11:41:56 +01:00 committed by kim-vde
parent 6a54ddd217
commit c7a1151c2b

View file

@ -258,13 +258,13 @@ public final class ClippingMediaPeriod implements MediaPeriod, MediaPeriod.Callb
// negative timestamp, its offset timestamp can jump backwards compared to the last timestamp // negative timestamp, its offset timestamp can jump backwards compared to the last timestamp
// read in the previous period. Renderer implementations may not allow this, so we signal a // read in the previous period. Renderer implementations may not allow this, so we signal a
// discontinuity which resets the renderers before they read the clipping sample stream. // discontinuity which resets the renderers before they read the clipping sample stream.
// However, for audio-only track selections we assume to have random access seek behaviour and // However, for tracks where all samples are sync samples, we assume they have random access
// do not need an initial discontinuity to reset the renderer. // seek behaviour and do not need an initial discontinuity to reset the renderer.
if (startUs != 0) { if (startUs != 0) {
for (TrackSelection trackSelection : selections) { for (TrackSelection trackSelection : selections) {
if (trackSelection != null) { if (trackSelection != null) {
Format selectedFormat = trackSelection.getSelectedFormat(); Format selectedFormat = trackSelection.getSelectedFormat();
if (!MimeTypes.isAudio(selectedFormat.sampleMimeType)) { if (!MimeTypes.allSamplesAreSyncSamples(selectedFormat.sampleMimeType)) {
return true; return true;
} }
} }