gsmdec: fix decoding of audio/ms-gsm variant
authorTim-Philipp Müller <tim@centricular.com>
Fri, 6 Dec 2013 00:22:20 +0000 (00:22 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Tue, 10 Dec 2013 10:57:39 +0000 (10:57 +0000)
Alternates between 33 and 32 byte frames, but must start
with a 33 byte frame. This has been broken for ages since
the element was ported to the audio decoder base class.

https://bugzilla.gnome.org/show_bug.cgi?id=709416

ext/gsm/gstgsmdec.c

index 95c2c11..6547b5f 100644 (file)
@@ -192,17 +192,17 @@ gst_gsmdec_parse (GstAudioDecoder * dec, GstAdapter * adapter,
   size = gst_adapter_available (adapter);
   g_return_val_if_fail (size > 0, GST_FLOW_ERROR);
 
-  /* WAV49 requires alternating 33 and 32 bytes of input */
-  if (gsmdec->use_wav49) {
-    gsmdec->needed = (gsmdec->needed == 33 ? 32 : 33);
-  }
-
   if (size < gsmdec->needed)
     return GST_FLOW_EOS;
 
   *offset = 0;
   *length = gsmdec->needed;
 
+  /* WAV49 requires alternating 33 and 32 bytes of input */
+  if (gsmdec->use_wav49) {
+    gsmdec->needed = (gsmdec->needed == 33 ? 32 : 33);
+  }
+
   return GST_FLOW_OK;
 }