Commit graph

13 commits

Author SHA1 Message Date
Allen Porter
0a128d006f
Improve stream robustness by always retrying worker (#66417)
Improve stream robustness by always retrying in the worker on failure, rather than only when
keepalive is enabled.

This will make cloud cameras like nest more robust, since they have a tendency to be flaky. This
is also needed to improve client side retry behavior because when the client attempts to retry,
the stream token is already revoked because the worker stopped.

The worker will still idle timeout if no streams are present, so it won't go on forever if no
frontend is viewing the stream.
2022-02-12 20:59:11 -08:00
Allen Porter
832184bacd
Speed up stream tests by 40-50% with shared data (#62300) 2021-12-18 23:14:21 -08:00
J. Nick Koston
a0cd29bbcf
Fix threading error in stream tests (#62221) 2021-12-17 09:26:30 -08:00
Allen Porter
8ca89b10eb
Split StreamState class out of SegmentBuffer (#60423)
This refactoring was pulled out of https://github.com/home-assistant/core/pull/53676 as an
initial step towards reverting the addition of the SegmentBuffer class, which will be
unrolled back into a for loop.

The StreamState class holds the persistent state in stream that is used across stream worker
instantiations, e.g. state across a retry or url expiration, which primarily handles
discontinuities. By itself, this PR is not a large win until follow up PRs further simplify
the SegmentBuffer class.
2021-11-29 22:25:28 -08:00
uvjustin
9ea338c121
Remove incomplete segment on stream restart (#59532) 2021-11-12 00:59:13 +08:00
J. Nick Koston
10d6247fee
Bump to aiohttp 3.8.0 (#58974) 2021-11-04 10:07:50 -05:00
Ville Skyttä
50e0c58310
Use http.HTTPStatus in components/s* (#58291) 2021-10-23 20:49:04 +02:00
uvjustin
923158cfba
Add ll hls to stream (#49608) 2021-08-29 09:53:41 +08:00
uvjustin
123e8f01a1
Refactor stream to create partial segments (#51282) 2021-06-14 00:41:21 +08:00
Allen Porter
02a82d3f00
Add timeouts in stream tests to prevent possible hangs (#47545)
* Add timeouts on recving packets

Add a timeout when recving packets from the worker thread in case it hangs.
Add an exit condition just in case the while loop goes on forever.

* Add a timeout to recorder thread join.

* Wait for recorder thread to be invoked in tests

Remove the while loop and instead wait for segments to be produced by the background worker thread.

* Allow worker to resume before stopping to fix timeouts

* Lower test timeout further

* Remove test_stream_ended since it is flaky

This test doesn't really add additional value on top of other tests.
2021-03-13 01:53:26 -08:00
Allen Porter
00aebec90d
Fix bug in test found by manual log inspection (#46309) 2021-02-09 21:59:49 -08:00
Allen Porter
dca6a93898
Centralize keepalive logic in Stream class (#45850)
* Remove dependencies on keepalive from StremaOutput and stream_worker

Pull logic from StreamOutput and stream_worker into the Stream
class, unifying keepalive and idle timeout logic. This prepares
for future changes to preserve hls state across stream url changes.
2021-02-08 07:19:41 -08:00
Allen Porter
bf0e012d1e
Repair stream test_recorder.py and mark not flaky (#45054)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-01-20 14:44:24 +01:00