1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-25 05:26:47 +00:00

Minor cleanup on stream (#58486)

* Allow for rounding errors in playlist validation

* Allow EXT-X-TARGETDURATION to change

* Reuse original source in test_record_stream_audio
This commit is contained in:
uvjustin
2021-10-27 04:11:33 +08:00
committed by GitHub
parent 577d8b1469
commit 7024a5d7d9
3 changed files with 30 additions and 19 deletions

View File

@@ -224,7 +224,9 @@ async def test_ll_hls_stream(hass, hls_stream, stream_worker_sync):
datetimes[-1] - datetimes.popleft()
).total_seconds()
if segment_duration:
assert datetime_duration == segment_duration
assert math.isclose(
datetime_duration, segment_duration, rel_tol=1e-3
)
tested[datetime_re] = True
continue
match = inf_re.match(line)
@@ -232,7 +234,7 @@ async def test_ll_hls_stream(hass, hls_stream, stream_worker_sync):
segment_duration = float(match.group("segment_duration"))
# Check that segment durations are consistent with part durations
if len(part_durations) > 1:
assert math.isclose(sum(part_durations), segment_duration)
assert math.isclose(sum(part_durations), segment_duration, rel_tol=1e-3)
tested[inf_re] = True
part_durations.clear()
# make sure all playlist tests were performed