Commit ecb7f24b authored by Max Kellermann's avatar Max Kellermann

vorbis_encoder: reinitialize vorbis_dsp_state after flush

libvorbis goes into a very long loop if we try to add data after a flush was invoked by vorbis_analysis_wrote(0). This seems to be a problem with the internal end-of-stream marker. Thus, we cannot reuse the vorbis_dsp_state object.
parent 3888ef2f
......@@ -262,6 +262,13 @@ vorbis_encoder_flush(struct encoder *_encoder, G_GNUC_UNUSED GError **error)
vorbis_analysis_wrote(&encoder->vd, 0);
vorbis_encoder_blockout(encoder);
/* reinitialize vorbis_dsp_state and vorbis_block to reset the
end-of-stream marker */
vorbis_block_clear(&encoder->vb);
vorbis_dsp_clear(&encoder->vd);
vorbis_analysis_init(&encoder->vd, &encoder->vi);
vorbis_block_init(&encoder->vd, &encoder->vb);
encoder->flush = true;
return true;
}
......
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