mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fix timestamp overflow error in stream (#41951)
This commit is contained in:
parent
eff0c4a494
commit
ce0e08838f
@ -88,8 +88,6 @@ 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
|
||||||
@ -246,20 +244,18 @@ def _stream_worker_internal(hass, stream, quit_event):
|
|||||||
|
|
||||||
# Discard packet if dts is not monotonic
|
# Discard packet if dts is not monotonic
|
||||||
if packet.dts <= last_dts[packet.stream]:
|
if packet.dts <= last_dts[packet.stream]:
|
||||||
if (last_dts[packet.stream] - packet.dts) > (
|
if (
|
||||||
packet.time_base * MAX_TIMESTAMP_GAP
|
packet.time_base * (last_dts[packet.stream] - packet.dts)
|
||||||
|
> MAX_TIMESTAMP_GAP
|
||||||
):
|
):
|
||||||
if last_packet_had_large_negative_dts_gap:
|
_LOGGER.warning(
|
||||||
_LOGGER.warning(
|
"Timestamp overflow detected: last dts %s, dts = %s, resetting stream",
|
||||||
"Timestamp overflow detected: last dts %s, dts = %s, resetting stream",
|
last_dts[packet.stream],
|
||||||
last_dts[packet.stream],
|
packet.dts,
|
||||||
packet.dts,
|
)
|
||||||
)
|
finalize_stream()
|
||||||
finalize_stream()
|
break
|
||||||
break
|
|
||||||
last_packet_had_large_negative_dts_gap = True
|
|
||||||
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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user