1 From: =?utf-8?q?Martin_Stegh=C3=B6fer?= <martin@steghoefer.eu>
2 Date: Tue, 9 Dec 2014 23:14:08 +0100
3 Subject: Fix ogg123 speex stereo: Initialize stereo info data structure
5 The ogg123 executable wasn't able to correctly play stereo speex
6 files that don't contain any inband intensity stereo signals at
7 all or whose first inband intensity stereo signal arrives after
8 the stream has already started. This was due to the stereo
9 information data structure not being initialized properly before
10 the first inband intensity stereo signal arrived. So in the
11 mentioned cases the speex decoder used uninitialized float
12 values for the stereo decoding. This patch fixes the problem by
13 using the proper initialization and deallocation functions from
16 Bug-Debian: https://bugs.debian.org/312185
17 Forwarded: https://trac.xiph.org/ticket/1676#comment:1
19 ogg123/speex_format.c | 8 +++++---
20 1 file changed, 5 insertions(+), 3 deletions(-)
22 diff --git a/ogg123/speex_format.c b/ogg123/speex_format.c
23 index 9aad365..c5a453d 100644
24 --- a/ogg123/speex_format.c
25 +++ b/ogg123/speex_format.c
26 @@ -47,7 +47,7 @@ typedef struct speex_private_t {
30 - SpeexStereoState stereo;
31 + SpeexStereoState *stereo;
35 @@ -142,6 +142,7 @@ decoder_t* speex_init (data_source_t *source, ogg123_options_t *ogg123_opts,
36 private->comment_packet = NULL;
37 private->comment_packet_len = 0;
38 private->header = NULL;
39 + private->stereo = speex_stereo_state_init();
41 private->stats.total_time = 0.0;
42 private->stats.current_time = 0.0;
43 @@ -234,7 +235,7 @@ int speex_read (decoder_t *decoder, void *ptr, int nbytes, int *eos,
44 speex_decode(priv->st, &priv->bits, temp_output);
46 if (audio_fmt->channels==2)
47 - speex_decode_stereo(temp_output, priv->frame_size, &priv->stereo);
48 + speex_decode_stereo(temp_output, priv->frame_size, priv->stereo);
50 priv->samples_decoded += priv->frame_size;
52 @@ -328,6 +329,7 @@ void speex_cleanup (decoder_t *decoder)
54 speex_private_t *priv = decoder->private;
56 + speex_stereo_state_destroy(priv->stereo);
57 free(priv->comment_packet);
59 free(decoder->private);
60 @@ -544,7 +546,7 @@ int read_speex_header (decoder_t *decoder)
61 priv->st = process_header(&priv->op,
67 decoder->callback_arg);