From 2db3ce32efaa5c5a1935402632c5b223672a4b40 Mon Sep 17 00:00:00 2001 From: He Junyan Date: Sat, 5 Jun 2021 21:59:50 +0800 Subject: [PATCH] codecs: Fix the H265 poc out of order warning. We always get a warning such as: h265decoder gsth265decoder.c:1432:gst_h265_decoder_do_output_picture: \ Outputting out of order 255 -> 0, likely a broken stream in H265 decoder. The problem is caused because we fail to reset the last_output_poc when we get IDR and BLA. The incoming IDR and BLA frame already bump all the frames in the DPB, but we forget to reset the last_output_poc, which make the POC out of order and generate the warning all the time. Part-of: --- gst-libs/gst/codecs/gsth265decoder.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gst-libs/gst/codecs/gsth265decoder.c b/gst-libs/gst/codecs/gsth265decoder.c index 21f44dc486..dc8240fc5a 100644 --- a/gst-libs/gst/codecs/gsth265decoder.c +++ b/gst-libs/gst/codecs/gsth265decoder.c @@ -1521,6 +1521,14 @@ gst_h265_decoder_dpb_init (GstH265Decoder * self, const GstH265Slice * slice, gst_h265_dpb_delete_unused (priv->dpb); while ((to_output = gst_h265_dpb_bump (priv->dpb, FALSE)) != NULL) gst_h265_decoder_do_output_picture (self, to_output); + + if (gst_h265_dpb_get_size (priv->dpb) > 0) { + GST_WARNING_OBJECT (self, "IDR or BLA frame failed to clear the dpb, " + "there are still %d pictures in the dpb, last output poc is %d", + gst_h265_dpb_get_size (priv->dpb), priv->last_output_poc); + } else { + priv->last_output_poc = 0; + } } } else { gst_h265_dpb_delete_unused (priv->dpb);