Needed e.g. for h264 cropping to work properly.
Unified · Split
| @@ -555,10 +555,8 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) · 554 unmodified lines | ||
| 555 | 555 | |
| 556 | 556 | switch (avctx->codec_type) { |
| 557 | 557 | case AVMEDIA_TYPE_VIDEO: |
| 558 | − if (!frame->width) | |
| 559 | − frame->width = avctx->width; | |
| 560 | − if (!frame->height) | |
| 561 | − frame->height = avctx->height; | |
| 558 | + frame->width = FFMAX(avctx->width, avctx->coded_width); | |
| 559 | + frame->height = FFMAX(avctx->height, avctx->coded_height); | |
| 562 | 560 | if (frame->format < 0) |
| 563 | 561 | frame->format = avctx->pix_fmt; |
| 564 | 562 | if (!frame->sample_aspect_ratio.num) |
| @@ -702,6 +700,9 @@ do { \ · 137 unmodified lines | ||
| 702 | 700 | |
| 703 | 701 | av_buffer_unref(&dummy_buf); |
| 704 | 702 | |
| 703 | + frame->width = avctx->width; | |
| 704 | + frame->height = avctx->height; | |
| 705 | + | |
| 705 | 706 | return 0; |
| 706 | 707 | |
| 707 | 708 | fail: |
| @@ -712,7 +713,14 @@ fail: · 4 unmodified lines | ||
| 712 | 713 | } |
| 713 | 714 | #endif |
| 714 | 715 | |
| 715 | − return avctx->get_buffer2(avctx, frame, flags); | |
| 716 | + ret = avctx->get_buffer2(avctx, frame, flags); | |
| 717 | + | |
| 718 | + if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { | |
| 719 | + frame->width = avctx->width; | |
| 720 | + frame->height = avctx->height; | |
| 721 | + } | |
| 722 | + | |
| 723 | + return ret; | |
| 716 | 724 | } |
| 717 | 725 | |
| 718 | 726 | int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame) |