diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-12-19 22:01:21 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-09-03 10:39:53 +0200 |
| commit | 2835406205bb7d9adfea5b3bae89514915fe5227 (patch) | |
| tree | e4d0f145a8366869e70fbb33d0cd67eee55660ec | |
| parent | 2aaf1c483cff3f11017c351e89e31a9b4f9e96b3 (diff) | |
Tidy up a check to avoid using get().
| -rw-r--r-- | src/lib/player.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc index 42b1733dc..77916a5e5 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -1469,12 +1469,13 @@ Player::emit_audio(shared_ptr<AudioBuffers> data, DCPTime time) DCPOMATIC_ASSERT(film); /* Log if the assert below is about to fail */ - if (_next_audio_time && labs(time.get() - _next_audio_time->get()) > 1) { + auto const diff = _next_audio_time ? DCPTime(time - *_next_audio_time).abs().frames_round(48000) : 0; + if (diff > 1) { film->log()->log(fmt::format("Out-of-sequence emit {} vs {}", time.to_string(), _next_audio_time->to_string()), LogEntry::TYPE_WARNING); } /* This audio must follow on from the previous, allowing for half a sample (at 48kHz) leeway */ - DCPOMATIC_ASSERT(!_next_audio_time || labs(time.get() - _next_audio_time->get()) < 2); + DCPOMATIC_ASSERT(diff < 2); Audio(data, time, film->audio_frame_rate()); _next_audio_time = time + DCPTime::from_frames(data->frames(), film->audio_frame_rate()); } |
