diff options
author | Hyunjun Ko <zzoon@igalia.com> | 2018-03-30 11:02:26 -0800 |
---|---|---|
committer | Sreerenj Balachandran <sreerenj.balachandran@intel.com> | 2018-03-30 11:02:26 -0800 |
commit | 762eb970921c2e9168bed81342b467243577d113 (patch) | |
tree | 18d82eabc0bb45dad03570e0ff77e5bb369032ad | |
parent | a53019068da2f86336decd73a96ad4a68ac1b01d (diff) |
msdk: specify the way to find a proper cached response by request
The current way to find proper response by just comparing request's
value is wrong. We need to compare the size of a frame and the
number of suggested frames.
Refer to the sample in https://github.com/Intel-Media-SDK/samples.
https://bugzilla.gnome.org/show_bug.cgi?id=793707
-rw-r--r-- | sys/msdk/gstmsdkallocator_libva.c | 4 | ||||
-rw-r--r-- | sys/msdk/gstmsdkcontext.c | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/sys/msdk/gstmsdkallocator_libva.c b/sys/msdk/gstmsdkallocator_libva.c index 364ee4945..a7fc25389 100644 --- a/sys/msdk/gstmsdkallocator_libva.c +++ b/sys/msdk/gstmsdkallocator_libva.c @@ -56,6 +56,10 @@ gst_msdk_frame_alloc (mfxHDL pthis, mfxFrameAllocRequest * req, GstMsdkAllocResponse *cached = gst_msdk_context_get_cached_alloc_responses_by_request (context, req); if (cached) { + /* check if enough frames were allocated */ + if (req->NumFrameSuggested > cached->response->NumFrameActual) + return MFX_ERR_MEMORY_ALLOC; + *resp = *cached->response; return MFX_ERR_NONE; } diff --git a/sys/msdk/gstmsdkcontext.c b/sys/msdk/gstmsdkcontext.c index 44474743b..883fdb5cf 100644 --- a/sys/msdk/gstmsdkcontext.c +++ b/sys/msdk/gstmsdkcontext.c @@ -354,7 +354,14 @@ _find_request (gconstpointer resp, gconstpointer req) GstMsdkAllocResponse *cached_resp = (GstMsdkAllocResponse *) resp; mfxFrameAllocRequest *_req = (mfxFrameAllocRequest *) req; - return cached_resp ? cached_resp->request.Type != _req->Type : -1; + /* Confirm if it's under the size of the cached response */ + if (_req->Info.Width <= cached_resp->request.Info.Width && + _req->Info.Height <= cached_resp->request.Info.Height) { + return _req->Type & cached_resp-> + request.Type & MFX_MEMTYPE_FROM_DECODE ? 0 : -1; + } + + return -1; } GstMsdkAllocResponse * |