Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust dts warning messages in stream #41467

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions homeassistant/components/stream/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ def _stream_worker_internal(hass, stream, quit_event):
last_dts = None
# Keep track of consecutive packets without a dts to detect end of stream.
last_packet_was_without_dts = False
# Keep track of consecutive packets with a large dts gap to detect an overflow.
last_packet_had_large_negative_dts_gap = False
# Holds the buffers for each stream provider
outputs = None
# Keep track of the number of segments we've processed
Expand Down Expand Up @@ -237,18 +239,17 @@ def finalize_stream():
if (last_dts[packet.stream] - packet.dts) > (
packet.time_base * MAX_TIMESTAMP_GAP
):
_LOGGER.warning(
"Timestamp overflow detected: dts = %s, resetting stream",
packet.dts,
)
finalize_stream()
break
_LOGGER.warning(
"Dropping out of order packet: %s <= %s",
packet.dts,
last_dts[packet.stream],
)
if last_packet_had_large_negative_dts_gap:
_LOGGER.warning(
"Timestamp overflow detected: last dts %s, dts = %s, resetting stream",
last_dts[packet.stream],
packet.dts,
)
finalize_stream()
break
last_packet_had_large_negative_dts_gap = True
continue
last_packet_had_large_negative_dts_gap = False

# Check for end of segment
if packet.stream == video_stream and packet.is_keyframe:
Expand Down