mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 14:27:07 +00:00
Bugfix camera streams (#5306)
* fix mjpeg streams * fix trow error on close by frontend * fix ffmpeg
This commit is contained in:
parent
6abad6b76e
commit
4b43537801
@ -84,8 +84,14 @@ class FFmpegCamera(Camera):
|
|||||||
if not data:
|
if not data:
|
||||||
break
|
break
|
||||||
response.write(data)
|
response.write(data)
|
||||||
|
|
||||||
|
except asyncio.CancelledError:
|
||||||
|
_LOGGER.debug("Close stream by browser.")
|
||||||
|
response = None
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
self.hass.async_add_job(stream.close())
|
yield from stream.close()
|
||||||
|
if response is not None:
|
||||||
yield from response.write_eof()
|
yield from response.write_eof()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -124,9 +124,13 @@ class MjpegCamera(Camera):
|
|||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
raise HTTPGatewayTimeout()
|
raise HTTPGatewayTimeout()
|
||||||
|
|
||||||
|
except asyncio.CancelledError:
|
||||||
|
_LOGGER.debug("Close stream by browser.")
|
||||||
|
response = None
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
if stream is not None:
|
if stream is not None:
|
||||||
yield from stream.close()
|
stream.close()
|
||||||
if response is not None:
|
if response is not None:
|
||||||
yield from response.write_eof()
|
yield from response.write_eof()
|
||||||
|
|
||||||
|
@ -276,9 +276,13 @@ class SynologyCamera(Camera):
|
|||||||
_LOGGER.exception("Error on %s", streaming_url)
|
_LOGGER.exception("Error on %s", streaming_url)
|
||||||
raise HTTPGatewayTimeout()
|
raise HTTPGatewayTimeout()
|
||||||
|
|
||||||
|
except asyncio.CancelledError:
|
||||||
|
_LOGGER.debug("Close stream by browser.")
|
||||||
|
response = None
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
if stream is not None:
|
if stream is not None:
|
||||||
self.hass.async_add_job(stream.release())
|
stream.close()
|
||||||
if response is not None:
|
if response is not None:
|
||||||
yield from response.write_eof()
|
yield from response.write_eof()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user