aboutsummaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorMichael Niedermayer2012-09-20 03:20:29 +0200
committerMichael Niedermayer2012-09-20 03:20:29 +0200
commit61ced71d79ebef22f8ab6ee3511a7a989f6fd3ac (patch)
tree6000ca917b87276d4e29b6ff5ca4fb7d0fee5b30 /libavcodec/mpegvideo.c
parentd57ca5e5a8ba993630c87fbc87ed1f8267309278 (diff)
parent581281e242609a222233a2e5538b89dfb88fb18e (diff)
Merge commit '581281e242609a222233a2e5538b89dfb88fb18e'
* commit '581281e242609a222233a2e5538b89dfb88fb18e': matroskadec: check realloc in lzo encoding matroska: honor error_recognition on unknown doctypes tiffdec: Add support for GRAY16LE. tiffenc: Add support for little endian RGB48 and GRAY16 mpeg4: support frame parameter changes with frame-mt mpegvideo: check ff_find_unused_picture() return value for errors mpegvideo: release frame buffers before freeing them configure: msvc: default to 'lib' as 'ar' tool build: support some non-standard ar variants Conflicts: libavcodec/h263dec.c libavcodec/mpegvideo.c libavcodec/tiff.c libavcodec/tiffenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index c603eeb75e..9e1f67c016 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -552,6 +552,15 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
}
}
+ if (s->height != s1->height || s->width != s1->width || s->context_reinit) {
+ int err;
+ s->context_reinit = 0;
+ s->height = s1->height;
+ s->width = s1->width;
+ if ((err = ff_MPV_common_frame_size_change(s)) < 0)
+ return err;
+ }
+
s->avctx->coded_height = s1->avctx->coded_height;
s->avctx->coded_width = s1->avctx->coded_width;
s->avctx->width = s1->avctx->width;
@@ -1328,8 +1337,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
pic = s->current_picture_ptr;
} else {
i = ff_find_unused_picture(s, 0);
- if (i < 0)
+ if (i < 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n");
return i;
+ }
pic = &s->picture[i];
}
@@ -1393,8 +1404,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
/* Allocate a dummy frame */
i = ff_find_unused_picture(s, 0);
- if (i < 0)
+ if (i < 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n");
return i;
+ }
s->last_picture_ptr = &s->picture[i];
s->last_picture_ptr->f.key_frame = 0;
if (ff_alloc_picture(s, s->last_picture_ptr, 0) < 0) {
@@ -1416,8 +1429,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
s->pict_type == AV_PICTURE_TYPE_B) {
/* Allocate a dummy frame */
i = ff_find_unused_picture(s, 0);
- if (i < 0)
+ if (i < 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n");
return i;
+ }
s->next_picture_ptr = &s->picture[i];
s->next_picture_ptr->f.key_frame = 0;
if (ff_alloc_picture(s, s->next_picture_ptr, 0) < 0) {