Commit c56c3f3f authored by Thomas Guillem's avatar Thomas Guillem
Browse files

clock: check for pcr_delay validity

Don't wait more than CR_MAX_GAP. The CR_MAX_GAP might be too big
(60 seconds). This algorithm, like the one in input_clock.c could be
improved by comparing stream and system date.

This a work around buggy demuxers or corrupted samples/streams. That is
the reason that the new log should draw attention to developers.
parent ef14ac9a
......@@ -235,11 +235,17 @@ vlc_clock_monotonic_to_system_locked(vlc_clock_t *clock, vlc_tick_t now,
* ride of the input clock. This code is adapted from input_clock.c and
* is used to introduce the same delay than the input clock (first PTS
* - first PCR). */
const vlc_tick_t pcr_delay =
vlc_tick_t pcr_delay =
main_clock->first_pcr.system == VLC_TICK_INVALID ? 0 :
(ts - main_clock-> / rate +
main_clock->first_pcr.system - now;
if (pcr_delay > CR_MAX_GAP)
vlc_error(main_clock->logger, "Invalid PCR delay ! Ignoring it...");
pcr_delay = 0;
const vlc_tick_t input_delay = main_clock->input_dejitter + pcr_delay;
const vlc_tick_t delay =
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment