Skip to content
This repository has been archived by the owner on Jan 7, 2023. It is now read-only.

Commit

Permalink
Fixed a couple issue
Browse files Browse the repository at this point in the history
1. Fixed racing condition issue with subpicture enable.
2. Fixed compositefitler memory leak in composite.InputStream.
3. Fixed full color memory allocation only available on RGB4/

Signed-off-by: Lim Siew Hoon <[email protected]>
  • Loading branch information
SiewHoon committed Sep 17, 2019
1 parent a4fce96 commit 1be01b2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
4 changes: 3 additions & 1 deletion gst-libs/mfx/gstmfxcompositefilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ static void
gst_mfx_composite_filter_finalize (GstMfxCompositeFilter * filter)
{
/* Free allocated memory for filters */
g_slice_free1 ((sizeof (mfxExtBuffer *)), filter->ext_buffer);
if (filter->composite.InputStream)
g_slice_free1 ((sizeof (mfxVPPCompInputStream) * filter->composite.NumInputStream), filter->composite.InputStream);

gst_mfx_surface_replace (&filter->out_surface, NULL);
gst_mfx_task_aggregator_unref (filter->aggregator);

Expand Down
23 changes: 13 additions & 10 deletions gst-libs/mfx/gstmfxsurface.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#undef gst_mfx_surface_unref
#undef gst_mfx_surface_replace


static gboolean
gst_mfx_surface_allocate_default (GstMfxSurface * surface, GstMfxTask * task)
{
Expand Down Expand Up @@ -221,17 +220,21 @@ gst_mfx_surface_init_properties(GstMfxSurface * surface)

#if MSDK_CHECK_VERSION(1,19)
/* Full color range */
memset(&surface->siginfo, 0, (sizeof(mfxExtVPPVideoSignalInfo)));
surface->siginfo.Header.BufferId = MFX_EXTBUFF_VPP_VIDEO_SIGNAL_INFO;
surface->siginfo.Header.BufferSz = sizeof (mfxExtVPPVideoSignalInfo);
surface->siginfo.TransferMatrix = MFX_TRANSFERMATRIX_UNKNOWN;
surface->siginfo.NominalRange = MFX_NOMINALRANGE_0_255;

if (NULL == surface->ext_buf) {
surface->ext_buf = g_slice_alloc (sizeof (mfxExtBuffer *));
if (NULL != surface->ext_buf) {
surface->ext_buf[0] = (mfxExtBuffer *) &surface->siginfo;
ptr->NumExtParam = 1;
ptr->ExtParam = &surface->ext_buf[0];

if (info->FourCC == MFX_FOURCC_RGB4) {
surface->siginfo.TransferMatrix = MFX_TRANSFERMATRIX_UNKNOWN;
surface->siginfo.NominalRange = MFX_NOMINALRANGE_0_255;

if (NULL == surface->ext_buf) {
surface->ext_buf = g_slice_alloc (sizeof (mfxExtBuffer *));
if (NULL != surface->ext_buf) {
surface->ext_buf[0] = (mfxExtBuffer *) &surface->siginfo;
ptr->NumExtParam = 1;
ptr->ExtParam = &surface->ext_buf[0];
}
}
}
#endif
Expand Down
5 changes: 3 additions & 2 deletions gst/mfx/gstmfxsink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,7 @@ gst_mfxsink_show_frame (GstVideoSink * video_sink, GstBuffer * src_buffer)
surface_rect->x, surface_rect->y,
surface_rect->width, surface_rect->height);

gst_mfxsink_lock (sink);
if (cmeta) {
overlay = cmeta->overlay;

Expand All @@ -1055,22 +1056,22 @@ gst_mfxsink_show_frame (GstVideoSink * video_sink, GstBuffer * src_buffer)
composition, &composite_surface);
}

gst_mfxsink_lock (sink);
if (!gst_mfxsink_render_surface (sink,
composite_surface ? composite_surface : surface, surface_rect))
goto error;

gst_mfx_surface_dequeue(surface);
ret = GST_FLOW_OK;
done:
gst_mfxsink_unlock (sink);
gst_mfx_surface_composition_replace (&composition, NULL);
gst_mfxsink_unlock (sink);
return ret;

error:
GST_ELEMENT_ERROR (sink, RESOURCE, WRITE,
("Internal error: could not render surface"), (NULL));
ret = GST_FLOW_ERROR;
gst_mfxsink_unlock (sink);
goto done;

no_surface:
Expand Down

0 comments on commit 1be01b2

Please sign in to comment.