History

avcodec/h263dec: Always output next, not current pic when flushing

It is the last picture in display order.

Andreas Rheinhardt committed 1 year ago

Commit c37fb991 parent 2d4d7df1 file · +10 −13Browse files

Unified · Split

libavcodec/h263dec.c+10−13
@@ -426,22 +426,19 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 425 unmodified lines
426426 /* no supplementary picture */
427427 if (buf_size == 0) {
428428 /* 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) {
430430 if ((ret = av_frame_ref(pict, s->next_pic.ptr->f)) < 0)
431431 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+ }
433440
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);
445442
446443 *got_frame = 1;
447444 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t