Bug 239905

Summary: multimedia/mplayer: mkv seeking above 2GB broken with ffmpeg 4.2
Product: Ports & Packages Reporter: Christian Weisgerber <naddy>
Component: Individual Port(s)Assignee: Jan Beich <jbeich>
Status: Closed FIXED    
Severity: Affects Some People CC: jbeich, riggs
Priority: --- Flags: bugzilla: maintainer-feedback? (jbeich)
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://trac.ffmpeg.org/ticket/8084
Attachments:
Description Flags
avformat/matroskadec: Fix seeking none

Description Christian Weisgerber freebsd_committer freebsd_triage 2019-08-16 11:09:42 UTC
The update to FFmpeg 4.2 has introduced a regression in MPlayer. For (at least) the ubiquitous H.264 videos in MKV containers, seeking in MPlayer is broken, e.g. when jumping back and forth with the arrow keys. Effects are desynchronized faulty video and failure to seek. This appears to affect the parts of the video file beyond 2GB, seeking below is fine. MPlayer prints warnings like
[matroska,webm @ 0x801b86f40]Element at 0x81e78160 ending at 0x81ff3e32 exceeds containing master element ending at 0x7e2ea500

multimedia/mpv is not affected, so this appears to be a specific problem in MPlayer.

FreeBSD 12.0-STABLE r350672 GENERIC amd64
mplayer-1.4.0.20190706_2
ffmpeg-4.2_1,1
Compiled from ports with the default options.
Comment 1 Christian Weisgerber freebsd_committer freebsd_triage 2019-08-17 19:43:42 UTC
I was mistaken.  This is indeed a bug in multimedia/ffmpeg.

Brad Smith provided a fix on OpenBSD:

"matroska_reset_status (a function that is used during seeking (among other things)) used an int for the return value of avio_seek which returns an int64_t. Checking the return value then indicated an error even though the seek was successfull for targets in the range of 2GB-4GB, 6GB-8GB, ... This error implied that the status hasn't been reset and in particular, the old level was still considered to be in force, so that ebml_parse returned errors because the newly parsed elements were of course not contained in the previously active and still wrongly considered active master element any more."
Comment 2 Christian Weisgerber freebsd_committer freebsd_triage 2019-08-17 19:44:43 UTC
Created attachment 206641 [details]
avformat/matroskadec: Fix seeking

Fix by Brad Smith (originally  for OpenBSD).
Comment 3 commit-hook freebsd_committer freebsd_triage 2019-08-17 21:04:59 UTC
A commit references this bug:

Author: jbeich
Date: Sat Aug 17 21:04:33 UTC 2019
New revision: 509174
URL: https://svnweb.freebsd.org/changeset/ports/509174

Log:
  multimedia/ffmpeg: unbreak mkv seeking beyond 2gb after r508216

  PR:		239905
  Reported by:	naddy
  Obtained from:	upstream (release/4.2 branch)

Changes:
  head/multimedia/ffmpeg/Makefile
  head/multimedia/ffmpeg/files/patch-libavformat_matroskadec.c