Propagate sourceEnded to AudioGraphInputAudioSink

PiperOrigin-RevId: 702076933
This commit is contained in:
claincly 2024-12-02 13:56:44 -08:00 committed by Copybara-Service
parent 8908d82cac
commit ecdf7c5df7
2 changed files with 7 additions and 4 deletions

View file

@ -73,8 +73,11 @@ import java.util.Objects;
/**
* Returns the position (in microseconds) that should be {@linkplain
* AudioSink#getCurrentPositionUs returned} by this sink.
*
* @param sourceEnded Specify {@code true} if no more input buffers will be provided.
* @return The playback position relative to the start of playback, in microseconds.
*/
long getCurrentPositionUs();
long getCurrentPositionUs(boolean sourceEnded);
/** Returns whether the controller is ended. */
boolean isEnded();
@ -216,7 +219,7 @@ import java.util.Objects;
@Override
public long getCurrentPositionUs(boolean sourceEnded) {
long currentPositionUs = controller.getCurrentPositionUs();
long currentPositionUs = controller.getCurrentPositionUs(sourceEnded);
if (currentPositionUs != CURRENT_POSITION_NOT_SET) {
// Reset the position to the one expected by the player.
currentPositionUs -= offsetToCompositionTimeUs;

View file

@ -188,8 +188,8 @@ import java.util.Objects;
}
@Override
public long getCurrentPositionUs() {
return finalAudioSink.getCurrentPositionUs(/* sourceEnded= */ false);
public long getCurrentPositionUs(boolean sourceEnded) {
return finalAudioSink.getCurrentPositionUs(sourceEnded);
}
@Override