Skip to content

Commit

Permalink
Bump pyAV and close unclosed outputs (home-assistant#35960)
Browse files Browse the repository at this point in the history
* bump pyAV and close unclosed outputs

* skip stream from coverage for now

* fix divide by zero error
  • Loading branch information
hunterjm authored May 22, 2020
1 parent be416d9 commit 8cd9054
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,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
Expand Down
5 changes: 4 additions & 1 deletion homeassistant/components/stream/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ def segments(self) -> List[int]:
@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."""
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/stream/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions homeassistant/components/stream/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ arcam-fmj==0.4.6
async-upnp-client==0.14.13

# homeassistant.components.stream
av==7.0.1
av==8.0.1

# homeassistant.components.axis
axis==26
Expand Down

0 comments on commit 8cd9054

Please sign in to comment.