From 2835406205bb7d9adfea5b3bae89514915fe5227 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 19 Dec 2024 22:01:21 +0100 Subject: Tidy up a check to avoid using get(). --- src/lib/player.cc | 5 +++-- 1 file 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 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()); } -- cgit v1.2.3