Adjust dts warning messages in stream (#41467)

* Adjust dts warning messages

* Wait for second packet with overflow dts condition

* Rename dts gap watch variable

* Remove out of order packet warning
This commit is contained in:
uvjustin 2020-10-12 00:55:13 +08:00 committed by GitHub
parent 6c18feb4ed
commit 1c6d0d138d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,6 +88,8 @@ def _stream_worker_internal(hass, stream, quit_event):
last_dts = None last_dts = None
# Keep track of consecutive packets without a dts to detect end of stream. # Keep track of consecutive packets without a dts to detect end of stream.
last_packet_was_without_dts = False 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 # Holds the buffers for each stream provider
outputs = None outputs = None
# Keep track of the number of segments we've processed # Keep track of the number of segments we've processed
@ -247,18 +249,17 @@ def _stream_worker_internal(hass, stream, quit_event):
if (last_dts[packet.stream] - packet.dts) > ( if (last_dts[packet.stream] - packet.dts) > (
packet.time_base * MAX_TIMESTAMP_GAP packet.time_base * MAX_TIMESTAMP_GAP
): ):
_LOGGER.warning( if last_packet_had_large_negative_dts_gap:
"Timestamp overflow detected: dts = %s, resetting stream", _LOGGER.warning(
packet.dts, "Timestamp overflow detected: last dts %s, dts = %s, resetting stream",
) last_dts[packet.stream],
finalize_stream() packet.dts,
break )
_LOGGER.warning( finalize_stream()
"Dropping out of order packet: %s <= %s", break
packet.dts, last_packet_had_large_negative_dts_gap = True
last_dts[packet.stream],
)
continue continue
last_packet_had_large_negative_dts_gap = False
# Check for end of segment # Check for end of segment
if packet.stream == video_stream and packet.is_keyframe: if packet.stream == video_stream and packet.is_keyframe: