X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=subprojects%2Fgst-plugins-bad%2Fsys%2Fva%2Fgstvacompositor.c;h=facad18ce620902e75566a18907d575a929d1b81;hb=8a161880fc20edd8cccfe63cb6b3059838d8fe68;hp=c2ce8dc66de257749bd5d18322dc7b75c7cb0bc6;hpb=39b13fcdbd29227504190530f878219b642b0af6;p=platform%2Fupstream%2Fgstreamer.git diff --git a/subprojects/gst-plugins-bad/sys/va/gstvacompositor.c b/subprojects/gst-plugins-bad/sys/va/gstvacompositor.c index c2ce8dc..facad18 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvacompositor.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvacompositor.c @@ -777,7 +777,13 @@ _get_sinkpad_pool (GstVaCompositor * const self, GstVaCompositorPad * const pad) gst_allocation_params_init (¶ms); caps = gst_pad_get_current_caps (GST_PAD (pad)); - gst_video_info_from_caps (&info, caps); + if (!caps) + return NULL; + if (!gst_video_info_from_caps (&info, caps)) { + GST_ERROR_OBJECT (self, "Cannot parse caps %" GST_PTR_FORMAT, caps); + gst_caps_unref (caps); + return NULL; + } size = GST_VIDEO_INFO_SIZE (&info); @@ -892,21 +898,15 @@ extern GRecMutex GST_VA_SHARED_LOCK; static gboolean _try_import_buffer (GstVaCompositor * const self, - GstVaCompositorPad * const pad, GstBuffer * inbuf) + GstVideoInfo info, GstBuffer * inbuf) { VASurfaceID surface; - GstCaps *caps; - GstVideoInfo info; gboolean ret; surface = gst_va_buffer_get_surface (inbuf); if (surface != VA_INVALID_ID) return TRUE; - caps = gst_pad_get_current_caps (GST_PAD (pad)); - gst_video_info_from_caps (&info, caps); - gst_caps_unref (caps); - g_rec_mutex_lock (&GST_VA_SHARED_LOCK); ret = _try_import_dmabuf_unlocked (self, &info, inbuf); g_rec_mutex_unlock (&GST_VA_SHARED_LOCK); @@ -926,12 +926,24 @@ gst_va_compositor_import_buffer (GstVaCompositor * const self, GstVideoFrame in_frame, out_frame; gboolean imported, copied; - imported = _try_import_buffer (self, pad, inbuf); + caps = gst_pad_get_current_caps (GST_PAD (pad)); + if (!caps) + return GST_FLOW_ERROR; + if (!gst_video_info_from_caps (&info, caps)) { + GST_ERROR_OBJECT (self, "Cannot parse caps %" GST_PTR_FORMAT, caps); + gst_caps_unref (caps); + return GST_FLOW_ERROR; + } + gst_caps_unref (caps); + + imported = _try_import_buffer (self, info, inbuf); if (imported) { *buf = gst_buffer_ref (inbuf); return GST_FLOW_OK; } + GST_LOG_OBJECT (self, "copying input frame"); + /* input buffer doesn't come from a vapool, thus it is required to * have a pool, grab from it a new buffer and copy the input * buffer to the new one */ @@ -942,12 +954,6 @@ gst_va_compositor_import_buffer (GstVaCompositor * const self, if (ret != GST_FLOW_OK) return ret; - GST_LOG_OBJECT (self, "copying input frame"); - - caps = gst_pad_get_current_caps (GST_PAD (pad)); - gst_video_info_from_caps (&info, caps); - gst_caps_unref (caps); - if (!gst_video_frame_map (&in_frame, &info, inbuf, GST_MAP_READ)) goto invalid_buffer;