From 8db9206c54cb2208178e23e21961545741810a9f Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 19 Apr 2016 22:01:30 +0200 Subject: player: simplify an aspect of buffering determination Calculate the buffering percentage in the same code which determines whether the player is or should be buffering. In particular it can't happen that percentage and buffering state are slightly out of sync due to calling DEMUXER_CTRL_GET_READER_STATE and reusing it with the previously determined buffering state. Now it's also easier to guarantee that the buffering state is updated properly. Add some more verbose output as well. (Damn I hate this code, why did I write it?) --- player/command.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index cdadafa892..bfdcb820d3 100644 --- a/player/command.c +++ b/player/command.c @@ -1518,10 +1518,10 @@ static int mp_property_cache_buffering(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - double state = get_cache_buffering_percentage(mpctx); + int state = get_cache_buffering_percentage(mpctx); if (state < 0) return M_PROPERTY_UNAVAILABLE; - return m_property_int_ro(action, arg, state * 100); + return m_property_int_ro(action, arg, state); } static int mp_property_clock(void *ctx, struct m_property *prop, -- cgit v1.2.3