summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-04-12 02:22:23 +0200
committerwm4 <wm4@nowhere>2013-04-20 23:28:22 +0200
commitb3d12c3d54b6a0b81db8a9c89f9435a9fbfaa7d9 (patch)
tree9a7d897f53bf380f4d2b76ca82533870283d2006 /stream
parent9b4d15af18b34c8e1cf80b85ec73aace0486fbac (diff)
downloadmpv-b3d12c3d54b6a0b81db8a9c89f9435a9fbfaa7d9.tar.bz2
mpv-b3d12c3d54b6a0b81db8a9c89f9435a9fbfaa7d9.tar.xz
demux_mkv: fix seeking with index generation
Relative seeks backwards didn't work too well with incomplete files, or other files that are missing the seek index. The problem was that the on-the-fly seek index generation simply added cluster positions as seek entries. While this is perfectly fine, the seek code had no information about the location of video key frames. For example, a 5 second long cluster can have only 1 video key frame, which is located 4 seconds into the cluster. Seeking backwards by one second while still located in the same cluster would select this cluster as seek target again. Decoding would resume with the key frame, giving the impression that seeking is "stuck" at this frame. Make the generated index aware of key frame and track information, so that video can always be seeked in an idea way. This also uses the normal block parsing code for indexing the clusters, instead of the suspicious looking special code. (This code didn't parse the Matroska elements correctly, but was fine for files with normal structure. Files with corrupted clusters or clusters formatted for streaming were not handled properly.) Skipping is now quite a bit slower (takes about twice as long as before), but it removes the special cased skipping code, and it's still much faster (at least twice as fast) than libavformat. It needs to do more I/O (no more skipping entire clusters, all data is read), and has more CPU usage (more data needs to be parsed).
Diffstat (limited to 'stream')
0 files changed, 0 insertions, 0 deletions