OSDN Git Service

Merge commit '031be5b41b54c3b666f31d83fe3ad41c194af8c5'
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 14 Jul 2013 10:10:38 +0000 (12:10 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 14 Jul 2013 10:10:38 +0000 (12:10 +0200)
* commit '031be5b41b54c3b666f31d83fe3ad41c194af8c5':
  ac3dec: Consistently use AC3_BLOCK_SIZE and sizeof

Conflicts:
libavcodec/ac3dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/ac3dec.c

@@@ -1374,9 -1370,11 +1374,9 @@@ static int ac3_decode_frame(AVCodecCont
          avctx->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;
  
      /* get output buffer */
-     frame->nb_samples = s->num_blocks * 256;
+     frame->nb_samples = s->num_blocks * AC3_BLOCK_SIZE;
 -    if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
 -        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
 +    if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
          return ret;
 -    }
  
      /* decode the audio blocks */
      channel_map = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on];
          }
          if (err)
              for (ch = 0; ch < s->out_channels; ch++)
-                 memcpy(((float*)frame->data[ch]) + AC3_BLOCK_SIZE*blk, output[ch], 1024);
 -                memcpy(s->outptr[channel_map[ch]], output[ch], sizeof(**output) * AC3_BLOCK_SIZE);
++                memcpy(((float*)frame->data[ch]) + AC3_BLOCK_SIZE*blk, output[ch], sizeof(**output) * AC3_BLOCK_SIZE);
          for (ch = 0; ch < s->out_channels; ch++)
              output[ch] = s->outptr[channel_map[ch]];
 -        for (ch = 0; ch < s->channels; ch++)
 -            s->outptr[ch] += AC3_BLOCK_SIZE;
 +        for (ch = 0; ch < s->out_channels; ch++) {
 +            if (!ch || channel_map[ch])
 +                s->outptr[channel_map[ch]] += AC3_BLOCK_SIZE;
 +        }
      }
  
 +    av_frame_set_decode_error_flags(frame, err ? FF_DECODE_ERROR_INVALID_BITSTREAM : 0);
 +
      /* keep last block for error concealment in next frame */
      for (ch = 0; ch < s->out_channels; ch++)
-         memcpy(s->output[ch], output[ch], 1024);
+         memcpy(s->output[ch], output[ch], sizeof(**output) * AC3_BLOCK_SIZE);
  
      *got_frame_ptr = 1;