Fixes ope_encoder_drain() bug

assert(enc->streams == NULL) would fail because pad_samples was missing
a fractional number of samples due to the resampler output latency not
being an integer.
parent 20a8f327
......@@ -637,7 +637,7 @@ int ope_encoder_drain(OggOpusEnc *enc) {
/* Check if it's already been drained. */
if (enc->streams == NULL) return OPE_TOO_LATE;
if (enc->re) resampler_drain = speex_resampler_get_output_latency(enc->re);
pad_samples = MAX(LPC_PADDING, enc->global_granule_offset + enc->frame_size + resampler_drain);
pad_samples = MAX(LPC_PADDING, enc->global_granule_offset + enc->frame_size + resampler_drain + 1);
if (!enc->streams->stream_is_init) init_stream(enc);
shift_buffer(enc);
assert(enc->buffer_end + pad_samples <= BUFFER_SAMPLES);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment