codecs: vp9decoder: Make duplicate_picture() vfunc optional

The default implementation was required when superframe parsing
was handled by vp9decoder. For instance, if a superframe consists
of multiple frames with show_existing_frame header, it was vague
that which GstVp9Picture should consume GstVideoCodecFrame.

After 1.18 release, we introduced vp9parse element and
superframe should be handled by upstream vp9parse elemenet now.
So, we don't need to care about the superframe at vp9decoder class
level anymore. Simply, a frame corresponding to show_existing_frame
can be dropped if subclass doesn't implement duplicate_picture().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2151>
This commit is contained in:
Seungha Yang 2021-04-09 12:45:46 +09:00 committed by GStreamer Marge Bot
parent 933ebba435
commit f7a341a1f0

View file

@ -94,8 +94,6 @@ static GstFlowReturn gst_vp9_decoder_drain (GstVideoDecoder * decoder);
static GstFlowReturn gst_vp9_decoder_handle_frame (GstVideoDecoder * decoder,
GstVideoCodecFrame * frame);
static GstVp9Picture *gst_vp9_decoder_duplicate_picture_default (GstVp9Decoder *
decoder, GstVideoCodecFrame * frame, GstVp9Picture * picture);
static void
gst_vp9_decoder_class_init (GstVp9DecoderClass * klass)
@ -110,9 +108,6 @@ gst_vp9_decoder_class_init (GstVp9DecoderClass * klass)
decoder_class->drain = GST_DEBUG_FUNCPTR (gst_vp9_decoder_drain);
decoder_class->handle_frame =
GST_DEBUG_FUNCPTR (gst_vp9_decoder_handle_frame);
klass->duplicate_picture =
GST_DEBUG_FUNCPTR (gst_vp9_decoder_duplicate_picture_default);
}
static void
@ -245,18 +240,6 @@ gst_vp9_decoder_drain (GstVideoDecoder * decoder)
return GST_FLOW_OK;
}
static GstVp9Picture *
gst_vp9_decoder_duplicate_picture_default (GstVp9Decoder * decoder,
GstVideoCodecFrame * frame, GstVp9Picture * picture)
{
GstVp9Picture *new_picture;
new_picture = gst_vp9_picture_new ();
new_picture->frame_hdr = picture->frame_hdr;
return new_picture;
}
static GstFlowReturn
gst_vp9_decoder_handle_frame (GstVideoDecoder * decoder,
GstVideoCodecFrame * frame)
@ -338,7 +321,16 @@ gst_vp9_decoder_handle_frame (GstVideoDecoder * decoder,
goto unmap_and_error;
}
g_assert (klass->duplicate_picture);
/* If not implemented by subclass, we can just drop this picture
* since this frame header indicates the frame index to be duplicated
* and also this frame header doesn't affect reference management */
if (!klass->duplicate_picture) {
gst_buffer_unmap (in_buf, &map);
GST_VIDEO_CODEC_FRAME_SET_DECODE_ONLY (frame);
gst_video_decoder_finish_frame (GST_VIDEO_DECODER (self), frame);
}
pic_to_dup = priv->dpb->pic_list[frame_hdr.frame_to_show_map_idx];
picture = klass->duplicate_picture (self, frame, pic_to_dup);