From c84ec021287d72d122071d5c211f9bfbeb13a3fe Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 11 Oct 2019 19:25:45 +0200 Subject: ao: add API for underrun reporting AOs can now call ao_underrun_event() (in any context) if an underrun has happened. It will print a message. This will be used in the following commits. But for now, audio.c only clears the underrun bit, so that subsequent underruns still print the warning message. Since the underrun flag will be used in fragile ways by the playback state machine, there is the "reports_underruns" field that signals strong support for underrun reporting. (Otherwise, underrun events will not be used by it.) --- player/audio.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'player') diff --git a/player/audio.c b/player/audio.c index e93f6b49a9..20f80256b2 100644 --- a/player/audio.c +++ b/player/audio.c @@ -855,6 +855,8 @@ void fill_audio_out_buffers(struct MPContext *mpctx) int playsize = ao_get_space(mpctx->ao); + ao_query_and_reset_events(mpctx->ao, AO_EVENT_UNDERRUN); + int skip = 0; bool sync_known = get_sync_samples(mpctx, &skip); if (skip > 0) { -- cgit v1.2.3