Commit Graph
12959 Commits
Author SHA1 Message Date
Steven Xiao 5d5a38a7e4 avfilter/vf_scale_d3d12: add RGB formats and color space conversion
Extend scale_d3d12 from NV12/P010 resizing to full pixel format and
color space conversion, matching what the D3D12 video processor is
actually capable of.

- Support converting to/from the semi-planar YUV formats (nv12, p010,
  p012) and the packed RGB formats (bgra, rgba, x2bgr10, rgbaf16),
  when the hardware supports it.
- Add out_color_matrix, out_range, out_color_primaries and
  out_color_transfer options.
- Recalculate sample_aspect_ratio and drop size-dependent side data
  on resize.
- Harden GPU teardown/reconfiguration.

Example usage:
    Convert a d3d12 NV12 surface to BGRA:
        scale_d3d12=format=bgra

    Convert an HDR10 (P010) surface to 10-bit RGB, without altering
    its HDR color properties:
        scale_d3d12=format=x2bgr10

    Scale and convert to full-range BGRA:
        scale_d3d12=format=bgra:out_range=full

Signed-off-by: younengxiao <steven.xiao@amd.com>
2026-11-02 12:35:20 +00:00
Kacper Michajłow b91a132d16 avfilter/vf_scale: fix typo in the help of in_transfer
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-02 04:24:36 +00:00
romainhedouin e19fadf1de avfilter/vf_morpho: remove unused plane_f and plane_g buffers
The filter allocates two int64_t arrays with one entry per output
pixel, plane_f and plane_g, but nothing reads or writes them. Remove
them. The output is unchanged.

Noticed during a review sweep of ffmpeg using an LLM.

Signed-off-by: romainhedouin <romain.hedouin@epitech.eu>
2026-11-01 22:12:31 +01:00
llyyr 83572f1315 avfilter/vf_libplacebo: expose pl_color_map_params.tone_constants
Replace the deprecated pl_tone_map_params.param field with
pl_color_map_params.tone_constants

This allows configuring each tonemapping algorithm independently, rather
than relying on a single algorithm-specific parameter.

Update the documentation to describe the new options and their defaults.

Also deprecate the vf_libplacebo tonemapping_param option as well.
2026-11-01 12:32:28 +00:00
romainhedouin 21e6c1f57d avfilter/vf_nnedi: use smaller per-thread buffers
The output buffer only needs one line now, and the input buffer half a
frame plus five lines. Both were as big as a whole frame.

For 1080p yuv420p this saves about 115 MB with 10 filter threads and
about 4 MB with one. The output is unchanged.

Found during a code review sweep of ffmpeg using an LLM.

Signed-off-by: romainhedouin <romain.hedouin@epitech.eu>
2026-11-01 04:00:54 +00:00
romainhedouin 941ad47ced avfilter/vf_nnedi: write each output line as soon as it is computed
Compute and write one line at a time instead of filling a float buffer
for the whole slice first. The read and write helpers now work on one
line, so they no longer need strides and a height.

The output is unchanged.

Found during a code review sweep of ffmpeg using an LLM.

Signed-off-by: romainhedouin <romain.hedouin@epitech.eu>
2026-11-01 04:00:54 +00:00
romainhedouin a89a2d683b avfilter/vf_nnedi: read the input lines in a loop
filter_slice() read the input lines with seven separate calls: three
above the slice, one for the slice and three below. Use one loop that
clamps the line number to the kept field.

The output is unchanged.

Found during a code review sweep of ffmpeg using an LLM.

Signed-off-by: romainhedouin <romain.hedouin@epitech.eu>
2026-11-01 04:00:54 +00:00
romainhedouin b8e6f74a6b avfilter/vf_nnedi: fix the last line of planes with an odd height
filter_slice() split each plane into height / 2 pairs of lines, so the
last line of a plane with an odd height was never written. For 720x486
yuv420p that is the last line of both chroma planes. For very small
frames (gray with a height of 1, 4:2:0 with a height of 2 or less) no
job ran and nothing was written at all.

With odd heights the bottom edge was also clamped to a line of the
wrong field, and the output changed with the number of threads.

Use (height + 1) / 2 pairs, clamp to the first and last line of the
kept field, and always run at least one job. The output for even
heights is unchanged, except in frames where no job ran.

Found during a code review sweep of ffmpeg using an LLM.

Signed-off-by: romainhedouin <romain.hedouin@epitech.eu>
2026-11-01 04:00:54 +00:00
romainhedouin 169d516b35 avfilter/vf_nnedi: fix stale prescreener flags after pscrn=none
The prescreener flags are only written when a prescreener is used. If
pscrn is changed to none at runtime, the flags of the previous frames
stayed in the buffer, so the predictor skipped those pixels and the
output was wrong. Clear the flags when pscrn is none.

Checked by switching pscrn with sendcmd: the frames after the switch
now match a run that started with pscrn=none.

Found during a code review sweep of ffmpeg using an LLM.

Signed-off-by: romainhedouin <romain.hedouin@epitech.eu>
2026-11-01 04:00:54 +00:00
romainhedouin 6044cf950a avfilter/vf_nnedi: fix out of bounds reads on narrow planes
read_bytes() and read_words() pad each line with 32 mirrored samples
on both sides. For a plane narrower than 32 samples they read before
the start and past the end of the line. Clamp the indices. The output
for wider planes is unchanged.

Found with ASan on gray 16x16 and on the chroma of yuv420p 48x32.

Found during a code review sweep of ffmpeg using an LLM.

Signed-off-by: romainhedouin <romain.hedouin@epitech.eu>
2026-11-01 04:00:54 +00:00
romainhedouin dec1770703 avfilter/vf_nnedi: fix a heap overflow in the prescreener buffer
process_new() writes the prescreener flags four at a time, but the
buffer was only as wide as the plane. If the width is not a multiple
of four, up to three flags were written past the end of it.

Found with ASan using the default settings, for example on gray
321x120.

Found during a code review sweep of ffmpeg using an LLM.

Signed-off-by: romainhedouin <romain.hedouin@epitech.eu>
2026-11-01 04:00:54 +00:00
Niklas Haas 11ef8d60d6 avfilter/vf_libplacebo: add libplacebo_scene filter
This filter takes a scene graph in the libplacebo scene JSON format and
exposes it as a filter. The number of inputs and their properties are
determined by the scene graph.

I decided to make this a separate filter because it invalidates most of
the existing options, including e.g. the existing scaling and fitting logic.

For simplicity, scene graphs are always assumed to have a fixed canvas size,
which the user continues specifying at init time.

Requires libplacebo API version 386 or newer, which we probe the existence
for as a separate capability so we can selectively expose the filter.

Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas HaasandClaude Opus 5.5 eada463e9a avfilter/vf_libplacebo: add sar option
Forces the output sample aspect ratio, instead of deriving it from the
input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas HaasandClaude Opus 5.5 521464518e avfilter/vf_libplacebo: move common options into a macro
So they can be shared with other filters in this file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas HaasandClaude Opus 5.5 3b7e7311e8 avfilter/vf_libplacebo: factor out push_frame()
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas HaasandClaude Opus 5.5 7671ac4e12 avfilter/vf_libplacebo: make the reference frame optional in set_output_props()
Without a reference frame, only the properties derived from the output link
and the filter options are set.

Note that the conditional stripping flags (including `progressive`) are
only needed if we are copying from the ref frame; as a plain allocated
AVFrame would never have this side data / flags otherwise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas HaasandClaude Opus 5.5 a1fc573823 avfilter/vf_libplacebo: reorder set_output_props()
Handle Dolby Vision right after copying the frame properties, before the
output link properties. No functional change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas Haas 947c382dd8 avfilter/vf_libplacebo: add a progressive parameter to set_output_props()
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas HaasandClaude Opus 5.5 2ee817e9cf avfilter/vf_libplacebo: factor out set_output_props()
Move the output frame property setup out of output_frame(), unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas HaasandClaude Opus 5.5 bc5362e327 avfilter/vf_libplacebo: factor out map_output() and unmap_output()
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas HaasandClaude Opus 5.5 588bf01909 avfilter/vf_libplacebo: factor out config_output_vulkan()
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas HaasandClaude Opus 5.5 bdd454504f avfilter/vf_libplacebo: make the GPU setup idempotent
So config_input() can simply set up the GPU for every input, rather than
tracking whether the device still needs to be inherited.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas HaasandClaude Opus 5.5 02bd5adaff avfilter/vf_libplacebo: factor out inherit_device() and config_input_vulkan()
inherit_device() sets the filter's own device to the one of the input, so
choose_default_device() picks it up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas HaasandClaude Opus 5.5 69b8194089 avfilter/vf_libplacebo: factor out choose_default_device()
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas HaasandClaude Opus 5.5 df45ea3050 avfilter/vf_libplacebo: factor out append_inputs()
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas HaasandClaude Opus 5.5 d33a47dbdb avfilter/vf_libplacebo: split libplacebo_setup_gpu() out of init_vulkan()
Separates creating the Vulkan device from the filter-specific setup that
depends on it, so the former can be shared with other filters in this file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas HaasandClaude Opus 5.5 0973fc6c44 avfilter/vf_libplacebo: factor out init_common()
Move the log, shader cache and output format setup out of
libplacebo_init(), so it can be shared with other filters in this file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas HaasandClaude Opus 5.5 b2d50e1c4a avfilter/vf_libplacebo: tag output frames with the output link SAR
The per-frame SAR disagreed with the output link: reset_sar (and thus also
normalize_sar and multiple inputs) forwarded the input SAR instead of 1:1,
and fit modes other than fill always stretched it. The frames are rendered
according to the link SAR, so use that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas HaasandClaude Opus 5.5 8a0d1b17ae avfilter/vf_libplacebo: fix forcing output color properties to 0
These options default to -1 (auto), but were only applied when positive,
so e.g. colorspace=gbr or range=unspecified were silently ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas HaasandClaude Opus 5.5 060cfa47dd avfilter/vf_libplacebo: don't mask input errors with a later EOF
Only the status of the input ending last was forwarded, so an error on a
shorter input was reported as an ordinary EOF if a longer input ended
normally. Keep forwarding the most recent status, but prefer errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Niklas HaasandClaude Opus 5.5 3eadc56d38 avfilter/vf_libplacebo: add missing scale_eval.o dependency
Uses ff_scale_eval_dimensions() and ff_scale_adjust_dimensions(), so linking
fails with the scale filters disabled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-31 13:37:58 +01:00
Michael Niedermayer b6d737a49c avfilter/af_amerge: check the channel count of each input before summing
Fixes: signed integer overflow
Fixes: out of array write
Fixes: 4T4QtWPFfCiD
Fixes: Depthfirst issue 019f3b84-908c-7752-be91-62fb35f8911e
Out of array write Replicated through UnModified FFmpeg with ASAN and UBSAN
The out of array write is a regression since 4e0a8b745a, the overflow
of the sum is older.

Found-by: Michael Niedermayer <michael@niedermayer.cc> using Depthfirst
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-29 23:46:18 +00:00
Niklas Haas 2602f39f55 avfilter: deprecate AVFilterGraph.max_buffered_frames
In favor of the new API.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-29 13:09:04 +00:00
Niklas Haas 57cce83d49 avfilter: add avfilter_graph_set_max_buffered_frames()
This is a new API that offers two improvements over the existing field:

1. It allows setting a different limit per media type
2. It allows updating the limit after the graph has been configured, as
   long as this would not cause already existing frames to exceed the limit

I'm not sure if the second point is ever useful, but it's easy to implement
regardless.

Because the old field will be deprecated, the new API just overrides the old
value wholesale. The alternative was to respect both (i.e. use the smaller
of the two limits); but this way, callers can use the new API to e.g.
selectively uncap the limit on audio frames while remaining backwards
compatible with older libavfilter.

Explicitly set limits are tracked separately, so that avfilter_graph_config()
re-derives all other limits from the old field on every call.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-29 13:09:04 +00:00
Niklas Haas e98fa96192 avfilter: apply max_buffered_frames per media type
Minor semantic change to prepare for the upcoming commits.

This shouldn't regress anything because the new behavior is strictly more
permissive than the old behavior, and the distinction is only relevant
for the uncommon case of combined audio-video filters.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-29 13:09:04 +00:00
Michael Niedermayer e259604514 avfilter/vf_bm3d: clamp the search range to the plane size
Fixes: signed integer overflow
Found during triage/review of the security report fH770hlenwcI
Signed integer overflow Replicated through UnModified FFmpeg with UBSAN
2026-10-29 01:48:30 +00:00
Michael Niedermayer a7aeaecb77 avfilter/vf_bm3d: compute MSE2SSE in double
Fixes: signed integer overflow
Found during triage/review of the security report fH770hlenwcI
Signed integer overflow Replicated through UnModified FFmpeg with UBSAN
2026-10-29 01:48:30 +00:00
Michael Niedermayer f4a0848874 avfilter/vf_bm3d: bound the search position buffer by the frame size
Fixes: heap buffer overflow (write)
Fixes: fH770hlenwcI/testcase/repro.sh
Fixes: fH770hlenwcI
Found-by: Michael Niedermayer <michael@niedermayer.cc> using Depthfirst
Out of array write Replicated through UnModified FFmpeg with ASAN
2026-10-29 01:48:30 +00:00
Kacper Michajłow d7b8f4a9ba avfilter/vf_colorspace: refuse a primaries conversion that does not fit the fixed point
The linear RGB to RGB matrix is stored as int16 with 14 fractional
bits, so a coefficient of 2 or more wraps around. The conversion from
the XYZ basis of SMPTE ST 428-1 to BT.709 has one of 3.15, and a
neutral (126, 128, 128) came out as (99, 143, 64). Check the
coefficients before narrowing them and refuse the conversion. Fast mode
does not use the matrix and is not checked, and a refused conversion
forgets the primaries, so that the next frame is refused too instead of
using the matrix left behind.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-10-28 19:22:28 +00:00
Kacper Michajłow 27ba457b60 avfilter/colorspace: derive the RGB to XYZ matrix without dividing by y
The matrix columns were the primaries scaled to Y = 1, x/y and
(1 - x - y)/y, and were then rescaled to fit the white point, so the
division by y cancels out. Use the xyz chromaticity vectors directly,
which gives the same matrix and also works for a primary with y = 0,
such as the Z axis of the CIE 1931 XYZ.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-10-28 19:22:28 +00:00
Kyle Swanson 58584087cf avfilter/vf_libvmaf: pass frame colorimetry to libvmaf
Signed-off-by: Kyle Swanson <kswanson@netflix.com>
2026-10-27 20:01:52 +00:00
Jake Fineman 15423fa745 avfilter/dnn_backend_openvino: fix partial shape leak in get_output_ov()
With input_resizable enabled, get_output_ov() created partial_shape with
ov_partial_shape_create() and then passed the same variable to
ov_shape_to_partial_shape(), which allocates a new dims array and
overwrites the struct. The first allocation was never freed, so every
call leaked it, on the success path and on the two error returns in
between. The dims it was built from were never used.

Drop the ov_partial_shape_create() call and the dims array; the partial
shape is built from the model's input shape by ov_shape_to_partial_shape()
and freed after ov_model_reshape_single_input() as before.

The leak was introduced with the OpenVINO API 2.0 support in e79bd1f1b1.

Signed-off-by: Jake Fineman <jake@wave.online>
2026-10-27 13:37:42 +00:00
Martin Mirchev a7241b6a77 avfilter/vf_vignette: keep the backward gain finite
In backward mode the gain is 1 / factor, but the factor is 0 for pixels
farther than dmax from the center (possible with x0/y0 or aspect), so
the gain is inf. inf * sample, or inf * 0 = NaN, is then converted to
int, which is undefined behaviour; on x86 these pixels come out black
instead of saturated.

For angles close to PI/2, the factor can also become small enough that
a finite backward gain produces sample values outside the range of int
before av_clip_uint8() is called. Bound the gain at 256 to keep these
conversions in range while preserving the saturated 8-bit output.

Signed-off-by: Martin Mirchev <mmirchev@comp.nus.edu.sg>
2026-10-26 22:36:19 +00:00
Michael Niedermayer a3f1b1e87c avutil/framepool: provide a single copy for static builds
Both libavfilter and libswscale currently put framepool.o in their regular
OBJS, defining the same four ff_frame_pool_* symbols. Loading both static
archives in full therefore fails with multiple definitions.

Move the implementation and internal header to libavutil. Include the
object in its STLIBOBJS when either consumer is enabled, and use SHLIBOBJS
for the private copies in libavfilter and libswscale. This preserves
independent builds and shared-library symbol visibility without adding
an inter-library dependency or exposing a new public API.

Verified whole-archive links with both consumers, and with each consumer
configured independently. Shared builds pass fate-filter-rgbtestsrc-gbrp12
and fate-filter-rgbtestsrc-gbrap12; static and shared video scaling and
audio volume smoke tests produce identical frame checksums. Also checked
static consumers linked against shared dependencies.

Fixes: 6c89a30ecd
Fixes: #25419
Assisted-by: Fairy
2026-10-26 16:53:24 +00:00
James Almer ceb466cbcd avfilter/avfiltergraph: call print_filter_formats with TRACE log level
It's way too noisy for debug level.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-10-26 13:14:21 +00:00
Rodrigo Camacho 3719f257cf avfilter/scene_sad: R-V V scene_sad
Benchmarking results:

checkasm:
 - CPU: SpacemiT, vendor arch 0x58000001, imp 0x1000000049772200
 - CPU: VLEN = 256 bits
 - Timing source: gettime
 - Bench duration: 1000 µs per function (1000000 nsecs)
 - Random seed: 4056509538
RV_zve64x:
 - scene_sad.scene_sad8  [OK]
 - scene_sad.scene_sad10 [OK]
 - scene_sad.scene_sad12 [OK]
 - scene_sad.scene_sad14 [OK]
 - scene_sad.scene_sad15 [OK]
 - scene_sad.scene_sad16 [OK]
checkasm: all 6 tests passed
Benchmark results:
  name                    nsecs (vs ref)
  scene_sad8_c:        331870.0
  scene_sad8_rvv_i64:   27121.5 (12.23x)
  scene_sad10_c:       335723.6
  scene_sad10_rvv_i64:  52943.8 ( 6.33x)
  scene_sad12_c:       335534.9
  scene_sad12_rvv_i64:  52930.4 ( 6.33x)
  scene_sad14_c:       335625.7
  scene_sad14_rvv_i64:  52728.6 ( 6.36x)
  scene_sad15_c:       335521.3
  scene_sad15_rvv_i64:  52937.0 ( 6.33x)
  scene_sad16_c:       335549.9
  scene_sad16_rvv_i64:  52768.3 ( 6.35x)

Signed-off-by: Rodrigo Camacho <rodrigompcamacho@gmail.com>
2026-10-24 23:45:47 +00:00
Timo Rothenpieler d205b2fd0f avfilter/vsrc_gfxcapture: use AV_NOPTS_VALUE as default for pts fields 2026-10-24 20:55:29 +00:00
Rafael Henrique Gonçalves de OliveiraandTimo Rothenpieler 9627f97678 avfilter/vsrc_gfxcapture: add dup_frames option
Windows Graphics Capture only delivers a frame when the captured content
changes, so a static source makes gfxcapture output nothing at all. An
fps filter after it cannot help, since it has no later frame to
duplicate up to, and anything muxed alongside stalls as well.

Add a dup_frames option, like ddagrab has. When no new frame arrived
within one 1/max_framerate interval, output a new reference to the last
frame, or a black frame before the source delivered its first one.
Repeats are stamped with their deadline in the QPC clock, the same clock
as SystemRelativeTime, and the next deadline counts from the previous
one, so timer overshoot shows up neither in the timestamps nor in the
rate. A captured frame timestamped at or before the last output is
bumped to keep timestamps increasing.

The new option is on by default, since the current behaviour is arguably
surprising and clashes with how a lot of the filter chain and the
fftools work.

Signed-off-by: Rafael Henrique Gonçalves de Oliveira <rafaelh9six@gmail.com>
Co-authored-by: Timo Rothenpieler <timo@rothenpieler.org>
2026-10-24 20:55:29 +00:00
Rafael Henrique Gonçalves de Oliveira 532486e0a5 avfilter/vsrc_gfxcapture: use fresh callback state for each WGC thread call
run_on_wgc_thread() reused one callback state for every call and reset
its cancel flag each time. A callback that timed out while still queued
could then run after the next call's reset, through references to the
earlier caller's stack. Each call now gets its own state, which the
queued callback keeps alive.

Signed-off-by: Rafael Henrique Gonçalves de Oliveira <rafaelh9six@gmail.com>
2026-10-24 20:55:29 +00:00
Rafael Henrique Gonçalves de Oliveira a8e795f525 avfilter/vsrc_gfxcapture: lock the device context around ExecuteCommandList
The immediate context is shared with the rest of the hw device's users,
and AVD3D11VADeviceContext's lock is what serializes calls on it.

Signed-off-by: Rafael Henrique Gonçalves de Oliveira <rafaelh9six@gmail.com>
2026-10-24 20:55:29 +00:00