Don't require hardware encoding and explicitly fallback to software if it
fails. Enabling it without requiring it will use hardware encoding if
available.

Signed-off-by: Rick Kern <ker...@gmail.com>
---
 libavcodec/videotoolboxenc.c | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 7b52073..2bcd3ef 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -637,7 +637,6 @@ static av_cold int vtenc_init(AVCodecContext *avctx)
     if (!enc_info) return AVERROR(ENOMEM);
 
 #if !TARGET_OS_IPHONE
-    CFDictionarySetValue(enc_info, 
kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder, 
kCFBooleanTrue);
     CFDictionarySetValue(enc_info, 
kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder,  
kCFBooleanTrue);
 #endif
 
@@ -664,25 +663,6 @@ static av_cold int vtenc_init(AVCodecContext *avctx)
         &vtctx->session
     );
 
-#if !TARGET_OS_IPHONE
-    if (status != 0 || !vtctx->session) {
-        CFDictionaryRemoveValue(enc_info, 
kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder);
-
-        status = VTCompressionSessionCreate(
-            kCFAllocatorDefault,
-            avctx->width,
-            avctx->height,
-            codec_type,
-            enc_info,
-            NULL,
-            kCFAllocatorDefault,
-            vtenc_output_callback,
-            avctx,
-            &vtctx->session
-        );
-    }
-#endif
-
     if (pixel_buffer_info) CFRelease(pixel_buffer_info);
     CFRelease(enc_info);
 
-- 
2.7.4

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

Reply via email to