summaryrefslogtreecommitdiff
path: root/libavcodec/mimic.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-17 23:16:05 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-03-17 23:16:05 +0100
commit967bdb8572f27b9891fe7bd9b8489146a906633d (patch)
tree61b486be897a4503f71e2ecc7734f16930dc1a94 /libavcodec/mimic.c
parent219a6fb61cb9e6f534f20dc3313442f89b0ffd42 (diff)
parent6ca3b248e21fc48418c4221fc92c2eecaf07cb9b (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: resample: allocate a large enough output buffer fate: fix enc_dec_pcm tests with remote target wmaenc: remove bit-exact hack FATE: remove WMA acodec tests FATE: add WMAv1 and WMAv2 encode/decode tests with fuzzy comparison FATE: add AC-3 and E-AC-3 encode/decode tests with fuzzy comparison qtrle: Use bytestream2 functions to prevent buffer overreads. vqavideo: check malloc return values x11grab: fix a memory leak exposed by valgrind threads: fix old frames returned after avcodec_flush_buffers() MPV: always mark dummy frames as reference h264: fix deadlocks on incomplete reference frame decoding. mpeg4: report frame decoding completion at ff_MPV_frame_end(). mimic: don't use self as reference, and report completion at end of decode(). Conflicts: libavcodec/h264.c libavcodec/qtrle.c libavcodec/resample.c libavcodec/vqavideo.c libavdevice/x11grab.c tests/ref/seek/wmav1_asf tests/ref/seek/wmav2_asf Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mimic.c')
-rw-r--r--libavcodec/mimic.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c
index 4f085b4e5d..05c4b769d8 100644
--- a/libavcodec/mimic.c
+++ b/libavcodec/mimic.c
@@ -259,8 +259,8 @@ static int decode(MimicContext *ctx, int quality, int num_coeffs,
int index = (ctx->cur_index+backref)&15;
uint8_t *p = ctx->flipped_ptrs[index].data[0];
- ff_thread_await_progress(&ctx->buf_ptrs[index], cur_row, 0);
- if(p) {
+ if (index != ctx->cur_index && p) {
+ ff_thread_await_progress(&ctx->buf_ptrs[index], cur_row, 0);
p += src -
ctx->flipped_ptrs[ctx->prev_index].data[plane];
ctx->dsp.put_pixels_tab[1][0](dst, p, stride, 8);
@@ -311,6 +311,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
int width, height;
int quality, num_coeffs;
int swap_buf_size = buf_size - MIMIC_HEADER_SIZE;
+ int res;
if (buf_size <= MIMIC_HEADER_SIZE) {
av_log(avctx, AV_LOG_ERROR, "insufficient data\n");
@@ -378,10 +379,10 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
swap_buf_size>>2);
init_get_bits(&ctx->gb, ctx->swap_buf, swap_buf_size << 3);
- if(!decode(ctx, quality, num_coeffs, !is_pframe)) {
- if (avctx->active_thread_type&FF_THREAD_FRAME)
- ff_thread_report_progress(&ctx->buf_ptrs[ctx->cur_index], INT_MAX, 0);
- else {
+ res = decode(ctx, quality, num_coeffs, !is_pframe);
+ ff_thread_report_progress(&ctx->buf_ptrs[ctx->cur_index], INT_MAX, 0);
+ if (!res) {
+ if (!(avctx->active_thread_type & FF_THREAD_FRAME)) {
ff_thread_release_buffer(avctx, &ctx->buf_ptrs[ctx->cur_index]);
return -1;
}