From 0608506bac7a57be28fd274cfaaba8785fbbf96f Mon Sep 17 00:00:00 2001 From: uvjustin <46082645+uvjustin@users.noreply.github.com> Date: Tue, 17 May 2022 11:52:48 +0800 Subject: [PATCH] Reuse codec_context on stream thread restart (#71942) --- homeassistant/components/stream/core.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/homeassistant/components/stream/core.py b/homeassistant/components/stream/core.py index 8db6a239818..8c0b867752e 100644 --- a/homeassistant/components/stream/core.py +++ b/homeassistant/components/stream/core.py @@ -395,6 +395,9 @@ class KeyFrameConverter: This is run by the worker thread and will only be called once per worker. """ + if self._codec_context: + return + # Keep import here so that we can import stream integration without installing reqs # pylint: disable=import-outside-toplevel from av import CodecContext