From 89bcdbe1acd9586212849be1f1ebf850baa55654 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 21 Oct 2024 21:09:21 +0200 Subject: [PATCH] [media.vlc] Fixed a non-easily reproducible deadlock. The VLC event callback handler shouldn't try and access the media and/or the MRL while processing a `MediaPlayerTitleChanged` event. It seems that in some particular streaming cases (mostly reproducible with Jellyfin media URLs) this may result in deadlocks - probably because the media metadata is being handled within the HTTP request, and the callback handler runs within the same context. --- platypush/plugins/media/vlc/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/platypush/plugins/media/vlc/__init__.py b/platypush/plugins/media/vlc/__init__.py index caf3ae30da..0183c612fd 100644 --- a/platypush/plugins/media/vlc/__init__.py +++ b/platypush/plugins/media/vlc/__init__.py @@ -205,7 +205,14 @@ class MediaVlcPlugin(MediaPlugin): self.logger.debug('Received VLC event: %s', event.type) playing_url = None - if self._player: + if ( + self._player + and + # Avoid a weird deadlock when trying to get the media URL and + # we are processing a MediaPlayerTitleChanged event (probably + # because the media metadata is being updated) + event.type != EventType.MediaPlayerTitleChanged # type: ignore + ): media = self._player.get_media() playing_url = media.get_mrl() if media else None