Fix Canary camera stream blocking call (#71369)

* fix: Canary stream camera, fix blocker

fixes a "detected blocking call to putrequest inside the event loop. This is causing stability issues. Please report issue for canary doing blocking calls at homeassistant/components/canary/camera.py, line 149: self._live_stream_session.live_stream_url, extra_cmd=self._ffmpeg_arguments" from log file.

* refactor: black formatting changes

tsia
This commit is contained in:
0bmay 2022-05-06 08:00:48 -07:00 committed by GitHub
parent 6984c56cc6
commit 1a00bb9fc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -144,10 +144,11 @@ class CanaryCamera(CoordinatorEntity[CanaryDataUpdateCoordinator], Camera):
if self._live_stream_session is None:
return None
stream = CameraMjpeg(self._ffmpeg.binary)
await stream.open_camera(
self._live_stream_session.live_stream_url, extra_cmd=self._ffmpeg_arguments
live_stream_url = await self.hass.async_add_executor_job(
getattr, self._live_stream_session, "live_stream_url"
)
stream = CameraMjpeg(self._ffmpeg.binary)
await stream.open_camera(live_stream_url, extra_cmd=self._ffmpeg_arguments)
try:
stream_reader = await stream.get_reader()