msdk: dec: Add dynamic-configuration change support
authorSreerenj Balachandran <sreerenj.balachandran@intel.com>
Tue, 3 Jul 2018 00:17:49 +0000 (16:17 -0800)
committerSreerenj Balachandran <sreerenj.balachandran@intel.com>
Tue, 3 Jul 2018 00:17:49 +0000 (16:17 -0800)
commit1e95c03c7d4c5e683536ebe5e2d549db9ef4e7a8
tree01475e9bdfd27f772190d56d633b09914c7d5422
parentd5aabd0f58a7fe4c9b0b38303c7952cfc95c1283
msdk: dec: Add dynamic-configuration change support

The patch adds a serios of changes to support dynamic resolution
change and efficient utilization of resources.
Major changes:

-- Use MSDK's apis to retrieve the headers instead of only relying
on upsteram notification. For eg: avc decoder requires SEI header
information for dpb count calculation which we don't get from caps.

-- For all codecs other than VP9, we force the reset of decoder
if resoultion changes to fit with gstreamer flow. VP9 enfource
the hard reset only if the new resolution is bigger.

-- delay the src caps setting till msdk api's invokation in
handle_frame to avoid caching multiple configuration values

-- ensure pool negotiation is based on decoder's allocation_caps.

--dynamic resoluttion change use an explicit allocation_query
to reclaim the buffers before closing the decoder (thanks to v4l2dec)

--In case if we don't get upstream notification of res change (for eg,
this can can happen for vp9 frames with ivfheader where ivfparse
is not able to notify the dynamic changes), we handle the the case
based on MFX_ERR_INCOMPATIBLE_VIDEO_PARAM which is the return value
of MFXVideoDECODE_DecodeFrameAsync

-- calculate the minimum surfaces to be preallocated based on
msdk suggestion, downstream requirement, async depth and scratch surface
count for smooth display.

https://bugzilla.gnome.org/show_bug.cgi?id=796566
sys/msdk/gstmsdkdec.c
sys/msdk/gstmsdkdec.h
sys/msdk/gstmsdkvp9dec.c