Bump pyAV and close unclosed outputs (#35960)

* bump pyAV and close unclosed outputs

* skip stream from coverage for now

* fix divide by zero error
pull/36070/head
Jason Hunter 2020-05-22 12:13:37 -04:00 committed by Franck Nijhof
parent f4f031e703
commit 9e1c35cfd7
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
6 changed files with 12 additions and 4 deletions

View File

@ -727,6 +727,7 @@ omit =
homeassistant/components/steam_online/sensor.py
homeassistant/components/stiebel_eltron/*
homeassistant/components/stookalert/*
homeassistant/components/stream/*
homeassistant/components/streamlabswater/*
homeassistant/components/suez_water/*
homeassistant/components/supervisord/sensor.py

View File

@ -79,8 +79,11 @@ class StreamOutput:
@property
def target_duration(self) -> int:
"""Return the average duration of the segments in seconds."""
segment_length = len(self._segments)
if not segment_length:
return 0
durations = [s.duration for s in self._segments]
return round(sum(durations) // len(self._segments)) or 1
return round(sum(durations) // segment_length) or 1
def get_segment(self, sequence: int = None) -> Any:
"""Retrieve a specific segment, or the whole list."""

View File

@ -2,7 +2,7 @@
"domain": "stream",
"name": "Stream",
"documentation": "https://www.home-assistant.io/integrations/stream",
"requirements": ["av==7.0.1"],
"requirements": ["av==8.0.1"],
"dependencies": ["http"],
"codeowners": ["@hunterjm"],
"quality_scale": "internal"

View File

@ -164,3 +164,7 @@ def stream_worker(hass, stream, quit_event):
# Assign the video packet to the new stream & mux
packet.stream = buffer.vstream
buffer.output.mux(packet)
# Close stream
buffer.output.close()
container.close()

View File

@ -291,7 +291,7 @@ atenpdu==0.3.0
aurorapy==0.2.6
# homeassistant.components.stream
av==7.0.1
av==8.0.1
# homeassistant.components.avea
avea==1.4

View File

@ -138,7 +138,7 @@ arcam-fmj==0.4.4
async-upnp-client==0.14.13
# homeassistant.components.stream
av==7.0.1
av==8.0.1
# homeassistant.components.axis
axis==25