diff options
author | Seungha Yang <seungha@centricular.com> | 2021-04-23 23:20:54 +0900 |
---|---|---|
committer | Seungha Yang <seungha@centricular.com> | 2021-04-24 01:37:01 +0900 |
commit | 00e1561bf2b0ecfa5dbaa1495b9bc14bb3ad7c78 (patch) | |
tree | bd21c96a63a9b6be64345ea8ba580231fc2ae59f /sys/d3d11/gstd3d11mpeg2dec.cpp | |
parent | e4fe65a03ebc0240c16f44af9aa088d6f2613024 (diff) | |
download | gstreamer-plugins-bad-00e1561bf2b0ecfa5dbaa1495b9bc14bb3ad7c78.tar.gz |
d3d11decoder: Set flushing to internal pool on flush event
d3d11 decoders use internal pool for DPB texture and
Gst*Decoder::new_picture() will be blocked if internal pool is full.
We should be able to unblock in on flush-start event as expected.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2192>
Diffstat (limited to 'sys/d3d11/gstd3d11mpeg2dec.cpp')
-rw-r--r-- | sys/d3d11/gstd3d11mpeg2dec.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/sys/d3d11/gstd3d11mpeg2dec.cpp b/sys/d3d11/gstd3d11mpeg2dec.cpp index 2bb91d0ef..4e903dbba 100644 --- a/sys/d3d11/gstd3d11mpeg2dec.cpp +++ b/sys/d3d11/gstd3d11mpeg2dec.cpp @@ -120,7 +120,8 @@ static gboolean gst_d3d11_mpeg2_dec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query); static gboolean gst_d3d11_mpeg2_dec_src_query (GstVideoDecoder * decoder, GstQuery * query); -static gboolean gst_d3d11_mpeg2_dec_flush (GstVideoDecoder * decoder); +static gboolean gst_d3d11_mpeg2_dec_sink_event (GstVideoDecoder * decoder, + GstEvent * event); /* GstMpeg2Decoder */ static gboolean gst_d3d11_mpeg2_dec_new_sequence (GstMpeg2Decoder * decoder, @@ -200,7 +201,8 @@ gst_d3d11_mpeg2_dec_class_init (GstD3D11Mpeg2DecClass * klass, gpointer data) decoder_class->decide_allocation = GST_DEBUG_FUNCPTR (gst_d3d11_mpeg2_dec_decide_allocation); decoder_class->src_query = GST_DEBUG_FUNCPTR (gst_d3d11_mpeg2_dec_src_query); - decoder_class->flush = GST_DEBUG_FUNCPTR (gst_d3d11_mpeg2_dec_flush); + decoder_class->sink_event = + GST_DEBUG_FUNCPTR (gst_d3d11_mpeg2_dec_sink_event); mpeg2decoder_class->new_sequence = GST_DEBUG_FUNCPTR (gst_d3d11_mpeg2_dec_new_sequence); @@ -349,14 +351,23 @@ gst_d3d11_mpeg2_dec_src_query (GstVideoDecoder * decoder, GstQuery * query) } static gboolean -gst_d3d11_mpeg2_dec_flush (GstVideoDecoder * decoder) +gst_d3d11_mpeg2_dec_sink_event (GstVideoDecoder * decoder, GstEvent * event) { GstD3D11Mpeg2Dec *self = GST_D3D11_MPEG2_DEC (decoder); - if (self->d3d11_decoder) - gst_d3d11_decoder_flush (self->d3d11_decoder, decoder); + switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_FLUSH_START: + if (self->d3d11_decoder) + gst_d3d11_decoder_set_flushing (self->d3d11_decoder, decoder, TRUE); + break; + case GST_EVENT_FLUSH_STOP: + if (self->d3d11_decoder) + gst_d3d11_decoder_set_flushing (self->d3d11_decoder, decoder, FALSE); + default: + break; + } - return GST_VIDEO_DECODER_CLASS (parent_class)->flush (decoder); + return GST_VIDEO_DECODER_CLASS (parent_class)->sink_event (decoder, event); } static gboolean |