Revision 67fc8652

View differences:

libavcodec/ac3dec.c
209 209
    s->downmixed = 1;
210 210

  
211 211
    /* allocate context input buffer */
212
    if (avctx->error_recognition >= FF_ER_CAREFUL) {
213 212
        s->input_buffer = av_mallocz(AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
214 213
        if (!s->input_buffer)
215 214
            return AVERROR(ENOMEM);
216
    }
217 215

  
218 216
    avctx->sample_fmt = AV_SAMPLE_FMT_S16;
219 217
    return 0;
......
1314 1312
    const uint8_t *channel_map;
1315 1313
    const float *output[AC3_MAX_CHANNELS];
1316 1314

  
1317
    /* initialize the GetBitContext with the start of valid AC-3 Frame */
1318
    if (s->input_buffer) {
1319 1315
        /* copy input buffer to decoder context to avoid reading past the end
1320 1316
           of the buffer, which can be caused by a damaged input stream. */
1321 1317
        memcpy(s->input_buffer, buf, FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE));
1322
        init_get_bits(&s->gbc, s->input_buffer, buf_size * 8);
1323
    } else {
1318
    buf = s->input_buffer;
1319
    /* initialize the GetBitContext with the start of valid AC-3 Frame */
1324 1320
        init_get_bits(&s->gbc, buf, buf_size * 8);
1325
    }
1326 1321

  
1327 1322
    /* parse the syncinfo */
1328 1323
    *data_size = 0;

Also available in: Unified diff