Bump pyAV and close unclosed outputs (#35960)

* bump pyAV and close unclosed outputs

* skip stream from coverage for now

* fix divide by zero error
This commit is contained in:
Jason Hunter 2020-05-22 12:13:37 -04:00 committed by GitHub
parent be416d9fc6
commit 8cd905487e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 4 deletions

View File

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

View File

@ -79,8 +79,11 @@ class StreamOutput:
@property @property
def target_duration(self) -> int: def target_duration(self) -> int:
"""Return the average duration of the segments in seconds.""" """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] 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: def get_segment(self, sequence: int = None) -> Any:
"""Retrieve a specific segment, or the whole list.""" """Retrieve a specific segment, or the whole list."""

View File

@ -2,7 +2,7 @@
"domain": "stream", "domain": "stream",
"name": "Stream", "name": "Stream",
"documentation": "https://www.home-assistant.io/integrations/stream", "documentation": "https://www.home-assistant.io/integrations/stream",
"requirements": ["av==7.0.1"], "requirements": ["av==8.0.1"],
"dependencies": ["http"], "dependencies": ["http"],
"codeowners": ["@hunterjm"], "codeowners": ["@hunterjm"],
"quality_scale": "internal" "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 # Assign the video packet to the new stream & mux
packet.stream = buffer.vstream packet.stream = buffer.vstream
buffer.output.mux(packet) 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 aurorapy==0.2.6
# homeassistant.components.stream # homeassistant.components.stream
av==7.0.1 av==8.0.1
# homeassistant.components.avea # homeassistant.components.avea
avea==1.4 avea==1.4

View File

@ -141,7 +141,7 @@ arcam-fmj==0.4.6
async-upnp-client==0.14.13 async-upnp-client==0.14.13
# homeassistant.components.stream # homeassistant.components.stream
av==7.0.1 av==8.0.1
# homeassistant.components.axis # homeassistant.components.axis
axis==26 axis==26