From 7a2434aef7455972aabf83dba8303b529e839cf0 Mon Sep 17 00:00:00 2001 From: James Laird Date: Wed, 3 Apr 2013 21:54:58 +1100 Subject: [PATCH] player: talk about established buffer fill preference --- player.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/player.c b/player.c index 5b0bd6d9..b22c458b 100644 --- a/player.c +++ b/player.c @@ -302,10 +302,20 @@ static void bf_est_reset(short fill) { } static void bf_est_update(short fill) { + // the rate-matching system needs to decide how full to keep the buffer. + // the initial fill is present when the system starts to output samples, + // but most output chains will instantly gobble their own buffer's worth of + // data. we average for a while to decide where to draw the line. if (fill_count < 1000) { desired_fill += (double)fill/1000.0; fill_count++; return; + } else if (fill_count == 1000) { + // this information could be used to help estimate our effective latency? + debug(1, "established desired fill of %f frames, " + "so output chain buffered about %f frames\n", desired_fill, + config.buffer_start_fill - desired_fill); + fill_count++; } #define CONTROL_A (1e-4)