[vlc-devel] [PATCH 2/3] android/audio: add support for stream drain
Thomas Guillem
thomas at gllm.fr
Thu Dec 3 18:16:03 CET 2020
---
modules/audio_output/android/device.c | 16 ++++++++++++++++
modules/audio_output/android/device.h | 1 +
2 files changed, 17 insertions(+)
diff --git a/modules/audio_output/android/device.c b/modules/audio_output/android/device.c
index df4b4bc0dbc..969d7bb6e50 100644
--- a/modules/audio_output/android/device.c
+++ b/modules/audio_output/android/device.c
@@ -157,6 +157,21 @@ Flush(audio_output_t *aout)
sys->stream->flush(sys->stream);
}
+
+static void
+Drain(audio_output_t *aout)
+{
+ struct sys *sys = aout->sys;
+ assert(sys->stream != NULL);
+
+ if (sys->stream->drain != NULL)
+ sys->stream->drain(sys->stream);
+ else
+ {
+ vlc_tick_t delay;
+ if (aout_TimeGet(aout, &delay) == 0)
+ vlc_tick_sleep(delay);
+ }
}
static int
@@ -265,6 +280,7 @@ Open(vlc_object_t *obj)
aout->play = Play;
aout->pause = Pause;
aout->flush = Flush;
+ aout->drain = Drain;
aout->time_get = TimeGet;
aout->device_select = DeviceSelect;
aout->volume_set = VolumeSet;
diff --git a/modules/audio_output/android/device.h b/modules/audio_output/android/device.h
index abcff255f6e..4b315368e62 100644
--- a/modules/audio_output/android/device.h
+++ b/modules/audio_output/android/device.h
@@ -60,6 +60,7 @@ struct aout_stream
void (*play)(aout_stream_t *, block_t *, vlc_tick_t);
void (*pause)(aout_stream_t *, bool, vlc_tick_t);
void (*flush)(aout_stream_t *);
+ void (*drain)(aout_stream_t *);
void (*volume_set)(aout_stream_t *, float volume);
void (*mute_set)(aout_stream_t *, bool mute);
--
2.28.0
More information about the vlc-devel
mailing list