public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/ffmpeg] rawhide: backport fix for backward seeking with openh264 (resolves rhbz#2547586)
@ 2026-10-30 22:21 Dominik 'Rathann' Mierzejewski
0 siblings, 0 replies; only message in thread
From: Dominik 'Rathann' Mierzejewski @ 2026-10-30 22:21 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/ffmpeg
Branch : rawhide
Commit : cf63d366b5dd1413ac8faae60bf7fbd58178324d
Author : Dominik 'Rathann' Mierzejewski <dominik@greysector.net>
Date : 2026-10-30T21:41:49+01:00
Stats : +86/-0 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/ffmpeg/c/cf63d366b5dd1413ac8faae60bf7fbd58178324d?branch=rawhide
Log:
backport fix for backward seeking with openh264 (resolves rhbz#2547586)
---
diff --git a/ffmpeg-openh264-flush-callback.patch b/ffmpeg-openh264-flush-callback.patch
new file mode 100644
index 0000000..41e18d6
--- /dev/null
+++ b/ffmpeg-openh264-flush-callback.patch
@@ -0,0 +1,82 @@
+From 883e8a6336b2651f7be79a6a9aa5f3cc22937948 Mon Sep 17 00:00:00 2001
+From: Scott Kidder <scott@kidder.io>
+Date: Wed, 20 May 2026 17:17:24 -0700
+Subject: [PATCH] avcodec/libopenh264dec: implement flush callback
+
+Cisco's ISVCDecoder retains DPB and reference state across
+avcodec_flush_buffers(), causing the next IDR to be accepted but
+subsequent P-frames to fail decode after a seek or loop. Cisco's
+API does not expose a non-destructive reset; tear down and rebuild
+the decoder via the existing close/init callbacks.
+
+The .flush callback is void and cannot report a re-init failure, so
+svc_decode_frame() guards against a NULL decoder left behind by a
+failed re-init. svc_decode_init() now also tears the decoder back
+down on an Initialize() failure so that path leaves the same clean
+NULL state the guard expects and does not leak the ISVCDecoder.
+
+Signed-off-by: Scott Kidder <scott@kidder.io>
+---
+ libavcodec/libopenh264dec.c | 23 ++++++++++++++++++++++-
+ 1 file changed, 22 insertions(+), 1 deletion(-)
+
+diff --git a/libavcodec/libopenh264dec.c b/libavcodec/libopenh264dec.c
+index b6a9bba2dc7..c9b24596534 100644
+--- a/libavcodec/libopenh264dec.c
++++ b/libavcodec/libopenh264dec.c
+@@ -42,12 +42,22 @@ static av_cold int svc_decode_close(AVCodecContext *avctx)
+ {
+ SVCContext *s = avctx->priv_data;
+
+- if (s->decoder)
++ if (s->decoder) {
+ WelsDestroyDecoder(s->decoder);
++ s->decoder = NULL;
++ }
+
+ return 0;
+ }
+
++static av_cold int svc_decode_init(AVCodecContext *avctx);
++
++static void svc_decode_flush(AVCodecContext *avctx)
++{
++ svc_decode_close(avctx);
++ svc_decode_init(avctx);
++}
++
+ static av_cold int svc_decode_init(AVCodecContext *avctx)
+ {
+ SVCContext *s = avctx->priv_data;
+@@ -75,6 +85,7 @@ static av_cold int svc_decode_init(AVCodecContext *avctx)
+
+ if ((*s->decoder)->Initialize(s->decoder, ¶m) != cmResultSuccess) {
+ av_log(avctx, AV_LOG_ERROR, "Initialize failed\n");
++ svc_decode_close(avctx);
+ return AVERROR_UNKNOWN;
+ }
+
+@@ -95,6 +106,15 @@ static int svc_decode_frame(AVCodecContext *avctx, AVFrame *avframe,
+ int opt;
+ #endif
+
++ /* svc_decode_flush() tears the decoder down and re-initializes it. If that
++ * re-init failed (e.g. WelsCreateDecoder/Initialize OOM) s->decoder is left
++ * NULL; the void flush callback cannot report this, so guard here to turn a
++ * NULL dereference into a recoverable error. */
++ if (!s->decoder) {
++ av_log(avctx, AV_LOG_ERROR, "decoder not initialized\n");
++ return AVERROR(EINVAL);
++ }
++
+ if (!avpkt->data) {
+ #if OPENH264_VER_AT_LEAST(1, 9)
+ int end_of_stream = 1;
+@@ -162,6 +182,7 @@ const FFCodec ff_libopenh264_decoder = {
+ .init = svc_decode_init,
+ FF_CODEC_DECODE_CB(svc_decode_frame),
+ .close = svc_decode_close,
++ .flush = svc_decode_flush,
+ .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1,
+ .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS |
+ FF_CODEC_CAP_INIT_CLEANUP,
diff --git a/ffmpeg.spec b/ffmpeg.spec
index 7e8aeb4..3ed90e1 100644
--- a/ffmpeg.spec
+++ b/ffmpeg.spec
@@ -121,6 +121,9 @@ Patch2: ffmpeg-allow-fdk-aac-free.patch
Patch3: ffmpeg-allow-decklink.patch
# VapourSynth R79 renamed libvapoursynth-script to libvsscript
Patch4: ffmpeg-vapoursynth-lib-rename.patch
+# fix backward seeking in H.264
+# https://bugzilla.redhat.com/show_bug.cgi?id=2547586
+Patch5: https://code.ffmpeg.org/FFmpeg/FFmpeg/commit/883e8a6336b2651f7be79a6a9aa5f3cc22937948.patch#/ffmpeg-openh264-flush-callback.patch
# Add first_dts getter to libavformat for Chromium
# See: https://bugzilla.redhat.com/show_bug.cgi?id=2240127
@@ -978,6 +981,7 @@ rm -rf %{buildroot}%{_datadir}
%changelog
* Fri Oct 30 2026 Dominik Mierzejewski <dominik@greysector.net> - 9.0.2-3
- enable free Vulkan encoders (patch by Stepan Fomin)
+- backport fix for backward seeking with openh264 (resolves rhbz#2547586)
* Thu Oct 15 2026 Simone Caronni <negativo17@gmail.com> - 9.0.2-2
- Rebuilt for updated dependencies.
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-30 22:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-30 22:21 [rpms/ffmpeg] rawhide: backport fix for backward seeking with openh264 (resolves rhbz#2547586) Dominik 'Rathann' Mierzejewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox