diff --git a/mythtv/external/FFmpeg/libavcodec/h264.c b/mythtv/external/FFmpeg/libavcodec/h264.c
index 4e6d6a5..f3098d9 100644
a
|
b
|
static void decode_postinit(H264Context *h, int setup_finished) |
1601 | 1601 | s->low_delay = 0; |
1602 | 1602 | } |
1603 | 1603 | |
1604 | | for (i = 0; 1; i++) { |
1605 | | if(i == MAX_DELAYED_PIC_COUNT || cur->poc < h->last_pocs[i]){ |
1606 | | if(i) |
1607 | | h->last_pocs[i-1] = cur->poc; |
1608 | | break; |
1609 | | } else if(i) { |
1610 | | h->last_pocs[i-1]= h->last_pocs[i]; |
1611 | | } |
1612 | | } |
1613 | | out_of_order = MAX_DELAYED_PIC_COUNT - i; |
1614 | | if( cur->f.pict_type == AV_PICTURE_TYPE_B |
1615 | | || (h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > INT_MIN && h->last_pocs[MAX_DELAYED_PIC_COUNT-1] - h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > 2)) |
1616 | | out_of_order = FFMAX(out_of_order, 1); |
1617 | | if(s->avctx->has_b_frames < out_of_order && !h->sps.bitstream_restriction_flag){ |
1618 | | av_log(s->avctx, AV_LOG_WARNING, "Increasing reorder buffer to %d\n", out_of_order); |
1619 | | s->avctx->has_b_frames = out_of_order; |
1620 | | s->low_delay = 0; |
1621 | | } |
1622 | | |
1623 | 1604 | pics = 0; |
1624 | 1605 | while (h->delayed_pic[pics]) |
1625 | 1606 | pics++; |
… |
… |
static void decode_postinit(H264Context *h, int setup_finished) |
1645 | 1626 | h->next_outputed_poc = INT_MIN; |
1646 | 1627 | out_of_order = out->poc < h->next_outputed_poc; |
1647 | 1628 | |
| 1629 | if(h->sps.bitstream_restriction_flag && s->avctx->has_b_frames >= h->sps.num_reorder_frames) |
| 1630 | { } |
| 1631 | else if (out_of_order && pics-1 == s->avctx->has_b_frames && |
| 1632 | s->avctx->has_b_frames < MAX_DELAYED_PIC_COUNT) { |
| 1633 | int cnt = 0, invalid = 0; |
| 1634 | for (i = 0; i < MAX_DELAYED_PIC_COUNT; i++) { |
| 1635 | cnt += out->poc < h->last_pocs[i]; |
| 1636 | invalid += h->last_pocs[i] == INT_MIN; |
| 1637 | } |
| 1638 | if (invalid + cnt < MAX_DELAYED_PIC_COUNT) { |
| 1639 | s->avctx->has_b_frames = FFMAX(s->avctx->has_b_frames, cnt); |
| 1640 | } else if (cnt) { |
| 1641 | for (i = 0; i < MAX_DELAYED_PIC_COUNT; i++) |
| 1642 | h->last_pocs[i] = INT_MIN; |
| 1643 | } |
| 1644 | s->low_delay = 0; |
| 1645 | } else if (s->low_delay && |
| 1646 | ((h->next_outputed_poc != INT_MIN && out->poc > h->next_outputed_poc + 2) || |
| 1647 | cur->f.pict_type == AV_PICTURE_TYPE_B)) { |
| 1648 | s->low_delay = 0; |
| 1649 | s->avctx->has_b_frames++; |
| 1650 | } |
| 1651 | |
1648 | 1652 | if (out_of_order || pics > s->avctx->has_b_frames) { |
1649 | 1653 | out->f.reference &= ~DELAYED_PIC_REF; |
1650 | 1654 | // for frame threading, the owner must be the second field's thread or |
… |
… |
static void decode_postinit(H264Context *h, int setup_finished) |
1653 | 1657 | for (i = out_idx; h->delayed_pic[i]; i++) |
1654 | 1658 | h->delayed_pic[i] = h->delayed_pic[i + 1]; |
1655 | 1659 | } |
| 1660 | memmove(h->last_pocs, &h->last_pocs[1], sizeof(*h->last_pocs) * (MAX_DELAYED_PIC_COUNT - 1)); |
| 1661 | h->last_pocs[MAX_DELAYED_PIC_COUNT - 1] = out->poc; |
1656 | 1662 | if (!out_of_order && pics > s->avctx->has_b_frames) { |
1657 | 1663 | h->next_output_pic = out; |
1658 | 1664 | if (out_idx == 0 && h->delayed_pic[0] && (h->delayed_pic[0]->f.key_frame || h->delayed_pic[0]->mmco_reset)) { |