From a31a6608fef61905e8b3c77ef38f783bf7b21c0b Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Fri, 16 Oct 2020 02:06:49 +0900 Subject: [PATCH] codecs: vp9decoder: handle the show_frame check in base class Same as vp8 decoder update https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1670 Part-of: --- gst-libs/gst/codecs/gstvp9decoder.c | 15 ++++++++++++--- sys/d3d11/gstd3d11vp9dec.c | 11 ++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/gst-libs/gst/codecs/gstvp9decoder.c b/gst-libs/gst/codecs/gstvp9decoder.c index a431e251b8..a292fc8442 100644 --- a/gst-libs/gst/codecs/gstvp9decoder.c +++ b/gst-libs/gst/codecs/gstvp9decoder.c @@ -385,10 +385,19 @@ gst_vp9_decoder_handle_frame (GstVideoDecoder * decoder, gst_buffer_unmap (in_buf, &map); - g_assert (klass->output_picture); + if (!picture->frame_hdr.show_frame) { + GST_LOG_OBJECT (self, "Decode only picture %p", picture); + GST_VIDEO_CODEC_FRAME_SET_DECODE_ONLY (frame); - /* transfer ownership of frame and picture */ - return klass->output_picture (self, frame, picture); + gst_vp9_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: { diff --git a/sys/d3d11/gstd3d11vp9dec.c b/sys/d3d11/gstd3d11vp9dec.c index 081840318b..95c962966f 100644 --- a/sys/d3d11/gstd3d11vp9dec.c +++ b/sys/d3d11/gstd3d11vp9dec.c @@ -472,6 +472,8 @@ gst_d3d11_vp9_dec_output_picture (GstVp9Decoder * decoder, GstBuffer *output_buffer = NULL; GstBuffer *view_buffer; + g_assert (picture->frame_hdr.show_frame); + GST_LOG_OBJECT (self, "Outputting picture %p", picture); view_buffer = (GstBuffer *) gst_vp9_picture_get_user_data (picture); @@ -481,15 +483,6 @@ gst_d3d11_vp9_dec_output_picture (GstVp9Decoder * decoder, goto error; } - if (!picture->frame_hdr.show_frame) { - GST_LOG_OBJECT (self, "Decode only picture %p", picture); - GST_VIDEO_CODEC_FRAME_SET_DECODE_ONLY (frame); - - gst_vp9_picture_unref (picture); - - return gst_video_decoder_finish_frame (vdec, frame); - } - /* if downstream is d3d11 element and forward playback case, * expose our decoder view without copy. In case of reverse playback, however, * we cannot do that since baseclass will store the decoded buffer