[FFmpeg-devel] [PATCH v2 09/10] vtenc: check for NULL CMSampleBufferRef in encoder callback.

kernrj at gmail.com kernrj at gmail.com
Wed Nov 18 19:49:57 CET 2015


From: Rick Kern <kernrj at gmail.com>

The CMSampleBufferRef passed into the encoder can be NULL. Added check.

Signed-off-by: Rick Kern <kernrj at gmail.com>
---
 libavcodec/vtenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vtenc.c b/libavcodec/vtenc.c
index 583244c..78a918b 100644
--- a/libavcodec/vtenc.c
+++ b/libavcodec/vtenc.c
@@ -285,11 +285,11 @@ static av_cold void vtenc_output_callback(
     VTEncContext*   vtctx = (VTEncContext*)avctx->priv_data;
 
     if(vtctx->async_error){
-        CFRelease(sample_buffer);
+        if(sample_buffer) CFRelease(sample_buffer);
         return;
     }
 
-    if(status){
+    if(status || !sample_buffer){
         av_log(avctx, AV_LOG_ERROR, "Error encoding frame: %d\n", status);
         set_async_error(vtctx, AVERROR_EXTERNAL);
         return;
-- 
2.4.9 (Apple Git-60)



More information about the ffmpeg-devel mailing list