File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -158,8 +158,14 @@ class Resampler {
158158 if (channels != _channels || channels == 0 )
159159 throw std::domain_error (" Invalid number of channels in input data." );
160160
161+ // Add a "fudge factor" of 10,000. This is because the actual number of
162+ // output samples generated on the last call when input is terminated can
163+ // be more than the expected number of output samples during mid-stream
164+ // steady-state processing. (Also, when the stream is started, the number
165+ // of output samples generated will generally be zero or otherwise less
166+ // than the number of samples in mid-stream processing.)
161167 const auto new_size =
162- static_cast <size_t >(std::ceil (inbuf.shape [0 ] * sr_ratio));
168+ static_cast <size_t >(std::ceil (inbuf.shape [0 ] * sr_ratio)) + 10000 ;
163169
164170 // allocate output array
165171 std::vector<size_t > out_shape{new_size};
You can’t perform that action at this time.
0 commit comments