From: Carl Hetherington Date: Sun, 19 Jun 2022 20:45:18 +0000 (+0200) Subject: Use the resampled rate to calculate the slack threshold rather than just 48kHz (... X-Git-Tag: v2.16.16~7 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=f49a724918ad3d1082384576960b1098d7f15822 Use the resampled rate to calculate the slack threshold rather than just 48kHz (#2275). --- diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc index 664a56c2a..ca1faa010 100644 --- a/src/lib/audio_decoder.cc +++ b/src/lib/audio_decoder.cc @@ -58,17 +58,16 @@ AudioDecoder::emit (shared_ptr film, AudioStreamPtr stream, shared_p return; } - /* Amount of error we will tolerate on audio timestamps; see comment below. - * We'll use 1 24fps video frame at 48kHz as this seems to be roughly how - * ffplay does it. - */ - static Frame const slack_frames = 48000 / 24; - int const resampled_rate = _content->resampled_frame_rate(film); if (!time_already_delayed) { time += ContentTime::from_seconds (_content->delay() / 1000.0); } + /* Amount of error we will tolerate on audio timestamps; see comment below. + * We'll use 1 24fps video frame as this seems to be roughly how ffplay does it. + */ + Frame const slack_frames = resampled_rate / 24; + /* first_since_seek is set to true if this is the first data we have received since initialisation or seek. We'll set the position based on the ContentTime that was given. After this first time we just