[2/2] libgsm: Reset the MS mode of GSM in the flush function

Message ID 1323894841-54801-2-git-send-email-martin@martin.st
State Committed
Commit 1b35af3225392a5328f6534c53e96a56cd5eb305
Headers show

Commit Message

Martin Storsjö Dec. 14, 2011, 8:34 p.m.
The mode is set in libgsm_decode_init, but the decoder
object is simply destroyed and recreated in the flush
function - therefore the mode has to be set again.

This fixes playback using the libgsm decoder in avplay.
---
 libavcodec/libgsm.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Luca Barbato Dec. 14, 2011, 8:37 p.m. | #1
On 14/12/11 21:34, Martin Storsjö wrote:
> The mode is set in libgsm_decode_init, but the decoder
> object is simply destroyed and recreated in the flush
> function - therefore the mode has to be set again.
>
> This fixes playback using the libgsm decoder in avplay.

Ok, I guess.

Patch

diff --git a/libavcodec/libgsm.c b/libavcodec/libgsm.c
index 7623d35..16d9972 100644
--- a/libavcodec/libgsm.c
+++ b/libavcodec/libgsm.c
@@ -212,9 +212,12 @@  static int libgsm_decode_frame(AVCodecContext *avctx, void *data,
 
 static void libgsm_flush(AVCodecContext *avctx) {
     LibGSMDecodeContext *s = avctx->priv_data;
+    int one = 1;
 
     gsm_destroy(s->state);
     s->state = gsm_create();
+    if (avctx->codec_id == CODEC_ID_GSM_MS)
+        gsm_option(s->state, GSM_OPT_WAV49, &one);
 }
 
 AVCodec ff_libgsm_decoder = {