Bugfix camera streams (#5306)

* fix mjpeg streams

* fix trow error on close by frontend

* fix ffmpeg
This commit is contained in:
Pascal Vizeli 2017-01-14 00:57:38 +01:00 committed by Paulus Schoutsen
parent 6abad6b76e
commit 4b43537801
3 changed files with 18 additions and 4 deletions

View file

@ -84,9 +84,15 @@ class FFmpegCamera(Camera):
if not data:
break
response.write(data)
except asyncio.CancelledError:
_LOGGER.debug("Close stream by browser.")
response = None
finally:
self.hass.async_add_job(stream.close())
yield from response.write_eof()
yield from stream.close()
if response is not None:
yield from response.write_eof()
@property
def name(self):