summaryrefslogtreecommitdiffstats
path: root/audio/out/ao.c
diff options
context:
space:
mode:
Diffstat (limited to 'audio/out/ao.c')
-rw-r--r--audio/out/ao.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/audio/out/ao.c b/audio/out/ao.c
index e7af02276f..817aa29399 100644
--- a/audio/out/ao.c
+++ b/audio/out/ao.c
@@ -402,6 +402,7 @@ void ao_reset(struct ao *ao)
{
if (ao->api->reset)
ao->api->reset(ao);
+ atomic_fetch_and(&ao->events_, ~(unsigned int)AO_EVENT_UNDERRUN);
}
// Pause playback. Keep the current buffer. ao_get_delay() must return the
@@ -457,6 +458,14 @@ void ao_hotplug_event(struct ao *ao)
ao_add_events(ao, AO_EVENT_HOTPLUG);
}
+void ao_underrun_event(struct ao *ao)
+{
+ // Racy check, but it's just for the message.
+ if (!(atomic_load(&ao->events_) & AO_EVENT_UNDERRUN))
+ MP_WARN(ao, "Device underrun detected.\n");
+ ao_add_events(ao, AO_EVENT_UNDERRUN);
+}
+
bool ao_chmap_sel_adjust(struct ao *ao, const struct mp_chmap_sel *s,
struct mp_chmap *map)
{
@@ -517,6 +526,11 @@ const char *ao_get_description(struct ao *ao)
return ao->driver->description;
}
+bool ao_get_reports_underruns(struct ao *ao)
+{
+ return ao->driver->reports_underruns;
+}
+
bool ao_untimed(struct ao *ao)
{
return ao->untimed;