It is the last picture in display order.
Unified · Split
| @@ -426,22 +426,19 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 425 unmodified lines | ||
| 426 | 426 | /* no supplementary picture */ |
| 427 | 427 | if (buf_size == 0) { |
| 428 | 428 | /* special case for last picture */ |
| 429 | − if (s->low_delay == 0 && s->next_pic.ptr) { | |
| 429 | + if ((!s->low_delay || s->skipped_last_frame) && s->next_pic.ptr) { | |
| 430 | 430 | if ((ret = av_frame_ref(pict, s->next_pic.ptr->f)) < 0) |
| 431 | 431 | return ret; |
| 432 | − ff_mpv_unref_picture(&s->next_pic); | |
| 432 | + if (s->skipped_last_frame) { | |
| 433 | + /* If the stream ended with an NVOP, we output the last frame | |
| 434 | + * in display order, but with the props from the last input | |
| 435 | + * packet so that the stream's end time is correct. */ | |
| 436 | + ret = ff_decode_frame_props(avctx, pict); | |
| 437 | + if (ret < 0) | |
| 438 | + return ret; | |
| 439 | + } | |
| 433 | 440 | |
| 434 | − *got_frame = 1; | |
| 435 | − } else if (s->skipped_last_frame && s->cur_pic.ptr) { | |
| 436 | − /* Output the last picture we decoded again if the stream ended with | |
| 437 | − * an NVOP */ | |
| 438 | − if ((ret = av_frame_ref(pict, s->cur_pic.ptr->f)) < 0) | |
| 439 | − return ret; | |
| 440 | − /* Copy props from the last input packet. Otherwise, props from the last | |
| 441 | − * returned picture would be reused */ | |
| 442 | − if ((ret = ff_decode_frame_props(avctx, pict)) < 0) | |
| 443 | − return ret; | |
| 444 | − ff_mpv_unref_picture(&s->cur_pic); | |
| 441 | + ff_mpv_unref_picture(&s->next_pic); | |
| 445 | 442 | |
| 446 | 443 | *got_frame = 1; |
| 447 | 444 | } |