Commit Graph

2042 Commits

Author SHA1 Message Date
Steve Lhomme cedea4d018 configure: don't the check presence of stricmp
_stricmp a Windows thing that is present in all the CRT, even in UCRT.
The stricmp() deprecated variant doesn't seem to exist elsewhere.

In some configuration it's not possible to link with stricmp() even though
_stricmp() is available.
2023-02-28 10:10:27 +00:00
Alexandre Janniaux b90f1b4c57 audiounit_ios: fix compatibility with iOS < 11
AVAudioSessionRouteSharingPolicy type and values are available starting
with SDK iOS 11. This commit is tagging the structures properly so that
it doesn't raise warning/errors and move the functions to runtime
availability.
2023-02-10 16:59:01 +00:00
Alexandre Janniaux ddb2782a7a audiounit_ios: fix compatibility with iOS < 12
AVAudioSessionMode type is available starting with the SDK for iOS 12,
as well as AVAudioSessionCategory. Use the value directly instead of
storing the values in the variables.
2023-02-10 16:59:01 +00:00
Alexandre Janniaux 7452695091 audiounit_ios: fix compatibility with iOS < 13
AVAudioSessionRouteSharingPolicyLongFormAudio and
AVAudioSessionRouteSharingPolicyLongFormVideo are available starting
with iOS 13.0 and were not available in the previous SDKs, so expose
them as AVAudioSessionRouteSharingPolicyLongForm in older SDKs (which
is the LongFormAudio alias).
2023-02-10 16:59:01 +00:00
Alexandre Janniaux 16b3dd23c5 audiounit_ios: remove extrageneous extern qualifiers
The variable is assigned right where it's defined, so there is no need
for extern, as opposed to a variable declaration.
2023-02-10 16:59:01 +00:00
Steve Lhomme 7fd7db93ab amem: fix restrict usage in start callback
To match the callback in audio_output.
2023-01-30 10:06:19 +00:00
Tristan Matthews bf06b9b984 waveout: do not log error on ENOMEM 2023-01-24 00:30:38 +00:00
Steve Lhomme 95d60de8b5 amem: avoid forward declaration of trivial table 2023-01-17 10:37:49 +00:00
Thomas Guillem 6c08c24b07 audiounit: fix surround input on stereo output
setPreferredOutputNumberOfChannels can fail, don't configure more
channels than accepted. The OS will drop the extra channels instead of
downmixing it.

When I first tested it, the apple TV was configured to always accept
surround even with a stereo output (Change Format = Off) but this is not
necessarily the case.
2023-01-06 07:43:48 +00:00
Thomas Guillem a4b715b3e7 audiounit: fix swap_rear_surround check 2023-01-06 07:43:48 +00:00
Thomas Guillem 9abf0bb2b6 pulse: fix drain if timing update fails (unlikely)
Fixes #27690
2023-01-06 06:15:44 +00:00
Marvin Scholz d5f07af209 meson: add initial meson build system
Co-authored-by: Tanguy Dubroca <tanguy.dubroca@lse.epita.fr>
Co-authored-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
Co-authored-by: Alexandre Janniaux <ajanni@videolabs.io>
2023-01-04 14:48:39 +00:00
Thomas Guillem 242eeb5651 audiounit_ios: don't include IOBufferDuration in latency
But continue to log it.
2023-01-02 11:08:49 +01:00
Thomas Guillem 31ac778fe1 coreaudio: fix timing instability
Only report the timing when all the data has been processed. Indeed, the
timing includes the length of the buffer to write. Reporting the timing
in the middle could cause a difference of [0; IOBufferDuration] (between
0 and 23ms generally).
2023-01-02 11:08:49 +01:00
Thomas Guillem 7eaa685ea4 coreaudio: use clock_gettime_nsec_np()
Instead of mach_absolute_time().

As recommended by the documentation.
2023-01-02 11:08:49 +01:00
Thomas Guillem 871ad624ac coreaudio: add back underrun handling
Regression from 370f785ef6

This is only used as debug purpose.
2022-12-18 14:57:10 +00:00
Thomas Guillem bc8627ed7c coreaudio: change drop/paused handling
Don't set *is_silence to true in case of underrun, if some data was
written.
2022-12-18 14:57:10 +00:00
Thomas Guillem c8cd58f922 coreaudio: don't call AudioUnit API from the render callback
It is very unlikely that AudioUnitGetProperty(kAudioUnitProperty_Latency) can
change midstream (contrary to [AVInstance outputLatency]), so only fetch
this latency when starting the AudioUnit.

This fixes a deadlock between the render callback and AudioUnitStop().

Fixes #27591
2022-12-07 09:01:16 +00:00
Denis Charmet b3f42a9a20 alsa: switch to non blocking play/drain
Fixes #27537
2022-12-06 06:42:58 +00:00
KO Myung-Hun a5e5e64174 kai: make it non-blocking
Fixes #27543.
2022-12-04 09:09:36 +00:00
Thomas Guillem f55b5b53bb coreaudio: remove unused variables 2022-12-02 18:15:23 +00:00
Thomas Guillem 88fd1e684a coreaudio: add the AudioUnit latency to the device latency 2022-12-02 18:15:23 +00:00
Thomas Guillem 9793d068c7 audiounit: poll latency when updating timings
Because AVAudioSessionRouteChangeNotification is not triggered when
switching Speaker <-> Airplay2 (but it is triggered for BT <-> Anything).

Fixes A/V sync with AirPlay2 when Airplay is changed during playback.
2022-12-02 18:15:23 +00:00
Thomas Guillem 8cf10ffda7 audiounit: add IOBufferDuration + kAudioUnitProperty_Latency
Still not happy with the A/V sync when using external devices, even with
this commit.
2022-12-02 18:15:23 +00:00
Thomas Guillem 621effd5f7 audiounit: refactor, add GetLatency()
No functional changes.
2022-12-02 18:15:23 +00:00
Thomas Guillem 9020106341 auhal: add kAudioDevicePropertySafetyOffset to the latency 2022-12-02 18:15:23 +00:00
Thomas Guillem a66624336c auhal: add kAudioStreamPropertyLatency to the latency
Fixes delay with AirPlay devices.

Internal and bluetooth devices have a valid Device Latency.
Airplay 2 devices has a valid Stream Latency.
2022-12-02 18:15:23 +00:00
Thomas Guillem 1bb8234a91 auhal: rework GetLatency
Add logs in case of failure, prepare for the next commit.
2022-12-02 18:15:23 +00:00
Thomas Guillem 3e39b3a4af auhal: move latency retrieval in a new function 2022-12-02 18:15:23 +00:00
Thomas Guillem ad57dc0984 auhal: use the latency offset
Fixes delay with bluetooth devices.

Pretty sure I tested it in the past and it was producing worst results.

Now we match the QuickTime player regarding A/V sync (tested with a
Sync-One2 device).

Fixes #27512
2022-12-02 18:15:23 +00:00
Thomas Guillem db64c3964f coreaudio: assert that frames match bytes 2022-12-02 18:15:23 +00:00
Thomas Guillem c41a355448 coreaudio: simplify flush
The semaphore was needed by the previous atomic circular buffer
implementation.
2022-12-02 18:15:23 +00:00
Thomas Guillem 370f785ef6 coreaudio: rework the render callback
Code written by me few years ago but quite hard to understand (even by
the author), rework it by taking inspiration from the AAudio plugin.

Don't use both mach host time and vlc_tick_t but transform immediatly
the host_time to a delay (in ticks) and always use ticks.
2022-12-02 18:15:23 +00:00
Thomas Guillem 27009027ab coreaudio: add missing chain initialisation 2022-12-02 18:15:23 +00:00
Thomas Guillem 582570aad1 audiotrack: set play non-blocking
Move the big (2seconds) java circular buffer to a frame FIFO and
allocate a java buffer corresponding to the frame size (keep it, and
realloc if the frame become bigger).

Do no wait from play anymore but feed the FIFO instantaneously.

Fixes #27541
2022-12-01 17:54:58 +00:00
Brad Smith 61785764c0 Simplify OSS check by removing OpenBSD specific header check
OpenBSD has long since stopped using OSS in favor of sndio.
2022-11-30 11:02:24 +00:00
Thomas Guillem 84140d6bde aaudio: fetch timestamp immediately
And not after 1 second of playback.
2022-11-26 11:45:56 +00:00
Thomas Guillem 5d809b369d aaudio: handle 0 pos_frames
0 is possible and will happen with the next commit.
Never seen a negative value though.
2022-11-26 11:45:56 +00:00
Thomas Guillem 1de6344575 aaudio: reset timing counter only in case of success
That way, GetFrameTimestampLocked() will be called again just after a
failure (until it succeed, then every 1 seconds).
2022-11-26 11:45:56 +00:00
Thomas Guillem 44df04861d aaudio: simplify silence calculation 2022-11-26 11:45:56 +00:00
Thomas Guillem 76397ea351 coreaudio: set play non-blocking
Fixes #27548
2022-11-23 06:01:04 +00:00
Thomas Guillem 647559915e coreaudio: rename total_frames to total_bytes
Since it's in bytes.
2022-11-23 06:01:04 +00:00
Steve Lhomme 444d5268d9 audio_output: winstore: add a priority so the module can be used by default
Use the same priority as the wasapi module counterpart in non-UWP builds.
2022-11-17 08:36:24 +00:00
Steve Lhomme b95dcf22bd audio_output: fix mmdevice.h include path 2022-11-17 08:36:24 +00:00
Thomas Guillem ebc27c6e40 audiounit_ios: don't fetch the output layout
That way, we will always use MapInputLayout() on tvOS/iOS.
2022-11-05 19:47:45 +00:00
Thomas Guillem cac29a1740 audiounit_ios: move debug log 2022-11-05 19:47:45 +00:00
Thomas Guillem 3d92b1c301 coreaudio: use ChannelDescriptions for MapInputLayout()
Simpler, tested on tvOS 14 and 16. On tvOS, the device can adapt to the
VLC input format, in contrary to macOS.

Fixes 7.1 surround.
2022-11-05 19:47:45 +00:00
Thomas Guillem 704d6fcfa0 coreaudio: remove useless log
There is one more complete just after.
2022-11-05 19:47:45 +00:00
Thomas Guillem 28e4d7fe50 coreaudio: MapInputLayout() can now return any type of AudioChannelLayout 2022-11-05 19:47:45 +00:00
Thomas Guillem c65da6381a coreaudio: rename SetupInputLayout 2022-11-05 19:47:45 +00:00