]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ac3dec.c
silence gcc warning: ‘n_bands’ may be used uninitialized
[ffmpeg] / libavcodec / ac3dec.c
index 3e8b0b5afc1877ece8d3d39b1bf013baa83def04..83edfe5d02c6b177671845b265bb25da0e603bea 100644 (file)
@@ -728,9 +728,10 @@ static void decode_band_structure(GetBitContext *gbc, int blk, int eac3,
                                   int ecpl, int start_subband, int end_subband,
                                   const uint8_t *default_band_struct,
                                   uint8_t *band_struct, int *num_subbands,
-                                  int *num_bands, int *band_sizes)
+                                  int *num_bands, uint8_t *band_sizes)
 {
-    int subbnd, bnd, n_subbands, n_bands, bnd_sz[22];
+    int subbnd, bnd, n_subbands, n_bands=0;
+    uint8_t bnd_sz[22];
 
     n_subbands = end_subband - start_subband;
 
@@ -769,7 +770,7 @@ static void decode_band_structure(GetBitContext *gbc, int blk, int eac3,
     if (num_bands)
         *num_bands = n_bands;
     if (band_sizes)
-        memcpy(band_sizes, bnd_sz, sizeof(int)*n_bands);
+        memcpy(band_sizes, bnd_sz, n_bands);
 }
 
 /**
@@ -1308,6 +1309,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
         const float *output[s->out_channels];
         if (!err && decode_audio_block(s, blk)) {
             av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n");
+            err = 1;
         }
         for (ch = 0; ch < s->out_channels; ch++)
             output[ch] = s->output[ch];