hass-core/homeassistant/components/stream/const.py
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

30 lines
986 B
Python

"""Constants for Stream component."""
DOMAIN = "stream"
CONF_STREAM_SOURCE = "stream_source"
CONF_LOOKBACK = "lookback"
CONF_DURATION = "duration"
ATTR_ENDPOINTS = "endpoints"
ATTR_STREAMS = "streams"
ATTR_KEEPALIVE = "keepalive"
SERVICE_RECORD = "record"
OUTPUT_FORMATS = ["hls"]
FORMAT_CONTENT_TYPE = {"hls": "application/vnd.apple.mpegurl"}
OUTPUT_IDLE_TIMEOUT = 300 # Idle timeout due to inactivity
MAX_SEGMENTS = 3 # Max number of segments to keep around
MIN_SEGMENT_DURATION = 1.5 # Each segment is at least this many seconds
PACKETS_TO_WAIT_FOR_AUDIO = 20 # Some streams have an audio stream with no audio
MAX_TIMESTAMP_GAP = 10000 # seconds - anything from 10 to 50000 is probably reasonable
MAX_MISSING_DTS = 6 # Number of packets missing DTS to allow
STREAM_TIMEOUT = 30 # Timeout for reading stream
STREAM_RESTART_INCREMENT = 10 # Increase wait_timeout by this amount each retry
STREAM_RESTART_RESET_TIME = 300 # Reset wait_timeout after this many seconds