mpv/common
wm4 f7678575a5 recorder: always mux all packets on discont/close
This is the muxer used by all 3 stream recording features (why are there
so many?). It tried hard to avoid writing broken files. In particular,
it buffered packets until it new there was a keyframe packet (which, in
mpv's/FFmpeg's definition, mean seek points from which decoding can
resume), or final EOF. The danger that was probably considered here was
that due to video frame reordering, not muxing some trailing, missing
packets of a keyframe range could lead to broken decoding or skipped
frames, so better discard packets belonging to an incomplete range.
Sounds like a good idea so far.

Unfortunately, this will drop an entire keyframe range even if the
current packet run is complete and mp_recorder_mark_discontinuity() is
called, simply because recorder.c can not know that the next packet
would have been a keyframe.

It seems better to mux all packets to avoid losing valid data, even if
it means that sometimes packets/frames will be missing from the file. It
benefits especially the dump-cache command, which will call the function
to signal a discontinuity after every range. Before this commit, it
discarded the last packets, even if they were perfectly fine.

(An alternative solution for dump-cache would have been a second
discontinuity marker function, that communicates that the current packet
range is complete. But this commit's solution is simpler and overall
more robust, at the danger of producing more semi-broken files.)

This may make some of the complex buffering/waiting logic in recorder.c
pointless.

Untested (in this final form).
2019-09-19 20:37:05 +02:00
..
av_common.c demux: use no overlapping packets for lossless audio 2019-09-19 20:37:04 +02:00
av_common.h demux: use no overlapping packets for lossless audio 2019-09-19 20:37:04 +02:00
av_log.c
av_log.h
codecs.c codecs: remove unused family field 2018-02-01 10:21:55 +01:00
codecs.h
common.c common: add missing %f time format 2018-05-01 00:25:27 +03:00
common.h common: add macro for checking whether a value is a power of two 2019-09-19 20:37:05 +02:00
encode.h encode: get rid of the output packet queue 2018-05-03 01:08:44 +03:00
encode_lavc.c encode: set sample_aspect_ratio on AVStream struct 2019-08-14 21:54:44 +02:00
encode_lavc.h encode: get rid of the output packet queue 2018-05-03 01:08:44 +03:00
global.h player: get rid of mpv_global.opts 2018-05-24 19:56:35 +02:00
msg.c msg: remove unnecessary condition 2019-09-19 20:37:05 +02:00
msg.h vo_gpu: vulkan: use libplacebo instead 2019-04-21 23:55:22 +03:00
msg_control.h player: get rid of mpv_global.opts 2018-05-24 19:56:35 +02:00
playlist.c demux: get rid of free_demuxer[_and_stream]() 2018-05-24 19:56:35 +02:00
playlist.h command: make loadlist command async and abortable 2018-05-24 19:56:35 +02:00
recorder.c recorder: always mux all packets on discont/close 2019-09-19 20:37:05 +02:00
recorder.h
tags.c demux: support for some kinds of timed metadata 2018-04-18 01:17:42 +03:00
tags.h demux: support for some kinds of timed metadata 2018-04-18 01:17:42 +03:00
version.c