[vlc-commits] [Git][videolan/vlc][master] mmdevice: stop the stream with the lock held
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Oct 23 10:22:17 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
ed4ca71a by Martin Finkel at 2026-10-23T10:04:59+00:00
mmdevice: stop the stream with the lock held
The session thread calls ProcessTimer() and PlayAll() on sys->stream with
sys->lock held, but Stop() stopped and deleted the stream without it. The
session thread could then play on an IAudioClient that Stop() had already
released, crashing in IAudioClient::GetService().
This happens when the stream is stopped with blocks still queued, for
instance when releasing a player paused near the end of the file after its
drain deadline passed.
Wake up the session thread after detaching the stream so that it stops
waiting on the stream event before it is closed.
Regression from 4521fb451c ("mmdevice: implement nonblocking play").
Co-authored-by: Philip Day <phileday at yahoo.co.uk>
- - - - -
1 changed file:
- modules/audio_output/mmdevice.c
Changes:
=====================================
modules/audio_output/mmdevice.c
=====================================
@@ -1323,15 +1323,19 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
static void Stop(audio_output_t *aout)
{
aout_sys_t *sys = aout->sys;
+ struct aout_stream_owner *owner = sys->stream;
- assert(sys->stream != NULL);
+ assert(owner != NULL);
EnterMTA();
- aout_stream_owner_Stop(sys->stream);
+ vlc_mutex_lock(&sys->lock);
+ aout_stream_owner_Stop(owner);
+ sys->stream = NULL;
+ vlc_mutex_unlock(&sys->lock);
LeaveMTA();
- aout_stream_owner_Delete(sys->stream);
- sys->stream = NULL;
+ SetEvent(sys->work_event);
+ aout_stream_owner_Delete(owner);
}
static void Close(vlc_object_t *);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ed4ca71a3a18a9788c8c830eaae5389ee08c7692
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ed4ca71a3a18a9788c8c830eaae5389ee08c7692
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list