[FFmpeg-devel] [PATCH] lavc/videotoolboxenc: Fix crash when closing codec after error

Richard Kern kernrj at gmail.com
Thu Mar 24 17:46:50 CET 2016


> On Mar 25, 2016, at 12:37 AM, wm4 <nfxjfg at googlemail.com> wrote:
> 
> On Mon, 21 Mar 2016 00:55:56 +0800
> Rick Kern <kernrj at gmail.com> wrote:
> 
>> Fixes crash in #5352. VTCompressionSessionInvalidate() crashes if the internal encoder hasn't completed, but hasn't experienced an error. The function call isn't needed since the encoder is invalidated when the reference count reaches 0 anyway.
>> 
>> Signed-off-by: Rick Kern <kernrj at gmail.com>
>> ---
>> libavcodec/videotoolboxenc.c | 1 -
>> 1 file changed, 1 deletion(-)
>> 
>> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
>> index 3ed1f64..0791146 100644
>> --- a/libavcodec/videotoolboxenc.c
>> +++ b/libavcodec/videotoolboxenc.c
>> @@ -1275,7 +1275,6 @@ static av_cold int vtenc_close(AVCodecContext *avctx)
>> 
>>     if(!vtctx->session) return 0;
>> 
>> -    VTCompressionSessionInvalidate(vtctx->session);
>>     pthread_cond_destroy(&vtctx->cv_sample_sent);
>>     pthread_mutex_destroy(&vtctx->lock);
>>     CFRelease(vtctx->session);
> 
> Seems fine. So if we don't need it, what is
> VTCompressionSessionInvalidate intended for in general?
It could be used to tear down the encoder without the session being deallocated.

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



More information about the ffmpeg-devel mailing list