1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00
Commit Graph

124 Commits

Author SHA1 Message Date
Robert Hillis
488a636aec
Clean up unused loggers (#57662) 2021-10-14 10:03:38 -07:00
uvjustin
ce186c5935
Only pass libav logger messages when stream logger is set to debug (#57616) 2021-10-14 23:43:00 +08:00
Marc Mueller
d51487f82a
Import Callable from collections.abc (3) (#56777) 2021-09-29 16:19:06 +02:00
Marc Mueller
48bada5a18
Update pylint to 2.11.1 (#56364) 2021-09-18 13:52:59 +02:00
uvjustin
071fcee9a9
Remove byte-range addressed parts in stream (#55396)
Add individually addressed parts
2021-08-30 13:20:19 +08:00
uvjustin
923158cfba
Add ll hls to stream (#49608) 2021-08-29 09:53:41 +08:00
Allen Porter
094f7d38ad
Use buffer at stream start with unsupported audio (#54672)
Add a test that reproduces the issue where resetting the iterator
drops the already read packets. Fix a bug in replace_underlying_iterator
because checking the self._next function turns out not to work since
it points to a bound method so the "is not" check fails.
2021-08-15 21:02:37 -07:00
uvjustin
7a200a5d3b
Fix non monotonic dts error in stream (#53712)
* Use defaultdict for TimestampValidator._last_dts

* Combine filters

* Allow PeekIterator to be updated while preserving buffer

* Fix peek edge case

* Readd is_valid filter to video only iterator
2021-07-30 08:02:33 -07:00
Allen Porter
b3b5ee10b1
Fix mypy type for timestamp validator (#53598) 2021-07-27 22:04:59 -07:00
Allen Porter
022ba31999
Refactor the logic for peeking into the start of the stream (#52699)
* Reset dts validator when container is reset

* Reuse existing dts_validator when disabling audio stream

* Refactor peek logic at the start of a stream

Add a PeekingIterator to support rewinding an iterator so that the code
for adjusting audio streams and start pts can be inlined in the worker.

* Simplification and readability improvements

* Remove unnecessary verbiage from comments and pydoc

* Address pylint errors

* Remove rewind function and just mux the first packet separately

* More cleanup after removing rewind()

* Skip check to self._buffer on every iteration
2021-07-27 08:53:42 -07:00
Marc Mueller
b5cec353cc
Fix pylint issue with stream component c-extension (#52847)
* Rename 'extension-pkg-whitelist' setting to 'extension-pkg-allow-list'
* Add 'av.stream' and 'av.audio.stream'
* Replace 'Any' type hint
2021-07-10 22:58:37 +02:00
uvjustin
b021e2ee8c
Move recorder.py import to runtime (#52682) 2021-07-08 09:20:27 +02:00
Allen Porter
e895b6cd42
Refactor decompression timestamp validation logic in stream component (#52462)
* Refactor dts validation logic into a separate function

Create a decompression timestamp validation function to move the logic out of
the worker into a separate class. This also uses the python itertools.chain
to chain together the initial packets with the remaining packets in the
container iterator, removing additional inline if statements.

* Reset dts validator when container is reset

* Fix typo in a comment

* Reuse existing dts_validator when disabling audio stream
2021-07-07 15:29:15 -07:00
uvjustin
e8b5790846
Clean up stream refactor (#51951)
* Clean up target_duration method

* Consolidate Part creation in one place

* Use BytesIO.read instead of memoryview access

* Change flush() signature
2021-06-20 13:38:02 +08:00
uvjustin
97e77ab229
Improve type hints in stream (#51837)
* Improve type hints in stream

* Fix import locations

* Add stream to .strict-typing

Co-authored-by: Ruslan Sayfutdinov <ruslan@sayfutdinov.com>
2021-06-14 23:59:25 +08:00
uvjustin
123e8f01a1
Refactor stream to create partial segments (#51282) 2021-06-14 00:41:21 +08:00
uvjustin
55f158cf78
Fix HLS idle timer in stream (#51372) 2021-06-02 21:31:39 -07:00
uvjustin
3ca7eb9440
Update HLS playlist in stream (#51191)
* Enable gzip encoding for playlist responses
* Add EXT-X-PROGRAM-DATE-TIME to playlist
* Add EXT-X-START to playlist
* Change EXT-X-VERSION from 7 to 6
* Move idle timer call to recv
* Refactor recv to remove cursor and return bool
* Rename STREAM_TIMEOUT to SOURCE_TIMEOUT
2021-05-30 11:41:23 +08:00
uvjustin
6ad29aec2c
Adjust segment duration calculation in stream (#51149)
* Calculate min segment duration internally

* Rename segments to sequences in StreamOutput

* Fix segment duration calculation in test_worker
2021-05-28 13:36:41 +08:00
uvjustin
38e0cbe964
Change stream sequence number to start from 0 (#51101)
* Use constants for provider strings

* Add last_sequence property
2021-05-27 11:22:31 +08:00
uvjustin
c6f108f7c3
Refactor stream to use bytes (#51066)
* Refactor stream to use bytes
2021-05-26 16:19:09 +08:00
uvjustin
2eb87b8806
Combine StreamBuffer into SegmentBuffer in stream (#51041)
* Combine StreamBuffer into SegmentBuffer in stream

* Use new style type hint in comment
Remove unused member self._segment

* Change reset_av to static helper function

* Change make_new_av to only return OutputContainer
2021-05-24 22:57:07 -07:00
Maciej Bieniek
f212049fc2
Add constructor return type in integrations O-S (#50896) 2021-05-20 15:58:17 +02:00
Ruslan Sayfutdinov
35f304450c
Enable type checks for stream component (#50527)
* Enable type checks for stream component

* Fix pylint
2021-05-13 23:26:11 +02:00
Ruslan Sayfutdinov
8e2b3aab44
Enable strict type checks for camera platform (#50395) 2021-05-10 15:12:15 +02:00
J. Nick Koston
3fa8ffa731
Enable mccabe complexity checks in flake8 (#49616)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-04-25 12:38:40 +02:00
Marc Mueller
c07646db5d
Update typing syntax (#49480)
* Update typing syntax

* Replace typing imports with ones from collections where possible

* Changes after review
2021-04-20 17:40:41 +02:00
Paulus Schoutsen
6604614c39
Move top-level av import behind type checking flag (#49281)
* Move top-level av import behind type checking flag

* Lint
2021-04-15 18:18:25 -07:00
Franck Nijhof
055cdc64c0
Add support for IoT class in manifest (#46935) 2021-04-15 10:21:38 +02:00
Marc Mueller
885f528711
Replace old style type comments (#49103) 2021-04-12 17:07:18 +02:00
Marc Mueller
8e2b5b36b5
Bump pyupgrade to 2.12.0 (#48943) 2021-04-09 09:58:27 -07:00
Erik Montnemery
b0aa64d59c
Replace redacted stream recorder credentials with '****' (#48832) 2021-04-08 12:44:17 -07:00
Franck Nijhof
8d5ce53098
Merge of nested IF-IF cases - S-W (#48372) 2021-03-27 10:54:59 +01:00
uvjustin
cd455e296e
Remove login details before logging stream source (#45398)
* Remove login details before logging stream source

* Convert to str before re

* Use compiled RE

* Add tests and filter log message in worker

* Update import

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* isort

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-03-23 07:30:45 +01:00
Marc Mueller
a3cd1854f6
Update typing 12 (#48073) 2021-03-18 14:31:38 +01:00
uvjustin
14f85d8731
Disable audio stream when ADTS AAC detected (#47441)
* Disable audio stream when ADTS AAC detected

* Use context manager for memoryview

* Fix tests

* Add test

* Fix tests

* Change FakePacket bytearray size to 3
2021-03-06 16:40:49 +01:00
uvjustin
864380e77c
Add allenporter to stream codeowners (#47431) 2021-03-05 15:51:07 +01:00
Marc Mueller
16dcbf1467
Update pylint (#47205) 2021-02-28 22:09:01 -10:00
Allen Porter
715a254913
Handle stream failures in recorder (#47151)
* Handle stream failures in recorder

Fail gracefully with an error message when the recorder is invoked with no segments due to a stream failure.

* Update homeassistant/components/stream/recorder.py

Co-authored-by: uvjustin <46082645+uvjustin@users.noreply.github.com>

Co-authored-by: uvjustin <46082645+uvjustin@users.noreply.github.com>
2021-02-28 18:01:28 -08:00
Allen Porter
97b59023d1
Improve handling for recording start of nest cam stream (#47144)
* Improve handling for start of nest cam stream

Add negative_cts_offsets to segment container options in order to better handle recording at the start of a stream. Nest streams start off with a negative offset, and if the segment container does not support it, then it adjusts the timestamps making it out of order with the next segment as described in issue #46968

* Update homeassistant/components/stream/__init__.py

Co-authored-by: uvjustin <46082645+uvjustin@users.noreply.github.com>

Co-authored-by: uvjustin <46082645+uvjustin@users.noreply.github.com>
2021-02-27 11:20:58 -08:00
uvjustin
f005c68630
Restore stream recorder functionality and add discontinuity support (#46772)
* Add discontinuity support to stream recorder

* Use same container options for both StreamOutputs

* Fix pts adjuster

* Remove redundant/incorrect duplicate hls segment check

* Use same StreamBuffer across outputs

* Remove keepalive check for recorder

* Set output video timescale explicitly

* Disable avoid_negative_ts
2021-02-23 10:37:19 +08:00
Allen Porter
4aa4f7e285
Rollback stream StreamOutput refactoring in PR#46610 (#46684)
* Rollback PR#46610

* Update stream tests post-merge
2021-02-20 06:49:39 -08:00
uvjustin
3c7db7bd5b
Skip repeated segment in stream recorder (#46701)
* Skip repeated segment in stream recorder

* Allow for multiple overlap
2021-02-18 17:00:26 +01:00
Allen Porter
88d143a644
Add discontinuity support to HLS streams and fix nest expiring stream urls (#46683)
* Support HLS stream discontinuity.

* Clarify discontinuity comments

* Signal a stream discontinuity on restart due to stream error

* Apply suggestions from code review

Co-authored-by: uvjustin <46082645+uvjustin@users.noreply.github.com>

* Simplify stream discontinuity logic
2021-02-18 20:26:02 +08:00
Allen Porter
efb172cedd
Fix flaky stream tests due to race in idle timeout callback (#46687) 2021-02-17 01:05:50 -08:00
Allen Porter
aaecd91407
Fix exception in stream idle callback (#46642)
* Fix exception in stream idle callback

Fix bug where idle timeout callback fails if the stream previously exited.

* Add a test for stream idle timeout after stream is stopped.

* Add clarifying comment to idle timer clear method

* Clear hls timer only on stop
2021-02-16 12:10:26 -08:00
Allen Porter
08201d146b
Separate HLS logic out of core StreamOutput to prepare for discontinuity (#46610)
Separate the HLS stream view logic out of StreamOutput since the hls
stream view is about to get more complex to track discontinuities. This
makes the idle timeout, shutdown, and coupling between hls and record
more explicit.
2021-02-16 06:59:43 -08:00
Allen Porter
89aaeb3c35
Refactor stream worker responsibilities for segmenting into a separate class (#46563)
* Remove stream_worker dependencies on Stream

Removee stream_worker dependencies on Stream and split out the logic
for writing segments to a stream buffer.

* Stop calling internal stream methods

* Update homeassistant/components/stream/worker.py

Co-authored-by: uvjustin <46082645+uvjustin@users.noreply.github.com>

* Reuse self._outputs when creating new streams

Co-authored-by: uvjustin <46082645+uvjustin@users.noreply.github.com>
2021-02-15 09:52:37 -08:00
uvjustin
acde33dbbc
Keep 1 extra segment around after playlist removal (#46310)
* Keep 1 extra segment around after playlist removal

* Remove segments length check
2021-02-10 15:51:16 -05:00
uvjustin
1fea24502c
Bump pyav version to 8.03 (#46315) 2021-02-10 18:14:03 +08:00