diff options
author | Hyunjun Ko <zzoon@igalia.com> | 2018-03-08 11:37:52 -0900 |
---|---|---|
committer | Sreerenj Balachandran <sreerenj.balachandran@intel.com> | 2018-03-08 11:37:52 -0900 |
commit | 37ef61586adaa295902515d69fca0f30b0e7ecaa (patch) | |
tree | 97570b3aa89ad4d905df1d273d248db296638058 | |
parent | b08b8ddae3d636b2a37b1206c6354e94d8c43295 (diff) |
msdk: dec: remove code to manage buffers with locked surface
https://bugzilla.gnome.org/show_bug.cgi?id=793413
-rw-r--r-- | sys/msdk/gstmsdkdec.c | 67 | ||||
-rw-r--r-- | sys/msdk/gstmsdkdec.h | 1 |
2 files changed, 2 insertions, 66 deletions
diff --git a/sys/msdk/gstmsdkdec.c b/sys/msdk/gstmsdkdec.c index d98e107175..5801c5d9e9 100644 --- a/sys/msdk/gstmsdkdec.c +++ b/sys/msdk/gstmsdkdec.c @@ -81,7 +81,6 @@ allocate_output_buffer (GstMsdkDec * thiz, GstBuffer ** buffer) GstFlowReturn flow; GstVideoCodecFrame *frame; GstVideoDecoder *decoder = GST_VIDEO_DECODER (thiz); - mfxFrameSurface1 *mfx_surface; frame = gst_video_decoder_get_oldest_frame (decoder); if (!frame) { @@ -92,26 +91,11 @@ allocate_output_buffer (GstMsdkDec * thiz, GstBuffer ** buffer) } if (!frame->output_buffer) { - retry: flow = gst_video_decoder_allocate_output_frame (decoder, frame); if (flow != GST_FLOW_OK) { gst_video_codec_frame_unref (frame); return flow; } - - if (gst_msdk_is_msdk_buffer (frame->output_buffer)) { - mfx_surface = gst_msdk_get_surface_from_buffer (frame->output_buffer); - /* When using video memory, mfx surface is still locked even though - * it's finished by SyncOperation. There's no way to get notified when it gets unlocked. - * We should be keep these buffers and check if it's unlocked. - */ - if (mfx_surface && mfx_surface->Data.Locked) { - thiz->locked_buffer = - g_list_append (thiz->locked_buffer, frame->output_buffer); - frame->output_buffer = NULL; - goto retry; - } - } } *buffer = gst_buffer_ref (frame->output_buffer); @@ -159,24 +143,12 @@ get_surface (GstMsdkDec * thiz, GstBuffer * buffer) GST_MAP_WRITE)) goto failed_unref_buffer; - retry: if (gst_buffer_pool_acquire_buffer (thiz->pool, &buffer, NULL) != GST_FLOW_OK) goto failed_unmap_copy; - if (gst_msdk_is_msdk_buffer (buffer)) { - i->surface = gst_msdk_get_surface_from_buffer (buffer); - - /* When using video memory, mfx surface is still locked even though - * it's finished by SyncOperation. There's no way to get notified when it gets unlocked. - * We should keep these buffers and check if it's unlocked. - */ - if (i->surface->Data.Locked) { - thiz->locked_buffer = g_list_append (thiz->locked_buffer, buffer); - goto retry; - } - i->buf = buffer; - } + i->surface = gst_msdk_get_surface_from_buffer (buffer); + i->buf = buffer; if (!gst_video_frame_map (&i->data, &thiz->pool_info, buffer, GST_MAP_READWRITE)) @@ -584,35 +556,6 @@ release_msdk_surfaces (GstMsdkDec * thiz) } } -static void -release_locked_buffer (GstMsdkDec * thiz) -{ - GList *l; - GstBuffer *buf; - - for (l = thiz->locked_buffer; l; l = l->next) { - buf = l->data; - gst_buffer_unref (buf); - } -} - -static void -check_locked_buffer (GstMsdkDec * thiz) -{ - GList *l; - GstBuffer *buf; - mfxFrameSurface1 *mfx_surface; - - for (l = thiz->locked_buffer; l; l = l->next) { - buf = l->data; - mfx_surface = gst_msdk_get_surface_from_buffer (buf); - if (!mfx_surface->Data.Locked) { - gst_buffer_unref (buf); - thiz->locked_buffer = g_list_delete_link (thiz->locked_buffer, l); - } - } -} - static GstFlowReturn gst_msdkdec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame) { @@ -657,8 +600,6 @@ gst_msdkdec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame) session = gst_msdk_context_get_session (thiz->context); for (;;) { - check_locked_buffer (thiz); - task = &g_array_index (thiz->tasks, MsdkDecTask, thiz->next_task); flow = gst_msdkdec_finish_task (thiz, task); if (flow != GST_FLOW_OK) @@ -946,8 +887,6 @@ gst_msdkdec_drain (GstVideoDecoder * decoder) session = gst_msdk_context_get_session (thiz->context); for (;;) { - check_locked_buffer (thiz); - task = &g_array_index (thiz->tasks, MsdkDecTask, thiz->next_task); if ((flow = gst_msdkdec_finish_task (thiz, task)) != GST_FLOW_OK) { if (flow != GST_FLOW_FLUSHING) @@ -1003,8 +942,6 @@ gst_msdkdec_drain (GstVideoDecoder * decoder) thiz->next_task = (thiz->next_task + 1) % thiz->tasks->len; } - check_locked_buffer (thiz); - release_locked_buffer (thiz); release_msdk_surfaces (thiz); return GST_FLOW_OK; diff --git a/sys/msdk/gstmsdkdec.h b/sys/msdk/gstmsdkdec.h index 8a68c7adcb..10f373fd19 100644 --- a/sys/msdk/gstmsdkdec.h +++ b/sys/msdk/gstmsdkdec.h @@ -81,7 +81,6 @@ struct _GstMsdkDec guint next_task; GList *decoded_msdk_surfaces; - GList *locked_buffer; /* element properties */ gboolean hardware; |