mirror of
https://github.com/androidx/media.git
synced 2025-05-17 12:39:52 +08:00
Clarify offload stream event callback impl
#exo-offload PiperOrigin-RevId: 333532900
This commit is contained in:
parent
55a13d8871
commit
56cb327f1e
@ -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();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user