ignore dropSamplesBeforeFirstVideoSample in audio-only streams

PiperOrigin-RevId: 593126632
This commit is contained in:
tofunmi 2023-12-22 08:51:26 -08:00 committed by Copybara-Service
parent 64231ee079
commit 4fc11a98a1

View File

@ -348,6 +348,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/* extraFormat= */ "%s", /* extraFormat= */ "%s",
/* extraArgs...= */ canWriteSample); /* extraArgs...= */ canWriteSample);
if (dropSamplesBeforeFirstVideoSample if (dropSamplesBeforeFirstVideoSample
&& contains(trackTypeToInfo, C.TRACK_TYPE_VIDEO)
&& firstVideoPresentationTimeUs != C.TIME_UNSET && firstVideoPresentationTimeUs != C.TIME_UNSET
&& presentationTimeUs < firstVideoPresentationTimeUs) { && presentationTimeUs < firstVideoPresentationTimeUs) {
// Drop the buffer. // Drop the buffer.
@ -464,6 +465,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private boolean canWriteSample(@C.TrackType int trackType, long presentationTimeUs) { private boolean canWriteSample(@C.TrackType int trackType, long presentationTimeUs) {
if (dropSamplesBeforeFirstVideoSample if (dropSamplesBeforeFirstVideoSample
&& trackType != C.TRACK_TYPE_VIDEO && trackType != C.TRACK_TYPE_VIDEO
&& contains(trackTypeToInfo, C.TRACK_TYPE_VIDEO)
&& firstVideoPresentationTimeUs == C.TIME_UNSET) { && firstVideoPresentationTimeUs == C.TIME_UNSET) {
// Haven't received the first video sample yet, so can't write any audio. // Haven't received the first video sample yet, so can't write any audio.
return false; return false;