mirror of
https://github.com/mpv-player/mpv
synced 2025-03-20 10:17:31 +00:00
demux_lavf: disable support for byte-based seeking
libavformat returns nonsense per-stream bitrate values for some MPEG files (0 or many times higher than the overall bitrate of the file), which triggered the heuristic to enable byte-based seeking in demux_lavf and then made the byte-based seeks wildly inaccurate. Disable the support for byte-based seeks. This will avoid problems with files that have consistent timestamps, but on the other hand will completely break seeking in MPEG files that have timestamp resets. I'll probably add at least an option to manually enable byte-based seeking later.
This commit is contained in:
parent
d4b5ee2cd5
commit
511498818f
@ -615,6 +615,9 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
|
||||
demuxer->video->id=-2; // audio-only
|
||||
} //else if (best_video > 0 && demuxer->video->id == -1) demuxer->video->id = best_video;
|
||||
|
||||
// disabled because unreliable per-stream bitrate values returned
|
||||
// by libavformat trigger this heuristic incorrectly and break things
|
||||
#if 0
|
||||
/* libavformat sets bitrate for mpeg based on pts at start and end
|
||||
* of file, which fails for files with pts resets. So calculate our
|
||||
* own bitrate estimate. */
|
||||
@ -630,6 +633,7 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
|
||||
if (!priv->bitrate)
|
||||
priv->bitrate = 1440000;
|
||||
}
|
||||
#endif
|
||||
demuxer->accurate_seek = !priv->seek_by_bytes;
|
||||
|
||||
return demuxer;
|
||||
|
Loading…
Reference in New Issue
Block a user