Commit 56cb327f by krocard Committed by kim-vde

Clarify offload stream event callback impl

#exo-offload

PiperOrigin-RevId: 333532900
parent 55a13d88
...@@ -1707,17 +1707,19 @@ public final class DefaultAudioSink implements AudioSink { ...@@ -1707,17 +1707,19 @@ public final class DefaultAudioSink implements AudioSink {
@Override @Override
public void onDataRequest(AudioTrack track, int size) { public void onDataRequest(AudioTrack track, int size) {
Assertions.checkState(track == DefaultAudioSink.this.audioTrack); Assertions.checkState(track == audioTrack);
if (listener != null) { if (listener != null && playing) {
// Do not signal that the buffer is emptying if not playing as it is a transient state.
listener.onOffloadBufferEmptying(); listener.onOffloadBufferEmptying();
} }
} }
@Override @Override
public void onTearDown(@NonNull AudioTrack track) { public void onTearDown(@NonNull AudioTrack track) {
Assertions.checkState(track == audioTrack);
if (listener != null && playing) { if (listener != null && playing) {
// A new Audio Track needs to be created and it's buffer filled, which will be done on the // The audio track was destroyed while in use. Thus a new AudioTrack needs to be created
// next handleBuffer call. // and its buffer filled, which will be done on the next handleBuffer call.
// Request this call explicitly in case ExoPlayer is sleeping waiting for a data request. // Request this call explicitly in case ExoPlayer is sleeping waiting for a data request.
listener.onOffloadBufferEmptying(); listener.onOffloadBufferEmptying();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment