> mpv crashes after seeking forward(->) any .opus file on obsd current
Yes, any seek crashes mpv and mplayer. It's a bug in ffmpeg's seek code
in libavformat and the trace always looks the same:
#0 ff_seek_frame_binary (s=0xfa08e08a800, stream_index=0, target_ts=<optimized
out>, flags=1)
at src/libavformat/utils.c:2190
#1 0x00000fa126e2475c in ogg_read_seek (s=0xfa08e08a800, stream_index=0,
timestamp=303408,
flags=1) at src/libavformat/oggdec.c:954
#2 0x00000fa126e8c942 in seek_frame_internal (s=0xfa08e08a800, stream_index=0,
timestamp=303408,
flags=1) at src/libavformat/utils.c:2472
#3 av_seek_frame (s=0xfa08e08a800, stream_index=<optimized out>,
timestamp=<optimized out>,
flags=1) at src/libavformat/utils.c:2504
It's been present since the switch to llvm 16, presumably some more
aggressive optimization around undefined behavior. I haven't spotted
the precise issue, but the below diff works around the crash:
Index: Makefile
===================================================================
RCS file: /cvs/ports/graphics/ffmpeg/Makefile,v
diff -u -p -r1.236 Makefile
--- Makefile 26 Sep 2023 11:39:03 -0000 1.236
+++ Makefile 17 Dec 2023 15:28:16 -0000
@@ -3,7 +3,7 @@ COMMENT= audio/video converter and strea
V= 4.4.4
DISTNAME= ffmpeg-${V}
EPOCH= 1
-REVISION= 2
+REVISION= 3
CATEGORIES= graphics multimedia
SITES= https://ffmpeg.org/releases/
EXTRACT_SUFX= .tar.xz
Index: patches/patch-libavformat_utils_c
===================================================================
RCS file: patches/patch-libavformat_utils_c
diff -N patches/patch-libavformat_utils_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-libavformat_utils_c 17 Dec 2023 14:45:35 -0000
@@ -0,0 +1,11 @@
+Index: libavformat/utils.c
+--- libavformat/utils.c.orig
++++ libavformat/utils.c
+@@ -2142,6 +2142,7 @@ static int64_t ff_read_timestamp(AVFormatContext *s, i
+ return ts;
+ }
+
++__attribute__((optnone))
+ int ff_seek_frame_binary(AVFormatContext *s, int stream_index,
+ int64_t target_ts, int flags)
+ {