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.
This commit is contained in:
Max Kellermann 2009-04-25 18:27:39 +02:00
parent 3888ef2f55
commit ecb7f24b01

View File

@ -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;
}