[vlc-commits] [Git][videolan/vlc][master] 2 commits: wasapi: initialize IAudioClient::Initialize() hnsPeriodicity according to the specs
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Mar 12 16:28:32 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
06190198 by Steve Lhomme at 2026-03-12T15:47:39+00:00
wasapi: initialize IAudioClient::Initialize() hnsPeriodicity according to the specs
hnsPeriodicity documentation [^1]:
> If the AUDCLNT_STREAMFLAGS_EVENTCALLBACK stream flag is set and
> AUDCLNT_SHAREMODE_EXCLUSIVE is set as the ShareMode, then hnsPeriodicity
> must be nonzero and equal to hnsBufferDuration.
Fixes #29645
[^1]: https://learn.microsoft.com/en-us/windows/win32/api/audioclient/nf-audioclient-iaudioclient-initialize
Co-authored-by: Anthony <anthonyyla.dev at gmail.com >
- - - - -
fdefe5c6 by Steve Lhomme at 2026-03-12T15:47:39+00:00
wasapi: initialize IAudioClient::Initialize() hnsBufferDuration/hnsPeriodicity to 0 in shared mode
>From the documentation [^1]:
> For a shared-mode stream that uses event-driven buffering, the caller must
> set both hnsPeriodicity and hnsBufferDuration to 0.
[^1]: https://learn.microsoft.com/en-us/windows/win32/api/audioclient/nf-audioclient-iaudioclient-initialize
- - - - -
2 changed files:
- modules/access/wasapi.c
- modules/audio_output/wasapi.c
Changes:
=====================================
modules/access/wasapi.c
=====================================
@@ -280,6 +280,9 @@ static es_out_id_t *CreateES(demux_t *demux, IAudioClient *client, bool loop,
/* Request at least thrice the PTS delay */
REFERENCE_TIME bufsize = MSFTIME_FROM_VLC_TICK( caching ) * 3;
+ if (flags == AUDCLNT_STREAMFLAGS_EVENTCALLBACK)
+ bufsize = 0;
+
hr = IAudioClient_Initialize(client, AUDCLNT_SHAREMODE_SHARED, flags,
bufsize, 0, pwf, NULL);
CoTaskMemFree(pwf);
=====================================
modules/audio_output/wasapi.c
=====================================
@@ -894,9 +894,14 @@ static HRESULT Start(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
if (sys->s24s32)
msg_Dbg(s, "audio device configured as s24");
+ if (shared_mode == AUDCLNT_SHAREMODE_SHARED)
+ buffer_duration = 0;
+
hr = IAudioClient_Initialize(sys->client, shared_mode,
AUDCLNT_STREAMFLAGS_EVENTCALLBACK,
- buffer_duration, 0, pwf, sid);
+ buffer_duration,
+ shared_mode == AUDCLNT_SHAREMODE_EXCLUSIVE ? buffer_duration : 0,
+ pwf, sid);
CoTaskMemFree(pwf_closest);
if (FAILED(hr))
{
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/362c190d32c9a6755af4baf0772947aed4013303...fdefe5c6346f4fcdf076030ef14ed75bf476fb4e
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/362c190d32c9a6755af4baf0772947aed4013303...fdefe5c6346f4fcdf076030ef14ed75bf476fb4e
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list