From 390772b58f180c3e74f370bdfc7521de1d6822b4 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 5 Jan 2019 08:52:41 +0100 Subject: demux_timeline: report network speed of slave connections demux_timeline doesn't do any transport accesses itself. The slave demuxers do this (these will actually access the stream layer and perform e.g. network accesses). As a consequence, demux_timeline always reported 0 bytes read, and network speed display didn't work. Fix this by awkwardly reporting the amount of read bytes upwards. This is not very nice, and requires explicit calls whenever the slave "might" have read data. Due to the way the reporting is done, it only works if the slaves do not run demuxer threads, which makes things even less nice. (Fortunately they don't anyway, because it would be a waste of resources.) Some identifiers contain the word "hack" as a warning. Some of the stupidity comes from the fact that demux.c itself resets the stats randomly in order to calculate the bytes_per_second value, which is useless for a slave, but of course is still done, because demux.c itself is not aware of whether it's on the slave or top-level layer. Unfortunately, this must do. In theory, the demuxer thread/cache layer should be separated from demuxer implementations. This would get rid of all the awkwardness and nonsense. For example, the only threading involved would be the caching layer, completely separate from demuxers themselves. It'd be the only thing calculates speed rates for the player frontend, too (instead of doing it for each demuxer, even if unused). --- demux/demux.h | 1 + 1 file changed, 1 insertion(+) (limited to 'demux/demux.h') diff --git a/demux/demux.h b/demux/demux.h index 09f6895544..65566ea509 100644 --- a/demux/demux.h +++ b/demux/demux.h @@ -292,6 +292,7 @@ void demux_disable_cache(demuxer_t *demuxer); bool demux_is_network_cached(demuxer_t *demuxer); void demux_report_unbuffered_read_bytes(struct demuxer *demuxer, int64_t new); +int64_t demux_get_bytes_read_hack(struct demuxer *demuxer); struct sh_stream *demuxer_stream_by_demuxer_id(struct demuxer *d, enum stream_type t, int id); -- cgit v1.2.3