[vlc-devel] [PATCH] aout: wasapi: disable deferred start for Winstore builds
Jean-Baptiste Kempf
jb at videolan.org
Wed Apr 8 16:36:31 CEST 2020
Hello,
I think this is bad: we should not ifdef in WASAPI for WinRT, as much as possible.
On Wed, Apr 8, 2020, at 14:54, Steve Lhomme wrote:
> The timer API is not supported.
>
> Using vlc_timer_schedule() might work but is heavier/slower as it's using
> posix/timer.c which uses a thread to run the callback.
> ---
> modules/audio_output/wasapi.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c
> index 5180e93f8e8..61b6cc13d6f 100644
> --- a/modules/audio_output/wasapi.c
> +++ b/modules/audio_output/wasapi.c
> @@ -91,7 +91,9 @@ static msftime_t GetQPC(void)
> typedef struct aout_stream_sys
> {
> IAudioClient *client;
> +#if !VLC_WINSTORE_APP
> HANDLE hTimer;
> +#endif // !VLC_WINSTORE_APP
>
> #define STARTED_STATE_INIT 0
> #define STARTED_STATE_OK 1
> @@ -111,12 +113,16 @@ typedef struct aout_stream_sys
>
> static void ResetTimer(aout_stream_t *s)
> {
> +#if !VLC_WINSTORE_APP
> aout_stream_sys_t *sys = s->sys;
> if (sys->hTimer != NULL)
> {
> DeleteTimerQueueTimer(NULL, sys->hTimer, INVALID_HANDLE_VALUE);
> sys->hTimer = NULL;
> }
> +#else // VLC_WINSTORE_APP
> + VLC_UNUSED(s);
> +#endif // VLC_WINSTORE_APP
> }
>
> /*** VLC audio output callbacks ***/
> @@ -160,6 +166,7 @@ static HRESULT TimeGet(aout_stream_t *s, vlc_tick_t
> *restrict delay)
> return hr;
> }
>
> +#if !VLC_WINSTORE_APP
> static void CALLBACK StartDeferredCallback(void *val, BOOLEAN timeout)
> {
> aout_stream_t *s = val;
> @@ -170,15 +177,17 @@ static void CALLBACK StartDeferredCallback(void
> *val, BOOLEAN timeout)
> SUCCEEDED(hr) ? STARTED_STATE_OK :
> STARTED_STATE_ERROR);
> (void) timeout;
> }
> +#endif // !VLC_WINSTORE_APP
>
> static HRESULT StartDeferred(aout_stream_t *s, vlc_tick_t date)
> {
> aout_stream_sys_t *sys = s->sys;
> vlc_tick_t written = vlc_tick_from_frac(sys->written, sys->rate);
> vlc_tick_t start_delay = date - vlc_tick_now() - written;
> - DWORD start_delay_ms = start_delay > 0 ? MS_FROM_VLC_TICK(start_delay) : 0;
> BOOL timer_updated = false;
>
> +#if !VLC_WINSTORE_APP
> + DWORD start_delay_ms = start_delay > 0 ?
> MS_FROM_VLC_TICK(start_delay) : 0;
> /* Create or update the current timer */
> if (start_delay_ms > 0)
> {
> @@ -195,6 +204,7 @@ static HRESULT StartDeferred(aout_stream_t *s,
> vlc_tick_t date)
> }
> else
> ResetTimer(s);
> +#endif
>
> if (!timer_updated)
> {
> @@ -747,7 +757,9 @@ static HRESULT Start(aout_stream_t *s,
> audio_sample_format_t *restrict pfmt,
> if (unlikely(sys == NULL))
> return E_OUTOFMEMORY;
> sys->client = NULL;
> +#if !VLC_WINSTORE_APP
> sys->hTimer = NULL;
> +#endif // !VLC_WINSTORE_APP
> atomic_init(&sys->started_state, STARTED_STATE_INIT);
>
> /* Configure audio stream */
> --
> 2.17.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
--
Jean-Baptiste Kempf - President
+33 672 704 734
More information about the vlc-devel
mailing list