Commit Graph

2007 Commits

Author SHA1 Message Date
Misaki Kasumi 6fadaf66c8 osdep: remove semaphore-mac
It is only used in one place in ao_coreaudio_utils.c,
and can be replaced by condvar.
Removing it can reduce the maintenance burden.
2024-10-12 17:26:39 +02:00
Kacper Michajłow 7202406fe8 various: remove global.h inclusion where not needed 2024-10-01 12:23:44 +02:00
Misaki Kasumi c3d9243a3e ao_coreaudio: fix nan in ca_get_device_latency_ns 2024-09-28 14:15:55 +02:00
llyyr a44a726301 ao_alsa: assume device lost if we couldn't recover after 10 attempts
ALSA API reports -EPIPE even when the the device is lost, which we
currently always assume to be an XRUN. If we assumed XRUN 10 times and
didn't manage to recover, just consider the device lost and try to
reconnect. Allows ao_alsa to recover from alsa server being killed then
reinitialized. And even in the worst case, this should be better than
the status quo of mpv attempting to prepare a PCM device indefinitely
until the user restarts mpv.

This is admittedly not ideal, and I don't think the -EPIPE hack is
necessary anymore, but I can only test on my setup and removing the
'assume -EPIPE is an XRUN' hack might break some setups for whatever
mysterious reasons.
2024-09-14 14:08:30 +02:00
llyyr 44da754018 ao_alsa: don't early exit out of the loop if we have an error
This would cause us to exit out of the loop with a goto anytime we ran
into XRUN or DRAINING and preparing PCM for use failed.
2024-09-14 14:08:30 +02:00
Kacper Michajłow 24f42acd1d ad_spdif: update list of DTS_HD profiles 2024-08-01 13:27:08 +02:00
llyyr 1fd9389911 ao: don't add buffer length to timeout twice
ao_get_delay already adds this buffer length
2024-07-10 19:32:36 +02:00
llyyr 2559f8874f ao: use the right type for pending samples 2024-07-10 19:32:36 +02:00
llyyr 539e95730a ao_pipewire: bump minimum libpipewire version to 0.3.57
available on debian stable
2024-07-08 13:33:32 +00:00
Kacper Michajłow cd1b63f628 ad_{lavc,spdif}: initialize channel layout
It is not always available for the demuxer, so update it from decoder.
2024-06-23 05:09:13 +02:00
Kacper Michajłow 9e1271260f ad_spdif: fix lavf version check
Fixes: 62b1bad755
2024-06-22 16:12:14 +02:00
Kacper Michajłow 687eb4c875 various: remove no longer needed availability checks
image_writer: remove jpegxl availability check

meson: remove check for lavu vulkan support

image_writer: remove avif availability check

ad_spdif: remove no longer needed definitions

demux_lavf: remove side data extraction compatibility code

demux/packet: remove ITU T.35 availability check

filters/f_lavfi: remove avfilter_filter_pad_count availability check

image_writer: remove PNG cICP support check

mp_image: remove AV_FRAME_DATA_DOVI_METADATA availability check

mp_image: remove AV_FRAME_FLAG_INTERLACED availability check

vd_lavc: remove ctx->pic->duration availability check

sws_utils: remove av_chroma_location_enum_to_pos availability check

vd_lavc: remove AV_CODEC_EXPORT_DATA_FILM_GRAIN availability check

demux_lavf: always use io_close2
2024-06-22 16:12:14 +02:00
Kacper Michajłow 3c5a79300c various: remove av channel layout check 2024-06-22 16:12:14 +02:00
Dudemanguy 157566904f ao_pipewire: fix some stray tabs 2024-06-19 23:04:05 -05:00
der richter bc5ab97d9a ao_avfoundation: guard features only available on macOS 11.3 and 12
build time and runtime checks.
2024-06-18 19:30:07 +02:00
Kacper Michajłow 3b3604e162 ad_spdif: add an assert for lavf_ctx
To suppress forward null warning.
2024-06-16 01:22:30 +02:00
Kacper Michajłow d7ceedbd99 ao_wasapi: don't limit the scope of execution context
May fix broken systems like #12145 or #14314. Probably won't change
anything, but it is the correct context to use anyway.
2024-06-07 19:41:28 +02:00
Kacper Michajłow f394349066 ao_pcm: fix incorrect win32 check 2024-06-05 19:16:35 +02:00
Kacper Michajłow b558b99f67 ao_pipewire: fix access to undefined byte order definitions
spa/param/audio/raw.h on FreeBSD accesses those, so defined them.
Probably should be fixed upstream, but to suppress warnings lets do it
locally.
2024-06-05 19:07:58 +02:00
Kacper Michajłow 8657b20574 ao_coreaudio_chmap: fix shadowed variable 2024-06-05 19:07:58 +02:00
Misaki Kasumi ef026ffdb6 Revert "ao_pipewire: add EOF handling"
This reverts commit 3fc8929caf.
2024-05-28 13:23:17 +00:00
Misaki Kasumi 2938ed5942 Revert "ao_pipewire: wait for draining finishes before restart ao"
This reverts commit 88f20a7011.
2024-05-28 13:23:17 +00:00
Misaki Kasumi 88f20a7011 ao_pipewire: wait for draining finishes before restart ao
When the stream is draining, setting stream to active has no effect.
2024-05-25 22:52:45 +02:00
Misaki Kasumi 3fc8929caf ao_pipewire: add EOF handling 2024-05-25 22:52:45 +02:00
Misaki Kasumi a3a9bc289a ao_avfoundation: use blocking ao_read_data 2024-05-25 22:52:45 +02:00
Misaki Kasumi eb996a13bc ao_avfoundation: add EOF handling 2024-05-25 22:52:45 +02:00
Misaki Kasumi aebe58203b ao: add ao_stop_streaming 2024-05-25 22:52:45 +02:00
Misaki Kasumi bfadd31957 ao: add eof, pad_silence, and blocking arguments for ao_read_data 2024-05-25 22:52:45 +02:00
Misaki Kasumi a791408659 ao_coreaudio: set ao->device_buffer base on hardware latency 2024-05-25 15:35:26 +02:00
Kacper Michajłow 7923a633a0 ad_spdif: check return value of av_parser_parse2 2024-05-22 22:13:54 +02:00
Kacper Michajłow 82ce07d640 ad_spdif: check for AC3 if parser fails to detect profile
c522d0dfbd added parser to avoid opening
decoder and left decoder only for DTS. Since then more audio codec needs
decoder, so open decoder always when it might be needed. Exclude only
AC3, other codec have profile to be extracted.

Fixes: c522d0dfbd
2024-05-22 22:13:54 +02:00
Kacper Michajłow 6eb0f4b27f ad_spdif: set codec params
It seems that we decode small portion of the audio to determine codec
params. We can remember that information.

Fixes: #14178
2024-05-22 22:13:54 +02:00
Misaki Kasumi 4d03efb4b0 ao: don't call driver->set_paused after reset
This commit adds a state `hw_paused` for pull-based AO.
`driver->set_paused(false)` is only called if `hw_paused` is true.
`hw_paused` is cleared after `ao_reset`, so `set_paused` will
not be called after a reset; instead, `driver->start()` will
be called, which properly starts the AO.
2024-05-20 18:22:31 +02:00
Kacper Michajłow e6e0aaa6c6 ad_spdif: add missing codec_desc initialization 2024-05-19 22:09:13 +02:00
Kacper Michajłow 0d18c1bfdc audio: change bps format to int64_t
Same as ffmpeg uses. Such big values does not make sense probably, but
let's not overflow values and maybe one day it will be useful.

Fixes signed integer overflow.
2024-05-10 05:16:27 +02:00
nanahi 467c1e860a Revert "ao: in ao_play_data, wakeup core for untimed AO as well"
This problem does not exist with --demuxer=lavf. --demuxer=mkv just never
signals EOF for the problematic sample, so it needs to be fixed there, not
in AO.

This reverts commit 0cfd52074b.
2024-05-08 11:14:01 +02:00
Misaki Kasumi 0cfd52074b ao: in ao_play_data, wakeup core for untimed AO as well 2024-05-08 03:12:28 +02:00
Christoph Heinrich e166ae0ed8 af_scaletempo: optimize overlap search
scaletempo2 has this optimization where it first uses a step size of 5
together with a quadratic interpolation to quickly get the approximate
position of the best overlap and then does a more thorough search aroun
that area.

Doing the same thing in scaletempo brought a 4.8x performance
improvement, however in my measurements a step size of 3 more
consistently finds good overlaps and it's still a 2.9x improvement for
this function.
I should note that while a step size of 3 produced better numbers,
I was not actually able to hear any difference in my test.

A step size of 3 was chosen just in case it actually makes an audible
difference in some cases and the cpu usage isn't really a problem
anymore, but that can be revisited in the future.

scaletempo2 is still faster then scaletempo with a step size of 5,
which I suspect is mostly because it uses some vectorized functions and
scaletempo does not.
2024-05-07 23:32:55 +02:00
Christoph Heinrich 18ed9e105a af_scaletempo: use taxicab distance for offset search
Cross correlation is the defualt method for correlating signals in
signal processing, but in this case the taxicab distance gets better
results.
2024-05-07 23:32:55 +02:00
Christoph Heinrich 3f6874f4d7 af_scaletempo: don't use a window for offset search
This might seem counter intuitive at first, but we want to change the
sound in total as little as possible, not only the middle part of the
overlap.

This also removes the loop unrolling from the integer path to keep it as
close to the float path as possible. The difference in performance is
fairly small and if such an optimization is deemed desirable in the
future it should be implemented for both float and integer
2024-05-07 23:32:55 +02:00
Christoph Heinrich 2287804739 af_scaletempo: use Hann function for overlap window
Better in theory, but not really noticable.
2024-05-07 23:32:55 +02:00
Christoph Heinrich 3a85fd97e5 af_scaletempo: add comment to overlap calculation
Also reduce pointer dereferences by one. That won't make much of a
difference (if at all), but since it already needs two lines we might
as well.
2024-05-07 23:32:55 +02:00
nanahi 9f5edd4eed various: fix indentation 2024-05-07 11:23:08 +02:00
nanahi f11002cef3 various: fix tabs in code 2024-05-07 11:23:08 +02:00
Kacper Michajłow 3ea684e7ef ao_wasapi_utils: define missing GUIDs for C 2024-05-06 22:01:17 +02:00
Kacper Michajłow 529cc38c67 ao_wasapi_changenotify: fix IsEqualPropertyKey for C 2024-05-06 22:01:17 +02:00
Kacper Michajłow 7253a7dea9 ao_wasapi: fix include order
ks.h has to be included first.
2024-05-06 22:01:17 +02:00
Kacper Michajłow 18ef834ef4 various: move unistd.h inclusion to common.h 2024-05-06 22:01:17 +02:00
ferreum 773c5e2ae0 af_scaletempo2: migrate to internals to talloc
Fixes corrupted audio after resize_input_buffer; realloc_2d did not move
data to new location. Rather than reimplementing more allocator logic,
migrate internals to use talloc and grow buffer with realloc.
2024-04-27 01:05:07 +02:00
ferreum 190b15c827 af_scaletempo2: remove redundant buffer zeroing
First iteration does not overlap with initial buffer contents any more,
so this zeroing was redundant.
2024-04-27 01:05:07 +02:00