Unified · Split
| @@ -103,7 +103,6 @@ typedef struct WavpackContext { · 102 unmodified lines | |||
| 103 | WavpackFrameContext **fdec; | 103 | WavpackFrameContext **fdec; |
| 104 | int fdec_num; | 104 | int fdec_num; |
| 105 | 105 | ||
| 106 | int block; | ||
| 107 | int samples; | 106 | int samples; |
| 108 | int ch_offset; | 107 | int ch_offset; |
| 109 | 108 | ||
| @@ -1638,14 +1637,13 @@ static int wavpack_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 1528 unmodified lines | |||
| 1638 | const uint8_t *buf = avpkt->data; | 1637 | const uint8_t *buf = avpkt->data; |
| 1639 | int buf_size = avpkt->size; | 1638 | int buf_size = avpkt->size; |
| 1640 | int frame_size, ret, frame_flags; | 1639 | int frame_size, ret, frame_flags; |
| 1641 | int new_progress = 0; | 1640 | int block = 0, new_progress = 0; |
| 1642 | 1641 | ||
| 1643 | av_assert1(!s->curr_progress || s->dsdctx); | 1642 | av_assert1(!s->curr_progress || s->dsdctx); |
| 1644 | 1643 | ||
| 1645 | if (avpkt->size <= WV_HEADER_SIZE) | 1644 | if (avpkt->size <= WV_HEADER_SIZE) |
| 1646 | return AVERROR_INVALIDDATA; | 1645 | return AVERROR_INVALIDDATA; |
| 1647 | 1646 | ||
| 1648 | s->block = 0; | ||
| 1649 | s->ch_offset = 0; | 1647 | s->ch_offset = 0; |
| 1650 | 1648 | ||
| 1651 | /* determine number of samples */ | 1649 | /* determine number of samples */ |
| @@ -1666,14 +1664,15 @@ static int wavpack_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 14 unmodified lines | |||
| 1666 | if (frame_size <= 0 || frame_size > buf_size) { | 1664 | if (frame_size <= 0 || frame_size > buf_size) { |
| 1667 | av_log(avctx, AV_LOG_ERROR, | 1665 | av_log(avctx, AV_LOG_ERROR, |
| 1668 | "Block %d has invalid size (size %d vs. %d bytes left)\n", | 1666 | "Block %d has invalid size (size %d vs. %d bytes left)\n", |
| 1669 | s->block, frame_size, buf_size); | 1667 | block, frame_size, buf_size); |
| 1670 | ret = AVERROR_INVALIDDATA; | 1668 | ret = AVERROR_INVALIDDATA; |
| 1671 | goto error; | 1669 | goto error; |
| 1672 | } | 1670 | } |
| 1673 | ret = wavpack_decode_block(avctx, frame, s->block, buf, frame_size, &new_progress); | 1671 | ret = wavpack_decode_block(avctx, frame, block, buf, |
| 1672 | frame_size, &new_progress); | ||
| 1674 | if (ret < 0) | 1673 | if (ret < 0) |
| 1675 | goto error; | 1674 | goto error; |
| 1676 | s->block++; | 1675 | block++; |
| 1677 | buf += frame_size; | 1676 | buf += frame_size; |
| 1678 | buf_size -= frame_size; | 1677 | buf_size -= frame_size; |
| 1679 | } | 1678 | } |