From ecb7f24b01e884aa031c6879268060645cb5d7a6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 25 Apr 2009 18:27:39 +0200 Subject: 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. --- src/encoder/vorbis_encoder.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/encoder/vorbis_encoder.c') diff --git a/src/encoder/vorbis_encoder.c b/src/encoder/vorbis_encoder.c index b2b71f335..2e54b18d3 100644 --- a/src/encoder/vorbis_encoder.c +++ b/src/encoder/vorbis_encoder.c @@ -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; } -- cgit v1.2.3