cudabasetransform: Update CUDA stream on context update

CUDA stream must be associated with updated CUDA context

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3618>
This commit is contained in:
Seungha Yang 2022-12-22 00:22:46 +09:00 committed by GStreamer Marge Bot
parent ad0ba3ab7d
commit 15b2cd6565

View file

@ -340,9 +340,20 @@ gst_cuda_base_transform_before_transform (GstBaseTransform * trans,
GST_INFO_OBJECT (self, "Updating device %" GST_PTR_FORMAT " -> %"
GST_PTR_FORMAT, self->context, cmem->context);
if (self->cuda_stream) {
gst_cuda_context_push (self->context);
CuStreamDestroy (self->cuda_stream);
gst_cuda_context_pop (NULL);
self->cuda_stream = NULL;
}
gst_object_unref (self->context);
self->context = gst_object_ref (cmem->context);
gst_cuda_context_push (self->context);
CuStreamCreate (&self->cuda_stream, CU_STREAM_DEFAULT);
gst_cuda_context_pop (NULL);
/* subclass will update internal object.
* Note that gst_base_transform_reconfigure() might not trigger this
* unless caps was changed meanwhile */