Opened 3 years ago

Closed 21 months ago

#8769 closed defect (fixed)

FFmpge crash when use VideoToolBox to encode frames

Reported by: yxibng Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: crash videotoolbox
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


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", (int)status);
        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.

Change History (2)

comment:1 by Carl Eugen Hoyos, 3 years ago

Analyzed by developer: unset
Keywords: videotoolbox added
Priority: criticalnormal
Reproduced by developer: unset

comment:2 by _08, 21 months ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.