diff options
author | sharpbai <sharpbai@gmail.com> | 2019-08-13 14:18:21 +0800 |
---|---|---|
committer | Rick Kern <rick@8birdsvideo.com> | 2019-09-16 08:58:10 -0400 |
commit | 6966548c1bd8a07548cab72309c4e792166c9603 (patch) | |
tree | f109bfb56d5974fe827feb465f6908618bd91378 /libavfilter/dnn/dnn_interface.c | |
parent | 94f187d382675fe8c4425bcc349859741f20439d (diff) | |
download | ffmpeg-6966548c1bd8a07548cab72309c4e792166c9603.tar.gz |
avcodec/videotoolboxenc: fix encoding frame crash on iOS 11
On iOS 11, encoding a frame may return error with log
"Error encoding frame 0", which means vtenc_output_callback
is called with status=0 and sample_buffer=NULL. Then the
encoding session will be crashed on next callback wether or not
closing the codec context.
Let us look through the link below introducing VTCompressionOutputCallback,
https://developer.apple.com/documentation/videotoolbox/vtcompressionoutputcallback?language=objc
"status=0" (noErr) means compression was successful.
"sampleBuffer=NULL" means the frame was dropped when compression
was successful (status=0) or compression was not successful (status!=0).
So we should not set AVERROR_EXTERNAL on "status=0" and "sample_buffer=NULL"
as it is not a error.
The fix is that we only set AVERROR_EXTERNAL with status value non zero.
When sample_buffer is NULL and status value is zero, we simply return
with no other operation.
This crash often occurs on iOS 11 for example encoding 720p@25fps.
Signed-off-by: sharpbai <sharpbai@gmail.com>
Signed-off-by: Rick Kern <kernrj@gmail.com>
Diffstat (limited to 'libavfilter/dnn/dnn_interface.c')
0 files changed, 0 insertions, 0 deletions