Improve logic to wait for a seek in CompositionPlayerSeekTest
The logic was assuming that the shader program was only flushed when seeking. This is true if a single renderer is used but, with multiple renderers, the shader program can be flushed at the transition. This change is necessary to make the test pass for prewarming because 2 video renderers will be used in that case. PiperOrigin-RevId: 666215967
This commit is contained in:
parent
6b56f12f15
commit
4ba9f59492
@ -133,8 +133,7 @@ public class CompositionPlayerSeekTest {
|
||||
() -> {
|
||||
compositionPlayer = new CompositionPlayer.Builder(applicationContext).build();
|
||||
// Set a surface on the player even though there is no UI on this test. We need a
|
||||
// surface
|
||||
// otherwise the player will skip/drop video frames.
|
||||
// surface otherwise the player will skip/drop video frames.
|
||||
compositionPlayer.setVideoSurfaceView(surfaceView);
|
||||
compositionPlayer.addListener(playerTestListener);
|
||||
compositionPlayer.setComposition(
|
||||
@ -429,8 +428,13 @@ public class CompositionPlayerSeekTest {
|
||||
@Override
|
||||
public void flush() {
|
||||
super.flush();
|
||||
shaderProgramShouldBlockInput.set(false);
|
||||
framesReceivedLatch.reset(Integer.MAX_VALUE);
|
||||
if (framesReceivedLatch.getCount() == 0) {
|
||||
// The flush is caused by the seek operation. We do this check because the shader
|
||||
// program can be flushed for other reasons, for example at the transition between 2
|
||||
// renderers.
|
||||
shaderProgramShouldBlockInput.set(false);
|
||||
framesReceivedLatch.reset(Integer.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -449,8 +453,7 @@ public class CompositionPlayerSeekTest {
|
||||
() -> {
|
||||
compositionPlayer = new CompositionPlayer.Builder(applicationContext).build();
|
||||
// Set a surface on the player even though there is no UI on this test. We need a
|
||||
// surface
|
||||
// otherwise the player will skip/drop video frames.
|
||||
// surface otherwise the player will skip/drop video frames.
|
||||
compositionPlayer.setVideoSurfaceView(surfaceView);
|
||||
compositionPlayer.addListener(playerTestListener);
|
||||
compositionPlayer.setComposition(
|
||||
|
Loading…
x
Reference in New Issue
Block a user