Back when reselect_demux_stream call was added in this path in 700f72f,
sub_redecode_cached_packets only retained the last two packets. The
subtitle decoder cache was changed in 0a4b098 to retain the whole packet
sequence. Therefore sub_redecode_cached_packets by itself can rebuild
the new decoder state entirely from packets held in memory, and we no
longer need the demuxer to refresh the track.
This fixes expensive track refresh for network streams, where changing
some sub-* options during runtime of network streams would cause the
cache to be dropped
pw_time.queued is reported in bytes, while the code here expects it in
nframes.
Note that this doesn't matter at all, because pw_time.queued is always 0
for us since we use it as a pull-based AO. This would be a latent bug if
we ever switched to push model.
When the image format changes (e.g. switching hwdec), immediately
destroy the existing deinterlace filter instead of draining it. Draining
feeds new frames through the old filter, which can cause issues. (e.g.
bwdif_vulkan receiving vaapi frames).
This fixes userdeint filter failure when switching from hwdec=vulkan to
hwdec=vaapi while the filter is applied via --deinterlace=auto/yes
loop_start starts a thread which immediately acquires the thread loop
lock. Locking the loop before loop_start can therefore deadlock the
newly created thread during initialization.
Locking the thread loop before loop_start was always incorrect, but
Pipewire commit fb49e0795c28* made the issue visible by switching
pw_thread_loop_lock to the underlying SPA loop lock.
To fix this, we just avoid starting the loop until after we're connected
to the server.
* https://github.com/PipeWire/pipewire/commit/fb49e0795c28c892116b03369785ba86c27c968d
The FILE field in a CUE sheet may contain a relative path with
subdirectories. It's not clear if this usecase is intended to be
supported, as none of the usual CD/DVD ripping tool generates this type
of FILE field in the CUE sheet. The specification is old and abandoned,
so this will likely never be clarified and it doesn't cost much to
support it so might as well...
44a2c33939 tried to do this in a cute way by unsetting the hwdev to
be used for hwdec, but this doesn't prevent -copy variants from being
probed. Instead explicitly disallow it for grouped streams
create_xdg_surface returns success/failure, so use bool instead of int
for its return type. Also invert the return values to better match the
style of the rest of the file, also adjust callers accordingly.
create_viewports returns success/failure, so use bool instead of int for
its return type. Also invert the return values to better match the style
of the rest of the file, also adjust callers accordingly.
spawn_cursor returns success/failure, so use bool instead of int for its
return type. Also invert the return values to better match the style of
the rest of the file, also adjust callers accordingly.
This allows playing tile grid images without manually disabling hardware
decoding. There is no other type of stream group known to support
hardware decoding so far.
Co-authored-by: Guido Cella <guido@guidocella.xyz>
This fixes stalled/slow resize when there's only an image being
displayed or no output at all. When there's a video playing, the video
implicitly causes a redraw but we need to redraw ourselves when there's
no video.
Fixes: https://github.com/mpv-player/mpv/issues/16744
Fixes LSAN leak when tests call fail() and exit(1) is called. We have
mpv_destroy set for atexit but data.ctx was null parented, so it had no
parent to be freed by. Parent it to script_ctx instead so it gets
cleaned up by mpv_destroy.
LSAN output:
Direct leak of 400 byte(s) in 5 object(s) allocated from:
#\0 0x7f4c6c52c01f in malloc (/lib64/libasan.so.8+0x12c01f) (BuildId: db0aa5bf57ed53a5869a3a2cc49051292ceb6390)
#\1 0x7f4c6b276388 in ta_alloc_size ../ta/ta.c:139
#\2 0x7f4c6b2bf01f in script_autofree_trampoline ../player/lua.c:1310
#\3 0x7f4c69373b15 (/lib64/libluajit-5.1.so.2+0xbb15) (BuildId: 182622c63dea3dd74173bbd5a810051a76bcf4d9)
PA_SUBSCRIPTION_MASK_SINK is a pa_subscription_mask constant used when
registering with pa_context_subscribe(), not a
pa_subscription_event_type mask. Masking the event type with it would
never match PA_SUBSCRIPTION_EVENT_NEW or PA_SUBSCRIPTION_EVENT_REMOVE,
causing hotplug events to be silently dropped.
Fixes: e01750020d
M_OPT_INVALID says "option parameter could not be parsed" which is
incorrect for some failures this parser might encounter. Instead print
something that might be useful for the user to debug.
Vulkan instance might fail to create if there's no vulkan drivers that
mpv can see, or devices might fail to enumerate for whatever reason
vo_wayland_handle_scale may be called from reconfig, even before we get
the first toplevel_configure. In this case, don't use the surface local
coordinates because they will be initialized as 0.
Tablet input is more similar to mouse input than it is to touch input,
so it makes sens to use wayland-edge-pixels-pointer instead. Also
document that it's used for tablet input, previously this was completely
undocumented.
Replace order-dependent struct initialization of Wayland listener
structs with designated initializers.
Besides making it harder to make ordering mistakes while adding or
changing code, also makes it easier to grep for specific events because
our callback functions aren't necessarily named the same as the event
names (e.g. global_remove = registry_handle_remove).
It's still invalid for max_lum to be less than or equal to min_lum, so
do the check before set_luminances call. Also rename the function
because it does more than just check if it's valid, it also sanitizes
some invalid values.
Also changes the TRC_LINEAR case a bit, because min_luma == 0 isn't
exactly invalid, only min_luma >= max_luma is invalid which is covered
by the sanitize function
This version contains critical fixes to swapchain selection, correct
mapping of sRGB TRC as well as fix for gpu hangs on anv. Bump the
minimum version because the mpv experience with previous version
shouldn't be endorsed or be considered acceptable by upstream.
The keyword here is "try". mpv attempts to accept data offer on motion,
by using the time as the serial... which doesn't do anything. We already
accept data offers on data_device.enter so this doesn't do anything even
if we used the right serial.
Fixes: 68f9ee7e0b
wl_display_roundtrip performs one roundtrip one the queue, but there's
no guarantee that the callback will be invoked within that roundtrip.
Instead of hoping one roundtrip is enough, dispatch the queue until the
pending flag is cleared explicitly.
This incorrectly used clamp_double function after 0e7f9c39dc when it
should've always used clamp_float instead. Use clamp_float instead
Fixes: 0e7f9c39dc ("m_option: correctly clamp OPT_FLOAT values")
Since we call bstr0 on the string anyway, might as well use it for
printing which implicitly includes a null check that gcc can see so it
doesn't produce the warning as seen in the next commit anymore
Waiting for color management from the compositor doesn't make sense in
other cases and this breaks --force-window since the playloop doesn't
advance. Fixes#17391.
Fixes a deadlock when switching vo before a frame is displayed (e.g.
with auto profiles) where we'd end up in a state where wait_on_vo is set
to true for the first frame and then draw_frame is never called again so
its value never changes even once dmabuf-wayland is ready to advance
frame
Fixes: 468d34c9bd ("vo: allow VOs to request waiting before advancing frames")
Before this commit, deinterlace=auto and deinterlace=yes had the same
exact behavior for d3d11 and vaapi, the only difference being that
`auto` would create/destroy the deinterlacing filter on every frame that
changed the deinterlace flag and with `yes`, we left that the
responsibility to determine whether to deinterlace or not to d3d11vpp
and vavpp and the filters were always inserted.
Inserting and removing filters on every frame the interlaced flag changes
is expensive and it will be more efficient to let the deinterlacing
filters handle this distinction instead.
With this change, `yes` works as it should: the filter is inserted
always and deinterlacing is forced regardless of the frame flag. `auto`
will insert the deinterlacing filter only when mpv sees the first
interlaced frame, and the filter will only deinterlace the frames marked
as interlaced. Note that perfect detection of interlaced frames is not
possible, and in such cases the user has to set `yes` manually.
One downside of this change is that we don't know if the filter is
actually deinterlacing or not, we can only guess that if the filter is
inserted and the frame is interlaced then it should be deinterlacing.
It's possible for it to fail for whatever reason, and it's also possible
future changes to ffmpeg (since bwdif implementation lives in ffmpeg),
might make the logic more complicated than this check. However, for now
this is good enough.
vo_wayland_preferred_description_info is destroyed after info_done, so
obviously we can't store it here. This causes a use-after-free.
Embarrassing mistake
Fixes: 7a7d871d0a
We need to acquire in->lock first before setting this flag, but if we
take this path then request_redraw is true already. So fix the data race
by just not re-setting the value.
This fixes data race detected with checking in->request_redraw value in
vo_redraw detected with TSAN
In f914947dda we implemented a hack to
force 8bpc dithering for SDR playback, because at the time nothing in
the pipeline was doing dithering. mpv would pick 16bpc swapchain, dither
down to 16bpc, then it'd be presented to the user's display as-is and
result in banding. There is no way to detect the real on-the-wire bpc,
so we told users to configure dither-depth manually.
However, it seems most compositors that do color management now handle
10-16bpc input just fine without any banding, so instead implement
color_depth to effectively set dither-depth=auto for compositors that
support expose color_manager and keep the 8bpc hard default for others.
Fixes: https://github.com/mpv-player/mpv/issues/17222
This adds option `--audio-set-media-role` to configure whether mpv
should set media roles to supported audio APIs or not. Disabled by
default.
By default, WirePlumber restores the volume of each application to
whatever the last application with the same media role used. This is
completely insane behavior, and I couldn’t find any way for a user to
opt out of it on my end. The `state-stream.lua` script responsible for
this mess only uses media.role if the property is present, so the only
reliable workaround is simply not to set one at all.
This WirePlumber behavior is inherited from PulseAudio, which also
exhibits the same behavior to this day.
This commit also mirrors the same change made to ao_pulse in 2015:
b7325b2f64
See also: https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/489
Previously this would be called on every frame presented, this only
needs to be called if display sync was active for the last frame but
isn't active anymore.
This hid the bug mentioned in #16947 if VO was active.