History

avcodec/videotoolboxenc: fix vtctx reset condition

In vtenc_populate_extradata, the cleanup function vtenc_reset should not be used when no error occurs, otherwise some color information is lost (#11036). This patch checks the status code and conducts the correct cleanup.

Hao Guan committed 2 years ago

Commit cd2f8a21 parent 24b3bad1 file · +8 −1Browse files

Unified · Split

libavcodec/videotoolboxenc.c+8−1
@@ -2767,7 +2767,14 @@ static int vtenc_populate_extradata(AVCodecContext *avctx, · 2766 unmodified lines
27672767
27682768 pe_cleanup:
27692769 CVPixelBufferRelease(pix_buf);
2770− vtenc_reset(vtctx);
2770+
2771+ if (status) {
2772+ vtenc_reset(vtctx);
2773+ } else if (vtctx->session) {
2774+ CFRelease(vtctx->session);
2775+ vtctx->session = NULL;
2776+ }
2777+
27712778 vtctx->frame_ct_out = 0;
27722779
27732780 av_assert0(status != 0 || (avctx->extradata && avctx->extradata_size > 0));

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t