codecs: vp8decoder: handle the show_frame check in base class.

Move the show_frame check from sub class to vp8 decoder's base class.
Calling the sub class' output_picture() function only when the frame
is displayed and marking the other automatically as decode only.

This is done to avoid logic and code repetition in subclasses.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1670>
This commit is contained in:
He Junyan 2020-10-12 00:57:24 +08:00 committed by GStreamer Merge Bot
parent a31a6608fe
commit 6b3ff669ee

View file

@ -283,6 +283,7 @@ gst_vp8_decoder_handle_frame (GstVideoDecoder * decoder,
GstVp8FrameHdr frame_hdr; GstVp8FrameHdr frame_hdr;
GstVp8ParserResult pres; GstVp8ParserResult pres;
GstVp8Picture *picture = NULL; GstVp8Picture *picture = NULL;
GstFlowReturn ret = GST_FLOW_OK;
GST_LOG_OBJECT (self, GST_LOG_OBJECT (self,
"handle frame, PTS: %" GST_TIME_FORMAT ", DTS: %" "handle frame, PTS: %" GST_TIME_FORMAT ", DTS: %"
@ -363,8 +364,19 @@ gst_vp8_decoder_handle_frame (GstVideoDecoder * decoder,
gst_vp8_decoder_update_reference (self, gst_vp8_picture_ref (picture)); gst_vp8_decoder_update_reference (self, gst_vp8_picture_ref (picture));
g_assert (klass->output_picture); if (!picture->frame_hdr.show_frame) {
return klass->output_picture (self, frame, picture); GST_LOG_OBJECT (self, "Decode only picture %p", picture);
GST_VIDEO_CODEC_FRAME_SET_DECODE_ONLY (frame);
gst_vp8_picture_unref (picture);
ret = gst_video_decoder_finish_frame (GST_VIDEO_DECODER (self), frame);
} else {
g_assert (klass->output_picture);
ret = klass->output_picture (self, frame, picture);
}
return ret;
unmap_and_error: unmap_and_error:
{ {
@ -374,8 +386,6 @@ unmap_and_error:
error: error:
{ {
GstFlowReturn ret;
if (picture) if (picture)
gst_vp8_picture_unref (picture); gst_vp8_picture_unref (picture);