From 559a400ac36e75a8d73ba263fd7fa6736df1c2da Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 31 Aug 2018 12:48:36 +0200 Subject: demux, stream: rip out the classic stream cache The demuxer cache is the only cache now. Might need another change to combat seeking failures in mp4 etc. The only bad thing is the loss of cache-speed, which was sort of nice to have. --- player/osd.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'player/osd.c') diff --git a/player/osd.c b/player/osd.c index 9faf6eb6a5..7d24c01619 100644 --- a/player/osd.c +++ b/player/osd.c @@ -229,27 +229,23 @@ static char *get_term_status_msg(struct MPContext *mpctx) } } - if (mpctx->demuxer) { - struct stream_cache_info info = {0}; - demux_stream_control(mpctx->demuxer, STREAM_CTRL_GET_CACHE_INFO, &info); - if (info.size > 0 || mpctx->demuxer->is_network) { - saddf(&line, " Cache: "); + if (mpctx->demuxer && demux_is_network_cached(mpctx->demuxer)) { + saddf(&line, " Cache: "); - struct demux_ctrl_reader_state s = {.ts_duration = -1}; - demux_control(mpctx->demuxer, DEMUXER_CTRL_GET_READER_STATE, &s); + struct demux_ctrl_reader_state s = {.ts_duration = -1}; + demux_control(mpctx->demuxer, DEMUXER_CTRL_GET_READER_STATE, &s); - if (s.ts_duration < 0) { - saddf(&line, "???"); + if (s.ts_duration < 0) { + saddf(&line, "???"); + } else { + saddf(&line, "%2ds", (int)s.ts_duration); + } + int64_t cache_size = s.fw_bytes; + if (cache_size > 0) { + if (cache_size >= 1024 * 1024) { + saddf(&line, "+%lldMB", (long long)(cache_size / 1024 / 1024)); } else { - saddf(&line, "%2ds", (int)s.ts_duration); - } - int64_t cache_size = s.fw_bytes + info.fill; - if (cache_size > 0) { - if (cache_size >= 1024 * 1024) { - saddf(&line, "+%lldMB", (long long)(cache_size / 1024 / 1024)); - } else { - saddf(&line, "+%lldKB", (long long)(cache_size / 1024)); - } + saddf(&line, "+%lldKB", (long long)(cache_size / 1024)); } } } -- cgit v1.2.3