Revision 4c886d61 libavcodec/ac3dec.c

View differences:

libavcodec/ac3dec.c
1314 1314

  
1315 1315
    /* copy input buffer to decoder context to avoid reading past the end
1316 1316
       of the buffer, which can be caused by a damaged input stream. */
1317
    if (buf_size >= 2 && AV_RB16(buf) == 0x770B) {
1318
        // seems to be byte-swapped AC-3
1319
        int cnt = FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE) >> 1;
1320
        s->dsp.bswap16_buf((uint16_t *)s->input_buffer, (const uint16_t *)buf, cnt);
1321
    } else
1317 1322
        memcpy(s->input_buffer, buf, FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE));
1318 1323
    buf = s->input_buffer;
1319 1324
    /* initialize the GetBitContext with the start of valid AC-3 Frame */

Also available in: Unified diff