diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-02-23 20:01:49 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-02-23 20:01:49 +0100 |
| commit | 4d8c69b356f770144c59982c4196846d6f1dc0b0 (patch) | |
| tree | d2d1601e1ff8ffc420bbb238874620ac448811a5 /src | |
| parent | 216ab537915307f5033e8b1fce13bc2517bc4bb9 (diff) | |
Fix assertion failure in AudioBuffers::copy_from() (#1909)win-splash
A number of frames N was being split up into two parts which together
were bigger than N, meaning a copy of one of the parts failed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/writer.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 9ebdd92a3..ad588f0a6 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -306,11 +306,14 @@ Writer::write (shared_ptr<const AudioBuffers> audio, DCPTime const time) end - _audio_reel->period().to }; + /* Be careful that part_lengths[0] + part_lengths[1] can't be bigger than audio->frames() */ Frame part_frames[2] = { part_lengths[0].frames_ceil(afr), - part_lengths[1].frames_ceil(afr) + part_lengths[1].frames_floor(afr) }; + DCPOMATIC_ASSERT ((part_frames[0] + part_frames[1]) <= audio->frames()); + if (part_frames[0]) { shared_ptr<AudioBuffers> part (new AudioBuffers(audio, part_frames[0], 0)); _audio_reel->write (part); |
