changeset 10415:e16322231312 libavcodec

mlp: Only initialize VLC tables once. This caused a crash when multiple instances of the decoder were started at different times. Bug reported by Maxim Anisiutkin.
author ramiro
date Fri, 16 Oct 2009 16:10:00 +0000
parents 41bd795ae40b
children 1052fe7823e8
files mlpdec.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mlpdec.c	Fri Oct 16 16:03:26 2009 +0000
+++ b/mlpdec.c	Fri Oct 16 16:10:00 2009 +0000
@@ -155,6 +155,7 @@
 
 static av_cold void init_static(void)
 {
+    if (!huff_vlc[0].bits) {
     INIT_VLC_STATIC(&huff_vlc[0], VLC_BITS, 18,
                 &ff_mlp_huffman_tables[0][0][1], 2, 1,
                 &ff_mlp_huffman_tables[0][0][0], 2, 1, 512);
@@ -164,6 +165,7 @@
     INIT_VLC_STATIC(&huff_vlc[2], VLC_BITS, 15,
                 &ff_mlp_huffman_tables[2][0][1], 2, 1,
                 &ff_mlp_huffman_tables[2][0][0], 2, 1, 512);
+    }
 
     ff_mlp_init_crc();
 }