[FFmpeg-trac] #8769(avcodec:new): FFmpge crash when use VideoToolBox to encode frames

FFmpeg trac at avcodec.org
Wed Jul 1 11:47:30 EEST 2020

#8769: FFmpge crash when use VideoToolBox to encode frames
             Reporter:  yxibng   |                     Type:  defect
               Status:  new      |                 Priority:  critical
            Component:  avcodec  |                  Version:  git-master
             Keywords:  crash    |               Blocked By:
             Blocking:           |  Reproduced by developer:  1
Analyzed by developer:  1        |
 Summary of the bug:
 How to reproduce:

 static void vtenc_output_callback(
     void *ctx,
     void *sourceFrameCtx,
     OSStatus status,
     VTEncodeInfoFlags flags,
     CMSampleBufferRef sample_buffer)
     AVCodecContext *avctx = ctx;
     VTEncContext   *vtctx = avctx->priv_data;
     ExtraSEI *sei = sourceFrameCtx;

     if (vtctx->async_error) {
         if(sample_buffer) CFRelease(sample_buffer); //This line cause
 crash, should remove

     if (status) {
         av_log(avctx, AV_LOG_ERROR, "Error encoding frame: %d\n",
         set_async_error(vtctx, AVERROR_EXTERNAL);

     if (!sample_buffer) {

     if (!avctx->extradata && (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER))
         int set_status = set_extradata(avctx, sample_buffer);
         if (set_status) {
             set_async_error(vtctx, set_status);

     vtenc_q_push(vtctx, sample_buffer, sei);

 Patches should be submitted to the ffmpeg-devel mailing list and not this
 bug tracker.

Ticket URL: <https://trac.ffmpeg.org/ticket/8769>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list