summaryrefslogtreecommitdiff
path: root/apps/codecs/speex.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/speex.c')
-rw-r--r--apps/codecs/speex.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/apps/codecs/speex.c b/apps/codecs/speex.c
index e38a04495c..7a1efa9753 100644
--- a/apps/codecs/speex.c
+++ b/apps/codecs/speex.c
@@ -393,6 +393,9 @@ enum codec_status codec_main(void)
393 void *st = NULL; 393 void *st = NULL;
394 int j = 0; 394 int j = 0;
395 395
396 memset(&bits, 0, sizeof(bits));
397 memset(&oy, 0, sizeof(oy));
398
396 /* Ogg handling still uses mallocs, so reset the malloc buffer per track */ 399 /* Ogg handling still uses mallocs, so reset the malloc buffer per track */
397next_track: 400next_track:
398 error = CODEC_OK; 401 error = CODEC_OK;
@@ -401,16 +404,16 @@ next_track:
401 error = CODEC_ERROR; 404 error = CODEC_ERROR;
402 goto exit; 405 goto exit;
403 } 406 }
407
404 stereo = speex_stereo_state_init(); 408 stereo = speex_stereo_state_init();
409 spx_ogg_sync_init(&oy);
410 spx_ogg_alloc_buffer(&oy,2*CHUNKSIZE);
405 411
406 if (codec_wait_taginfo() != 0) 412 if (codec_wait_taginfo() != 0)
407 goto done; 413 goto done;
408 414
409 strtoffset = ci->id3->offset; 415 strtoffset = ci->id3->offset;
410 416
411 spx_ogg_sync_init(&oy);
412 spx_ogg_alloc_buffer(&oy,2*CHUNKSIZE);
413
414 samplerate = ci->id3->frequency; 417 samplerate = ci->id3->frequency;
415 codec_set_replaygain(ci->id3); 418 codec_set_replaygain(ci->id3);
416 419
@@ -558,7 +561,8 @@ done:
558 561
559 /* Clean things up for the next track */ 562 /* Clean things up for the next track */
560 563
561 speex_decoder_destroy(st); 564 if (st)
565 speex_decoder_destroy(st);
562 566
563 if (stream_init == 1) 567 if (stream_init == 1)
564 spx_ogg_stream_reset(&os); 568 spx_ogg_stream_reset(&os);