1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-21 07:16:56 +00:00
mpv/stream
wm4 f37f4de849 stream: turn into a ring buffer, make size configurable
In some corner cases (see #6802), it can be beneficial to use a larger
stream buffer size. Use this as argument to rewrite everything for no
reason.

Turn stream.c itself into a ring buffer, with configurable size. The
latter would have been easily achievable with minimal changes, and the
ring buffer is the hard part. There is no reason to have a ring buffer
at all, except possibly if ffmpeg don't fix their awful mp4 demuxer, and
some subtle issues with demux_mkv.c wanting to seek back by small
offsets (the latter was handled with small stream_peek() calls, which
are unneeded now).

In addition, this turns small forward seeks into reads (where data is
simply skipped). Before this commit, only stream_skip() did this (which
also mean that stream_skip() simply calls stream_seek() now).

Replace all stream_peek() calls with something else (usually
stream_read_peek()). The function was a problem, because it returned a
pointer to the internal buffer, which is now a ring buffer with
wrapping. The new function just copies the data into a buffer, and in
some cases requires callers to dynamically allocate memory. (The most
common case, demux_lavf.c, required a separate buffer allocation anyway
due to FFmpeg "idiosyncrasies".) This is the bulk of the demuxer_*
changes.

I'm not happy with this. There still isn't a good reason why there
should be a ring buffer, that is complex, and most of the time just
wastes half of the available memory. Maybe another rewrite soon.

It also contains bugs; you're an alpha tester now.
2019-11-06 21:36:02 +01:00
..
cookies.c cookies: change license to LGPL 2017-05-11 07:29:01 +02:00
cookies.h cookies: change license to LGPL 2017-05-11 07:29:01 +02:00
dvb_tune.c dvb: Add multiple frontends support: MAX_FRONTENDS now 8. 2017-12-16 23:24:55 -08:00
dvb_tune.h dvb: Add multiple frontends support: MAX_FRONTENDS now 8. 2017-12-16 23:24:55 -08:00
dvbin.h stream_dvb: Remove now replaced stream-control code for good. 2019-10-02 01:25:45 +02:00
stream_avdevice.c demux, stream: rip out the classic stream cache 2018-08-31 12:55:22 +02:00
stream_bluray.c demux: restore some of the DVD/BD/CDDA interaction layers 2019-10-03 00:22:18 +02:00
stream_cb.c stream_cb: add cancel_fn callback 2019-09-27 13:00:45 -07:00
stream_cdda.c demux: restore some of the DVD/BD/CDDA interaction layers 2019-10-03 00:22:18 +02:00
stream_concat.c stream: rearrange open functions 2019-09-29 00:46:54 +02:00
stream_dvb.c stream_dvb: Remove now replaced stream-control code for good. 2019-10-02 01:25:45 +02:00
stream_dvdnav.c demux: restore some of the DVD/BD/CDDA interaction layers 2019-10-03 00:22:18 +02:00
stream_edl.c demux, stream: rip out the classic stream cache 2018-08-31 12:55:22 +02:00
stream_file.c stream_file: remove unnecessary short write logic 2019-09-14 13:00:10 +02:00
stream_lavf.c stream_lavf: add support for gopher 2019-09-29 14:27:00 +02:00
stream_libarchive.c stream_libarchive: Always use LC_CTYPE_MASK for libarchive 2019-09-21 12:53:47 +02:00
stream_libarchive.h stream_libarchive: Fix locale includes on macOS 2017-12-03 21:54:12 +01:00
stream_memory.c stream_memory: remove trivial ffmpeg dependency 2019-10-31 11:06:44 +01:00
stream_mf.c demux, stream: rip out the classic stream cache 2018-08-31 12:55:22 +02:00
stream_null.c stream_null: change license to LGPL 2017-05-08 12:45:50 +02:00
stream_smb.c stream_smb: remove unnecessary short write logic 2019-09-14 13:00:43 +02:00
stream.c stream: turn into a ring buffer, make size configurable 2019-11-06 21:36:02 +01:00
stream.h stream: turn into a ring buffer, make size configurable 2019-11-06 21:36:02 +01:00