Commit 422daa25 authored by Timothy B. Terriberry's avatar Timothy B. Terriberry

Fix ogg123 speex stereo: Initialize stereo info data structure

The ogg123 executable wasn't able to correctly play stereo speex
files that don't contain any inband intensity stereo signals at
all or whose first inband intensity stereo signal arrives after
the stream has already started. This was due to the stereo
information data structure not being initialized properly before
the first inband intensity stereo signal arrived. So in the
mentioned cases the speex decoder used uninitialized float
values for the stereo decoding. This patch fixes the problem by
using the proper initialization and deallocation functions from

Patch by Martin_Steghöfer <>
Fixes #1676

svn path=/trunk/vorbis-tools/; revision=19405
parent eead5cf1
......@@ -47,7 +47,7 @@ typedef struct speex_private_t {
ogg_packet op;
ogg_stream_state os;
SpeexBits bits;
SpeexStereoState stereo;
SpeexStereoState *stereo;
SpeexHeader *header;
void *st;
......@@ -142,6 +142,7 @@ decoder_t* speex_init (data_source_t *source, ogg123_options_t *ogg123_opts,
private->comment_packet = NULL;
private->comment_packet_len = 0;
private->header = NULL;
private->stereo = speex_stereo_state_init();
private->stats.total_time = 0.0;
private->stats.current_time = 0.0;
......@@ -234,7 +235,7 @@ int speex_read (decoder_t *decoder, void *ptr, int nbytes, int *eos,
speex_decode(priv->st, &priv->bits, temp_output);
if (audio_fmt->channels==2)
speex_decode_stereo(temp_output, priv->frame_size, &priv->stereo);
speex_decode_stereo(temp_output, priv->frame_size, priv->stereo);
priv->samples_decoded += priv->frame_size;
......@@ -328,6 +329,7 @@ void speex_cleanup (decoder_t *decoder)
speex_private_t *priv = decoder->private;
......@@ -544,7 +546,7 @@ int read_speex_header (decoder_t *decoder)
priv->st = process_header(&priv->op,
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