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
|
@Override
|
||||||
public void onStarted() {
|
public void startRendering() {
|
||||||
videoFrameReleaseControl.onStarted();
|
videoFrameReleaseControl.onStarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStopped() {
|
public void stopRendering() {
|
||||||
videoFrameReleaseControl.onStopped();
|
videoFrameReleaseControl.onStopped();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1058,7 +1058,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
totalVideoFrameProcessingOffsetUs = 0;
|
totalVideoFrameProcessingOffsetUs = 0;
|
||||||
videoFrameProcessingOffsetCount = 0;
|
videoFrameProcessingOffsetCount = 0;
|
||||||
if (videoSink != null) {
|
if (videoSink != null) {
|
||||||
videoSink.onStarted();
|
videoSink.startRendering();
|
||||||
} else {
|
} else {
|
||||||
videoFrameReleaseControl.onStarted();
|
videoFrameReleaseControl.onStarted();
|
||||||
}
|
}
|
||||||
@ -1069,7 +1069,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
maybeNotifyDroppedFrames();
|
maybeNotifyDroppedFrames();
|
||||||
maybeNotifyVideoFrameProcessingOffset();
|
maybeNotifyVideoFrameProcessingOffset();
|
||||||
if (videoSink != null) {
|
if (videoSink != null) {
|
||||||
videoSink.onStopped();
|
videoSink.stopRendering();
|
||||||
} else {
|
} else {
|
||||||
videoFrameReleaseControl.onStopped();
|
videoFrameReleaseControl.onStopped();
|
||||||
}
|
}
|
||||||
|
@ -701,13 +701,13 @@ public final class PlaybackVideoGraphWrapper implements VideoSinkProvider, Video
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStarted() {
|
public void startRendering() {
|
||||||
defaultVideoSink.onStarted();
|
defaultVideoSink.startRendering();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStopped() {
|
public void stopRendering() {
|
||||||
defaultVideoSink.onStopped();
|
defaultVideoSink.stopRendering();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -139,11 +139,11 @@ public interface VideoSink {
|
|||||||
*/
|
*/
|
||||||
int RELEASE_FIRST_FRAME_WHEN_PREVIOUS_STREAM_PROCESSED = 2;
|
int RELEASE_FIRST_FRAME_WHEN_PREVIOUS_STREAM_PROCESSED = 2;
|
||||||
|
|
||||||
/** Called when rendering starts. */
|
/** Starts rendering to the output surface. */
|
||||||
void onStarted();
|
void startRendering();
|
||||||
|
|
||||||
/** Called when rendering stops. */
|
/** Stops rendering to the output surface. */
|
||||||
void onStopped();
|
void stopRendering();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a {@link Listener} on this sink. Callbacks are triggered on the supplied {@link Executor}.
|
* 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);
|
List<Effect> videoEffects);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows the sink to release the first frame even if rendering is not {@linkplain #onStarted()
|
* Allows the sink to release the first frame even if rendering is not {@linkplain
|
||||||
* started}.
|
* #startRendering() started}.
|
||||||
*
|
*
|
||||||
* <p>This is used to update the {@link FirstFrameReleaseInstruction} of the {@linkplain
|
* <p>This is used to update the {@link FirstFrameReleaseInstruction} of the {@linkplain
|
||||||
* #onInputStreamChanged(int, Format, long, int, List) stream} that is currently being processed.
|
* #onInputStreamChanged(int, Format, long, int, List) stream} that is currently being processed.
|
||||||
|
@ -81,13 +81,13 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStarted() {
|
public void startRendering() {
|
||||||
executeOrDelay(VideoSink::onStarted);
|
executeOrDelay(VideoSink::startRendering);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStopped() {
|
public void stopRendering() {
|
||||||
executeOrDelay(VideoSink::onStopped);
|
executeOrDelay(VideoSink::stopRendering);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -576,7 +576,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
@Override
|
@Override
|
||||||
protected void onStarted() throws ExoPlaybackException {
|
protected void onStarted() throws ExoPlaybackException {
|
||||||
super.onStarted();
|
super.onStarted();
|
||||||
videoSink.onStarted();
|
videoSink.startRendering();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -595,7 +595,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
@Override
|
@Override
|
||||||
protected void onStopped() {
|
protected void onStopped() {
|
||||||
super.onStopped();
|
super.onStopped();
|
||||||
videoSink.onStopped();
|
videoSink.stopRendering();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,11 +40,11 @@ public class BufferingVideoSinkTest {
|
|||||||
VideoSink videoSinkMock = mock(VideoSink.class);
|
VideoSink videoSinkMock = mock(VideoSink.class);
|
||||||
|
|
||||||
bufferingVideoSink.setVideoSink(videoSinkMock);
|
bufferingVideoSink.setVideoSink(videoSinkMock);
|
||||||
bufferingVideoSink.onStarted();
|
bufferingVideoSink.startRendering();
|
||||||
bufferingVideoSink.flush(/* resetPosition= */ true);
|
bufferingVideoSink.flush(/* resetPosition= */ true);
|
||||||
|
|
||||||
InOrder inOrder = Mockito.inOrder(videoSinkMock);
|
InOrder inOrder = Mockito.inOrder(videoSinkMock);
|
||||||
inOrder.verify(videoSinkMock).onStarted();
|
inOrder.verify(videoSinkMock).startRendering();
|
||||||
inOrder.verify(videoSinkMock).flush(/* resetPosition= */ true);
|
inOrder.verify(videoSinkMock).flush(/* resetPosition= */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,12 +52,12 @@ public class BufferingVideoSinkTest {
|
|||||||
public void setVideoSink_executesPendingOperations() {
|
public void setVideoSink_executesPendingOperations() {
|
||||||
BufferingVideoSink bufferingVideoSink = new BufferingVideoSink(context);
|
BufferingVideoSink bufferingVideoSink = new BufferingVideoSink(context);
|
||||||
VideoSink videoSinkMock = mock(VideoSink.class);
|
VideoSink videoSinkMock = mock(VideoSink.class);
|
||||||
bufferingVideoSink.onStarted();
|
bufferingVideoSink.startRendering();
|
||||||
bufferingVideoSink.flush(/* resetPosition= */ true);
|
bufferingVideoSink.flush(/* resetPosition= */ true);
|
||||||
bufferingVideoSink.setVideoSink(videoSinkMock);
|
bufferingVideoSink.setVideoSink(videoSinkMock);
|
||||||
|
|
||||||
InOrder inOrder = Mockito.inOrder(videoSinkMock);
|
InOrder inOrder = Mockito.inOrder(videoSinkMock);
|
||||||
inOrder.verify(videoSinkMock).onStarted();
|
inOrder.verify(videoSinkMock).startRendering();
|
||||||
inOrder.verify(videoSinkMock).flush(/* resetPosition= */ true);
|
inOrder.verify(videoSinkMock).flush(/* resetPosition= */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,10 +68,10 @@ public class BufferingVideoSinkTest {
|
|||||||
bufferingVideoSink.setVideoSink(videoSinkMock);
|
bufferingVideoSink.setVideoSink(videoSinkMock);
|
||||||
|
|
||||||
bufferingVideoSink.setVideoSink(null);
|
bufferingVideoSink.setVideoSink(null);
|
||||||
bufferingVideoSink.onStarted();
|
bufferingVideoSink.startRendering();
|
||||||
bufferingVideoSink.flush(/* resetPosition= */ true);
|
bufferingVideoSink.flush(/* resetPosition= */ true);
|
||||||
|
|
||||||
verify(videoSinkMock, never()).onStarted();
|
verify(videoSinkMock, never()).startRendering();
|
||||||
verify(videoSinkMock, never()).flush(/* resetPosition= */ true);
|
verify(videoSinkMock, never()).flush(/* resetPosition= */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,12 +80,12 @@ public class BufferingVideoSinkTest {
|
|||||||
BufferingVideoSink bufferingVideoSink = new BufferingVideoSink(context);
|
BufferingVideoSink bufferingVideoSink = new BufferingVideoSink(context);
|
||||||
VideoSink videoSinkMock = mock(VideoSink.class);
|
VideoSink videoSinkMock = mock(VideoSink.class);
|
||||||
|
|
||||||
bufferingVideoSink.onStarted();
|
bufferingVideoSink.startRendering();
|
||||||
bufferingVideoSink.flush(/* resetPosition= */ true);
|
bufferingVideoSink.flush(/* resetPosition= */ true);
|
||||||
bufferingVideoSink.clearPendingOperations();
|
bufferingVideoSink.clearPendingOperations();
|
||||||
bufferingVideoSink.setVideoSink(videoSinkMock);
|
bufferingVideoSink.setVideoSink(videoSinkMock);
|
||||||
|
|
||||||
verify(videoSinkMock, never()).onStarted();
|
verify(videoSinkMock, never()).startRendering();
|
||||||
verify(videoSinkMock, never()).flush(/* resetPosition= */ true);
|
verify(videoSinkMock, never()).flush(/* resetPosition= */ true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user