mirror of
https://github.com/samsonjs/media.git
synced 2026-04-07 11:35:46 +00:00
Always initialize VideoSink in renderer
Instead of initializing the video sink outside the renderer with an empty format for composition preview, we initialize it in the renderer with the input format for video. PiperOrigin-RevId: 627313708
This commit is contained in:
parent
e3caed1441
commit
8da6938782
2 changed files with 13 additions and 2 deletions
|
|
@ -200,7 +200,8 @@ public class ImageRenderer extends BaseRenderer {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onEnabled(boolean joining, boolean mayRenderStartOfStream) {
|
||||
protected void onEnabled(boolean joining, boolean mayRenderStartOfStream)
|
||||
throws ExoPlaybackException {
|
||||
firstFrameState =
|
||||
mayRenderStartOfStream
|
||||
? C.FIRST_FRAME_NOT_RENDERED
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||
/** Utility {@link Player.Listener} for testing. */
|
||||
public final class PlayerTestListener implements Player.Listener, AnalyticsListener {
|
||||
|
||||
private final ConditionVariable playerIdle;
|
||||
private final ConditionVariable playerReady;
|
||||
private final ConditionVariable playerEnded;
|
||||
private final ConditionVariable firstFrameRendered;
|
||||
|
|
@ -43,6 +44,7 @@ public final class PlayerTestListener implements Player.Listener, AnalyticsListe
|
|||
* #waitUntilPlayerReady()} and {@link #waitUntilPlayerEnded()} waits.
|
||||
*/
|
||||
public PlayerTestListener(long testTimeoutMs) {
|
||||
playerIdle = new ConditionVariable();
|
||||
playerReady = new ConditionVariable();
|
||||
playerEnded = new ConditionVariable();
|
||||
firstFrameRendered = new ConditionVariable();
|
||||
|
|
@ -50,6 +52,11 @@ public final class PlayerTestListener implements Player.Listener, AnalyticsListe
|
|||
this.testTimeoutMs = testTimeoutMs;
|
||||
}
|
||||
|
||||
/** Waits until the {@link Player player} is {@linkplain Player#STATE_IDLE idle}. */
|
||||
public void waitUntilPlayerIdle() throws PlaybackException, TimeoutException {
|
||||
waitOrThrow(playerIdle);
|
||||
}
|
||||
|
||||
/** Waits until the {@link Player player} is {@linkplain Player#STATE_READY ready}. */
|
||||
public void waitUntilPlayerReady() throws TimeoutException, PlaybackException {
|
||||
waitOrThrow(playerReady);
|
||||
|
|
@ -81,7 +88,9 @@ public final class PlayerTestListener implements Player.Listener, AnalyticsListe
|
|||
|
||||
@Override
|
||||
public void onPlaybackStateChanged(int playbackState) {
|
||||
if (playbackState == Player.STATE_READY) {
|
||||
if (playbackState == Player.STATE_IDLE) {
|
||||
playerIdle.open();
|
||||
} else if (playbackState == Player.STATE_READY) {
|
||||
playerReady.open();
|
||||
} else if (playbackState == Player.STATE_ENDED) {
|
||||
playerEnded.open();
|
||||
|
|
@ -96,6 +105,7 @@ public final class PlayerTestListener implements Player.Listener, AnalyticsListe
|
|||
@Override
|
||||
public void onPlayerError(PlaybackException error) {
|
||||
playbackException.set(error);
|
||||
playerIdle.open();
|
||||
playerReady.open();
|
||||
playerEnded.open();
|
||||
firstFrameRendered.open();
|
||||
|
|
|
|||
Loading…
Reference in a new issue