123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- From: =?utf-8?q?Martin_Stegh=C3=B6fer?= <martin@steghoefer.eu>
- Date: Tue, 9 Dec 2014 23:14:08 +0100
- Subject: 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
- libspeex.
- Bug-Debian: https://bugs.debian.org/312185
- Forwarded: https://trac.xiph.org/ticket/1676#comment:1
- ---
- ogg123/speex_format.c | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
- diff --git a/ogg123/speex_format.c b/ogg123/speex_format.c
- index 9aad365..c5a453d 100644
- --- a/ogg123/speex_format.c
- +++ b/ogg123/speex_format.c
- @@ -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;
-
- + speex_stereo_state_destroy(priv->stereo);
- free(priv->comment_packet);
- free(priv->output);
- free(decoder->private);
- @@ -544,7 +546,7 @@ int read_speex_header (decoder_t *decoder)
- priv->st = process_header(&priv->op,
- &priv->frame_size,
- &priv->header,
- - &priv->stereo,
- + priv->stereo,
- decoder->callbacks,
- decoder->callback_arg);
-
|