Prefer TCP for RTSP streams (#22338)
## Description: For RTSP streams, set the `prefer_tcp` FFMPEG flag. This should resolve some of the "green feed" issues that some users are reporting, likely due to packets being lost over UDP on their network. Resources: [FFMPEG protocols documentation](https://ffmpeg.org/ffmpeg-protocols.html#rtsp) ## Checklist: - [x] The code change is tested and works locally. - [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass** - [x] There is no commented out code in this PR.pull/22420/head
parent
4d0a28fa56
commit
24a55834f9
|
@ -44,6 +44,11 @@ def request_stream(hass, stream_source, *, fmt='hls',
|
|||
if options is None:
|
||||
options = {}
|
||||
|
||||
# For RTSP streams, prefer TCP
|
||||
if isinstance(stream_source, str) \
|
||||
and stream_source[:7] == 'rtsp://' and not options:
|
||||
options['rtsp_flags'] = 'prefer_tcp'
|
||||
|
||||
try:
|
||||
streams = hass.data[DOMAIN][ATTR_STREAMS]
|
||||
stream = streams.get(stream_source)
|
||||
|
|
Loading…
Reference in New Issue