X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Faudio_content.cc;h=1fcd335839926f2d77cea716c701ebc666035af0;hb=53d0a9a844841fe10b2720543c032a687c548108;hp=05c388a3e711812dc3ad3ceef1c39d8b01002edd;hpb=5799460dc38bafa1da1ce9f7bf43621d3fadf442;p=dcpomatic.git diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index 05c388a3e..1fcd33583 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -22,6 +22,7 @@ #include "audio_content.h" #include "compose.hpp" #include "config.h" +#include "constants.h" #include "exceptions.h" #include "film.h" #include "frame_rate_change.h" @@ -422,9 +423,11 @@ AudioContent::modify_position (shared_ptr film, DCPTime& pos) const void AudioContent::modify_trim_start(shared_ptr film, ContentTime& trim) const { - DCPOMATIC_ASSERT (!_streams.empty()); - /* XXX: we're in trouble if streams have different rates */ - trim = trim.round (_streams.front()->frame_rate()); + /* When this trim is used it the audio will have been resampled, and using the + * DCP rate here reduces the chance of rounding errors causing audio glitches + * due to errors in placement of audio frames (#2373). + */ + trim = trim.round(film ? film->audio_frame_rate() : 48000); }