summaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-06-02 02:14:54 +0200
committerwm4 <wm4@nowhere>2019-09-19 20:37:05 +0200
commitf439064e7f142c9503b2a7f99c7da0e49eaab660 (patch)
tree66db1311f1039f0875b37199eba3cb370eaae4f5 /ci
parente62afe405510028d71e16c2db92c94063d23a3ba (diff)
downloadmpv-f439064e7f142c9503b2a7f99c7da0e49eaab660.tar.bz2
mpv-f439064e7f142c9503b2a7f99c7da0e49eaab660.tar.xz
demux: demux multiple audio frames in backward playback
Until now, this usually passed a single audio frame to the decoder, and then did a backstep operation (cache seek + frame search) again. This is probably not very efficient, especially considering it has to search the packet queue from the "start" every time again. Also, with most audio codecs, an additional "preroll" frame was passed first. In these cases, the preroll frame would make up 50% of audio decoding time. Also not very efficient. Attempt to fix this by returning multiple frames at once. This reduces the number of backstep operations and the ratio the preoll frames. In theory, this should help efficiency. I didn't test it though, why would I do this? It's just a pain. Set it to unscientific 10 frames. (Actually, these are 10 keyframes, so it's much more for codecs like TrueHD. But I don't care about TrueHD.) This commit changes some other implementation details. Since we can return more than 1 non-preroll keyframe to the decoder, some new state is needed to remember how much. The resume packet search is adjusted to find N ("total") keyframe packets in general, not just preroll frames. I'm removing the special case for 1 preroll packet; audio used this, but doesn't anymore, and it's premature optimization anyway. Expose the new mechanism with 2 new options. They're almost completely pointless, since nobody will try them, and if they do, they won't understand what these options truly do. And if they actually do, they most likely would be capable of editing the source code, and we could just hardcode the parameters. Just so you know that I know that the added options are pointless. The following two things are truly unrelated to this commit, and more like general refactoring, but fortunately nobody can stop me. Don't set back_seek_pos in dequeue_packet() anymore. This was sort of pointless, since it was set in find_backward_restart_pos() anyway (using some of the same packets). The latter function tries to restrict this to the first keyframe range though, which is an optimization that in theory might break with broken files (duh), but in these cases a lot of other things would be broken anyway. Don't set back_restart_* in dequeue_packet(). I think this is an artifact of the old restart code (cf. ad9e473c555). It can be done directly in find_backward_restart_pos() now. Although this adds another shitty packet search loop, I prefer this, because clearer what's actually happening.
Diffstat (limited to 'ci')
0 files changed, 0 insertions, 0 deletions