[vlc-commits] demux: avi: add workaround for broken ADPCM rate/scale (fix #12726)

Francois Cartegnie git at videolan.org
Wed Apr 15 00:07:57 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Apr 14 23:58:20 2015 +0200| [ed21c7bd263d4709d2955de040c63e76a22910a5] | committer: Francois Cartegnie

demux: avi: add workaround for broken ADPCM rate/scale (fix #12726)

Some muxer is trowing incorrect rate/scale and then duration.
As we're not computing pts from fully decoded samples, we need
a correct pts for avcodec input. Fix is possible since ADPCM uses
a fixed bits/sample and header.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ed21c7bd263d4709d2955de040c63e76a22910a5
---

 modules/demux/avi/avi.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 34a3362..767333a 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -451,6 +451,14 @@ static int Open( vlc_object_t * p_this )
                     tk->i_samplesize = 0; /* ADTS/AAC VBR */
                 }
 
+                /* Fix broken scale/rate */
+                if ( tk->i_codec == VLC_CODEC_ADPCM_IMA_WAV &&
+                     tk->i_samplesize && tk->i_samplesize > tk->i_rate )
+                {
+                    tk->i_scale = 1017;
+                    tk->i_rate = p_auds->p_wf->nSamplesPerSec;
+                }
+
                 es_format_Init( &fmt, AUDIO_ES, tk->i_codec );
 
                 fmt.audio.i_channels        = p_auds->p_wf->nChannels;



More information about the vlc-commits mailing list