mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-28 17:42:28 +08:00
nv-filters: Fix destruction of Background Blur effect
For the background blur effect, it was found that destroying it and then adding any other NVIDIA effect led to a blank picture. This commit swaps the order of destroying the effect and the associated cudaStream. For other effects the order does not matter; I have no idea why the order matters for blur effect and the SDK gives no indication about any proper order at destruction time. Fixes bug #11383. Signed-off-by: pkv <pkv@obsproject.com>
This commit is contained in:
@@ -183,10 +183,6 @@ static void nvvfx_filter_actual_destroy(void *data)
|
||||
NvCVImage_Destroy(filter->blur_dst_img);
|
||||
}
|
||||
}
|
||||
if (filter->stream)
|
||||
NvVFX_CudaStreamDestroy(filter->stream);
|
||||
if (filter->stream_blur)
|
||||
NvVFX_CudaStreamDestroy(filter->stream_blur);
|
||||
|
||||
if (filter->handle) {
|
||||
if (filter->stateObjectHandle) {
|
||||
@@ -197,6 +193,10 @@ static void nvvfx_filter_actual_destroy(void *data)
|
||||
if (filter->handle_blur) {
|
||||
NvVFX_DestroyEffect(filter->handle_blur);
|
||||
}
|
||||
if (filter->stream)
|
||||
NvVFX_CudaStreamDestroy(filter->stream);
|
||||
if (filter->stream_blur)
|
||||
NvVFX_CudaStreamDestroy(filter->stream_blur);
|
||||
|
||||
if (filter->effect) {
|
||||
obs_enter_graphics();
|
||||
@@ -378,12 +378,6 @@ static void nvvfx_filter_reset(void *data, calldata_t *calldata)
|
||||
|
||||
os_atomic_set_bool(&filter->processing_stop, true);
|
||||
// [A] first destroy
|
||||
if (filter->stream) {
|
||||
NvVFX_CudaStreamDestroy(filter->stream);
|
||||
}
|
||||
if (filter->stream_blur) {
|
||||
NvVFX_CudaStreamDestroy(filter->stream_blur);
|
||||
}
|
||||
if (filter->handle) {
|
||||
if (filter->stateObjectHandle) {
|
||||
NvVFX_DeallocateState(filter->handle, filter->stateObjectHandle);
|
||||
@@ -393,6 +387,12 @@ static void nvvfx_filter_reset(void *data, calldata_t *calldata)
|
||||
if (filter->handle_blur) {
|
||||
NvVFX_DestroyEffect(filter->handle_blur);
|
||||
}
|
||||
if (filter->stream) {
|
||||
NvVFX_CudaStreamDestroy(filter->stream);
|
||||
}
|
||||
if (filter->stream_blur) {
|
||||
NvVFX_CudaStreamDestroy(filter->stream_blur);
|
||||
}
|
||||
// [B] recreate
|
||||
/* 1. Create FX */
|
||||
/* 2. Set models path & initialize CudaStream */
|
||||
|
||||
Reference in New Issue
Block a user