X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fresampler.cc;h=2c6594a6df7cca9e519c2564040e8a94dd3a52ee;hb=cb330f076f72000d028b11e88702addb0a2ab480;hp=056b2e1ee5c6416e779c7062f48346a858d77923;hpb=db3866008bf2ab1b921c44c4e3c70a909304ac84;p=dcpomatic.git diff --git a/src/lib/resampler.cc b/src/lib/resampler.cc index 056b2e1ee..2c6594a6d 100644 --- a/src/lib/resampler.cc +++ b/src/lib/resampler.cc @@ -81,6 +81,8 @@ Resampler::set_fast () shared_ptr Resampler::run (shared_ptr in) { + DCPOMATIC_ASSERT(in->channels() == _channels); + int in_frames = in->frames (); int in_offset = 0; int out_offset = 0; @@ -131,7 +133,6 @@ Resampler::run (shared_ptr in) break; } - resampled->ensure_size (out_offset + data.output_frames_gen); resampled->set_frames (out_offset + data.output_frames_gen); { @@ -176,7 +177,7 @@ Resampler::flush () throw EncodeError (String::compose(N_("could not run sample-rate converter (%1)"), src_strerror(r))); } - out->ensure_size (out_offset + data.output_frames_gen); + out->set_frames (out_offset + data.output_frames_gen); auto p = data.data_out; auto q = out->data (); @@ -187,7 +188,6 @@ Resampler::flush () } out_offset += data.output_frames_gen; - out->set_frames (out_offset); return out; }