0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00
mpv/demux
wm4 17da9071a4 demux: add a on-disk cache
Somewhat similar to the old --cache-file, except for the demuxer cache.
Instead of keeping packet data in memory, it's written to disk and read
back when needed.

The idea is to reduce main memory usage, while allowing fast seeking in
large cached network streams (especially live streams). Keeping the
packet metadata on disk would be rather hard (would use mmap or so, or
rewrite the entire demux.c packet queue handling), and since it's
relatively small, just keep it in memory.

Also for simplicity, the disk cache is append-only. If you're watching
really long livestreams, and need pruning, you're probably out of luck.
This still could be improved by trying to free unused blocks with
fallocate(), but since we're writing multiple streams in an interleaved
manner, this is slightly hard.

Some rather gross ugliness in packet.h: we want to store the file
position of the cached data somewhere, but on 32 bit architectures, we
don't have any usable 64 bit members for this, just the buf/len fields,
which add up to 64 bit - so the shitty union aliases this memory.

Error paths untested. Side data (the complicated part of trying to
serialize ffmpeg packets) untested.

Stream recording had to be adjusted. Some minor details change due to
this, but probably nothing important.

The change in attempt_range_joining() is because packets in cache
have no valid len field. It was a useful check (heuristically
finding broken cases), but not a necessary one.

Various other approaches were tried. It would be interesting to list
them and to mention the pros and cons, but I don't feel like it.
2019-09-19 20:37:05 +02:00
..
cache.c demux: add a on-disk cache 2019-09-19 20:37:05 +02:00
cache.h demux: add a on-disk cache 2019-09-19 20:37:05 +02:00
codec_tags.c codec_tags: fix wrong buffer size 2019-07-03 17:47:24 +03:00
codec_tags.h Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
cue.c demux: support cue sheets longer than 100 minutes 2019-04-01 23:39:08 +02:00
cue.h Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
demux_cue.c demux_edl, cue, mkv: slightly nicer file format indication 2019-09-19 20:37:04 +02:00
demux_edl.c demux_edl: fix assertion failure on exit in obscure ytdl cases 2019-09-19 20:37:04 +02:00
demux_lavf.c demux: redo timed metadata 2019-09-19 20:37:05 +02:00
demux_libarchive.c demux: change hack for closing subtitle files early 2019-09-19 20:37:04 +02:00
demux_mf.c demux: return packets directly from demuxer instead of using sh_stream 2019-09-19 20:37:04 +02:00
demux_mkv_timeline.c demux_edl, cue, mkv: slightly nicer file format indication 2019-09-19 20:37:04 +02:00
demux_mkv.c demux_mkv: don't set keyframe flag for timestamp-less audio frames 2019-09-19 20:37:05 +02:00
demux_null.c demux_null: mark as seekable 2018-01-06 14:42:22 -08:00
demux_playlist.c demux: change hack for closing subtitle files early 2019-09-19 20:37:04 +02:00
demux_raw.c demux_raw: fix operation with demuxer cache and backward playback 2019-09-19 20:37:04 +02:00
demux_timeline.c demux: refactor cache range init/deinit 2019-09-19 20:37:05 +02:00
demux.c demux: add a on-disk cache 2019-09-19 20:37:05 +02:00
demux.h demux: add a on-disk cache 2019-09-19 20:37:05 +02:00
ebml.c demux_mkv: adjust log verbosity levels 2018-04-29 02:21:32 +03:00
ebml.h demux_mkv: rewrite packet reading to avoid 1 memcpy() 2017-11-05 18:13:34 +01:00
matroska.h ebml, matroska.h: change license to LGPL 2017-04-21 13:34:10 +02:00
packet.c demux: add a on-disk cache 2019-09-19 20:37:05 +02:00
packet.h demux: add a on-disk cache 2019-09-19 20:37:05 +02:00
stheader.h demux, demux_mkv: fix seeking in cache with large codec delay 2019-09-19 20:37:04 +02:00
timeline.c demux_edl, cue, mkv: slightly nicer file format indication 2019-09-19 20:37:04 +02:00
timeline.h demux_edl, cue, mkv: slightly nicer file format indication 2019-09-19 20:37:04 +02:00