Re: [FFmpeg-devel] [PATCH] hwcontext_opencl: Only release command queue if it exists

2018-11-27 Thread Mark Thompson
On 26/11/2018 12:31, Song, Ruiling wrote:
> 
> 
>> -Original Message-
>> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
>> Mark Thompson
>> Sent: Monday, November 26, 2018 3:16 AM
>> To: FFmpeg development discussions and patches 
>> Subject: [FFmpeg-devel] [PATCH] hwcontext_opencl: Only release command
>> queue if it exists
>>
>> If the frames context creation fails then the command queue reference
>> need not exist when uninit is called.
>> ---
>>  libavutil/hwcontext_opencl.c | 11 +++
>>  1 file changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
>> index c745b91775..e6cef74269 100644
>> --- a/libavutil/hwcontext_opencl.c
>> +++ b/libavutil/hwcontext_opencl.c
>> @@ -1750,10 +1750,13 @@ static void
>> opencl_frames_uninit(AVHWFramesContext *hwfc)
>>  av_freep(>mapped_frames);
>>  #endif
>>
>> -cle = clReleaseCommandQueue(priv->command_queue);
>> -if (cle != CL_SUCCESS) {
>> -av_log(hwfc, AV_LOG_ERROR, "Failed to release frame "
>> -   "command queue: %d.\n", cle);
>> +if (priv->command_queue) {
>> +cle = clReleaseCommandQueue(priv->command_queue);
>> +if (cle != CL_SUCCESS) {
>> +av_log(hwfc, AV_LOG_ERROR, "Failed to release frame "
>> +   "command queue: %d.\n", cle);
>> +}
>> +priv->command_queue = NULL;
> 
> Seems ok.

Applied.

Thanks!

- Mark
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] hwcontext_opencl: Only release command queue if it exists

2018-11-26 Thread Song, Ruiling


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Mark Thompson
> Sent: Monday, November 26, 2018 3:16 AM
> To: FFmpeg development discussions and patches 
> Subject: [FFmpeg-devel] [PATCH] hwcontext_opencl: Only release command
> queue if it exists
> 
> If the frames context creation fails then the command queue reference
> need not exist when uninit is called.
> ---
>  libavutil/hwcontext_opencl.c | 11 +++
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
> index c745b91775..e6cef74269 100644
> --- a/libavutil/hwcontext_opencl.c
> +++ b/libavutil/hwcontext_opencl.c
> @@ -1750,10 +1750,13 @@ static void
> opencl_frames_uninit(AVHWFramesContext *hwfc)
>  av_freep(>mapped_frames);
>  #endif
> 
> -cle = clReleaseCommandQueue(priv->command_queue);
> -if (cle != CL_SUCCESS) {
> -av_log(hwfc, AV_LOG_ERROR, "Failed to release frame "
> -   "command queue: %d.\n", cle);
> +if (priv->command_queue) {
> +cle = clReleaseCommandQueue(priv->command_queue);
> +if (cle != CL_SUCCESS) {
> +av_log(hwfc, AV_LOG_ERROR, "Failed to release frame "
> +   "command queue: %d.\n", cle);
> +}
> +priv->command_queue = NULL;

Seems ok.

Ruiling
>  }
>  }
> 
> --
> 2.19.1
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] hwcontext_opencl: Only release command queue if it exists

2018-11-25 Thread Mark Thompson
If the frames context creation fails then the command queue reference
need not exist when uninit is called.
---
 libavutil/hwcontext_opencl.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index c745b91775..e6cef74269 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -1750,10 +1750,13 @@ static void opencl_frames_uninit(AVHWFramesContext 
*hwfc)
 av_freep(>mapped_frames);
 #endif
 
-cle = clReleaseCommandQueue(priv->command_queue);
-if (cle != CL_SUCCESS) {
-av_log(hwfc, AV_LOG_ERROR, "Failed to release frame "
-   "command queue: %d.\n", cle);
+if (priv->command_queue) {
+cle = clReleaseCommandQueue(priv->command_queue);
+if (cle != CL_SUCCESS) {
+av_log(hwfc, AV_LOG_ERROR, "Failed to release frame "
+   "command queue: %d.\n", cle);
+}
+priv->command_queue = NULL;
 }
 }
 
-- 
2.19.1
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel