mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Rename VideoSink.onStarted/Stopped
start/stopRendering better reflects what the method does. PiperOrigin-RevId: 743493973
This commit is contained in:
parent
96222478cd
commit
18e9a3fe36
@ -78,12 +78,12 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStarted() {
|
||||
public void startRendering() {
|
||||
videoFrameReleaseControl.onStarted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopped() {
|
||||
public void stopRendering() {
|
||||
videoFrameReleaseControl.onStopped();
|
||||
}
|
||||
|
||||
|
@ -1058,7 +1058,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||
totalVideoFrameProcessingOffsetUs = 0;
|
||||
videoFrameProcessingOffsetCount = 0;
|
||||
if (videoSink != null) {
|
||||
videoSink.onStarted();
|
||||
videoSink.startRendering();
|
||||
} else {
|
||||
videoFrameReleaseControl.onStarted();
|
||||
}
|
||||
@ -1069,7 +1069,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||
maybeNotifyDroppedFrames();
|
||||
maybeNotifyVideoFrameProcessingOffset();
|
||||
if (videoSink != null) {
|
||||
videoSink.onStopped();
|
||||
videoSink.stopRendering();
|
||||
} else {
|
||||
videoFrameReleaseControl.onStopped();
|
||||
}
|
||||
|
@ -701,13 +701,13 @@ public final class PlaybackVideoGraphWrapper implements VideoSinkProvider, Video
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStarted() {
|
||||
defaultVideoSink.onStarted();
|
||||
public void startRendering() {
|
||||
defaultVideoSink.startRendering();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopped() {
|
||||
defaultVideoSink.onStopped();
|
||||
public void stopRendering() {
|
||||
defaultVideoSink.stopRendering();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -139,11 +139,11 @@ public interface VideoSink {
|
||||
*/
|
||||
int RELEASE_FIRST_FRAME_WHEN_PREVIOUS_STREAM_PROCESSED = 2;
|
||||
|
||||
/** Called when rendering starts. */
|
||||
void onStarted();
|
||||
/** Starts rendering to the output surface. */
|
||||
void startRendering();
|
||||
|
||||
/** Called when rendering stops. */
|
||||
void onStopped();
|
||||
/** Stops rendering to the output surface. */
|
||||
void stopRendering();
|
||||
|
||||
/**
|
||||
* Sets a {@link Listener} on this sink. Callbacks are triggered on the supplied {@link Executor}.
|
||||
@ -263,8 +263,8 @@ public interface VideoSink {
|
||||
List<Effect> videoEffects);
|
||||
|
||||
/**
|
||||
* Allows the sink to release the first frame even if rendering is not {@linkplain #onStarted()
|
||||
* started}.
|
||||
* Allows the sink to release the first frame even if rendering is not {@linkplain
|
||||
* #startRendering() started}.
|
||||
*
|
||||
* <p>This is used to update the {@link FirstFrameReleaseInstruction} of the {@linkplain
|
||||
* #onInputStreamChanged(int, Format, long, int, List) stream} that is currently being processed.
|
||||
|
@ -81,13 +81,13 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStarted() {
|
||||
executeOrDelay(VideoSink::onStarted);
|
||||
public void startRendering() {
|
||||
executeOrDelay(VideoSink::startRendering);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopped() {
|
||||
executeOrDelay(VideoSink::onStopped);
|
||||
public void stopRendering() {
|
||||
executeOrDelay(VideoSink::stopRendering);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -576,7 +576,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
@Override
|
||||
protected void onStarted() throws ExoPlaybackException {
|
||||
super.onStarted();
|
||||
videoSink.onStarted();
|
||||
videoSink.startRendering();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -595,7 +595,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
@Override
|
||||
protected void onStopped() {
|
||||
super.onStopped();
|
||||
videoSink.onStopped();
|
||||
videoSink.stopRendering();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,11 +40,11 @@ public class BufferingVideoSinkTest {
|
||||
VideoSink videoSinkMock = mock(VideoSink.class);
|
||||
|
||||
bufferingVideoSink.setVideoSink(videoSinkMock);
|
||||
bufferingVideoSink.onStarted();
|
||||
bufferingVideoSink.startRendering();
|
||||
bufferingVideoSink.flush(/* resetPosition= */ true);
|
||||
|
||||
InOrder inOrder = Mockito.inOrder(videoSinkMock);
|
||||
inOrder.verify(videoSinkMock).onStarted();
|
||||
inOrder.verify(videoSinkMock).startRendering();
|
||||
inOrder.verify(videoSinkMock).flush(/* resetPosition= */ true);
|
||||
}
|
||||
|
||||
@ -52,12 +52,12 @@ public class BufferingVideoSinkTest {
|
||||
public void setVideoSink_executesPendingOperations() {
|
||||
BufferingVideoSink bufferingVideoSink = new BufferingVideoSink(context);
|
||||
VideoSink videoSinkMock = mock(VideoSink.class);
|
||||
bufferingVideoSink.onStarted();
|
||||
bufferingVideoSink.startRendering();
|
||||
bufferingVideoSink.flush(/* resetPosition= */ true);
|
||||
bufferingVideoSink.setVideoSink(videoSinkMock);
|
||||
|
||||
InOrder inOrder = Mockito.inOrder(videoSinkMock);
|
||||
inOrder.verify(videoSinkMock).onStarted();
|
||||
inOrder.verify(videoSinkMock).startRendering();
|
||||
inOrder.verify(videoSinkMock).flush(/* resetPosition= */ true);
|
||||
}
|
||||
|
||||
@ -68,10 +68,10 @@ public class BufferingVideoSinkTest {
|
||||
bufferingVideoSink.setVideoSink(videoSinkMock);
|
||||
|
||||
bufferingVideoSink.setVideoSink(null);
|
||||
bufferingVideoSink.onStarted();
|
||||
bufferingVideoSink.startRendering();
|
||||
bufferingVideoSink.flush(/* resetPosition= */ true);
|
||||
|
||||
verify(videoSinkMock, never()).onStarted();
|
||||
verify(videoSinkMock, never()).startRendering();
|
||||
verify(videoSinkMock, never()).flush(/* resetPosition= */ true);
|
||||
}
|
||||
|
||||
@ -80,12 +80,12 @@ public class BufferingVideoSinkTest {
|
||||
BufferingVideoSink bufferingVideoSink = new BufferingVideoSink(context);
|
||||
VideoSink videoSinkMock = mock(VideoSink.class);
|
||||
|
||||
bufferingVideoSink.onStarted();
|
||||
bufferingVideoSink.startRendering();
|
||||
bufferingVideoSink.flush(/* resetPosition= */ true);
|
||||
bufferingVideoSink.clearPendingOperations();
|
||||
bufferingVideoSink.setVideoSink(videoSinkMock);
|
||||
|
||||
verify(videoSinkMock, never()).onStarted();
|
||||
verify(videoSinkMock, never()).startRendering();
|
||||
verify(videoSinkMock, never()).flush(/* resetPosition= */ true);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user