From b22514d4697e6253b1b2bcad611cadd6c13f4689 Mon Sep 17 00:00:00 2001 From: Knut Saastad Date: Wed, 14 Oct 2020 23:17:53 +0200 Subject: [PATCH] rtpvp9depay: detect incomplete frames and bail out If a packet with the B bit set arrives but we haven't received a packet with the marker or E bits set to end the previous frame, we know the current frame was incomplete. Part-of: --- gst/rtp/gstrtpvp9depay.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gst/rtp/gstrtpvp9depay.c b/gst/rtp/gstrtpvp9depay.c index b95eb5d913..569fdc856a 100644 --- a/gst/rtp/gstrtpvp9depay.c +++ b/gst/rtp/gstrtpvp9depay.c @@ -313,6 +313,15 @@ gst_rtp_vp9_depay_process (GstRTPBaseDepayload * depay, GstRTPBuffer * rtp) if (G_UNLIKELY (hdrsize >= size)) goto too_small; + /* If this is a start frame AND we are already processing a frame, we need to flush and wait for next start frame */ + if (b_bit) { + if (G_UNLIKELY (self->started)) { + GST_DEBUG_OBJECT (depay, "Incomplete frame, flushing adapter"); + gst_adapter_clear (self->adapter); + self->started = FALSE; + } + } + if (G_UNLIKELY (!self->started)) { /* Check if this is the start of a VP9 layer frame, otherwise bail */ if (!b_bit) {