mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Adapt InputVideoSink.onInputStreamChanged for CompositionPlayer
The output of CompositionPlayer should be considered as a single clip (not a playlist) so we should only propagate the first stream change event in that case. PiperOrigin-RevId: 752661523
This commit is contained in:
parent
cfa13e9616
commit
293c55e062
@ -828,20 +828,23 @@ public final class PlaybackVideoGraphWrapper implements VideoGraph.Listener {
|
|||||||
finalFramePresentationTimeUs = C.TIME_UNSET;
|
finalFramePresentationTimeUs = C.TIME_UNSET;
|
||||||
hasSignaledEndOfVideoGraphOutputStream = false;
|
hasSignaledEndOfVideoGraphOutputStream = false;
|
||||||
registerInputStream(format);
|
registerInputStream(format);
|
||||||
long fromTimestampUs;
|
boolean isFirstStream = lastFramePresentationTimeUs == C.TIME_UNSET;
|
||||||
if (lastFramePresentationTimeUs == C.TIME_UNSET) {
|
if (enablePlaylistMode || (inputIndex == PRIMARY_SEQUENCE_INDEX && isFirstStream)) {
|
||||||
// Add a stream change info to the queue with a large negative timestamp to always apply it
|
long fromTimestampUs;
|
||||||
// as long as it is the only one in the queue.
|
if (isFirstStream) {
|
||||||
fromTimestampUs = Long.MIN_VALUE / 2;
|
// Add a stream change info to the queue with a large negative timestamp to always apply
|
||||||
} else {
|
// it as long as it is the only one in the queue.
|
||||||
fromTimestampUs = lastFramePresentationTimeUs + 1;
|
fromTimestampUs = Long.MIN_VALUE / 2;
|
||||||
|
} else {
|
||||||
|
fromTimestampUs = lastFramePresentationTimeUs + 1;
|
||||||
|
}
|
||||||
|
pendingStreamChanges.add(
|
||||||
|
fromTimestampUs,
|
||||||
|
new StreamChangeInfo(
|
||||||
|
/* startPositionUs= */ startPositionUs + inputBufferTimestampAdjustmentUs,
|
||||||
|
firstFrameReleaseInstruction,
|
||||||
|
fromTimestampUs));
|
||||||
}
|
}
|
||||||
pendingStreamChanges.add(
|
|
||||||
fromTimestampUs,
|
|
||||||
new StreamChangeInfo(
|
|
||||||
/* startPositionUs= */ startPositionUs + inputBufferTimestampAdjustmentUs,
|
|
||||||
firstFrameReleaseInstruction,
|
|
||||||
fromTimestampUs));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -134,7 +134,7 @@ public class CompositionMultipleSequencePlaybackTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore("TODO: b/391349011 - Re-enable after propagating an EOS signal after each MediaItem")
|
@Ignore("TODO: b/405966202 - Re-enable after propagating an EOS signal after each MediaItem")
|
||||||
public void playback_sequencesOfVideos_effectsReceiveCorrectTimestamps() throws Exception {
|
public void playback_sequencesOfVideos_effectsReceiveCorrectTimestamps() throws Exception {
|
||||||
Composition composition =
|
Composition composition =
|
||||||
new Composition.Builder(
|
new Composition.Builder(
|
||||||
@ -165,7 +165,6 @@ public class CompositionMultipleSequencePlaybackTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore("TODO: b/391349011 - Re-enable after adapting rendering logic for multiple sequences")
|
|
||||||
public void playback_sequencesOfImages_effectsReceiveCorrectTimestamps() throws Exception {
|
public void playback_sequencesOfImages_effectsReceiveCorrectTimestamps() throws Exception {
|
||||||
Composition composition =
|
Composition composition =
|
||||||
new Composition.Builder(
|
new Composition.Builder(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user