vlc | branch: master | Thomas Guillem <[email protected]> | Mon Jan 9 14:27:18 2017 +0100| [b7b2cb3a5d5c6bf806a3c0cd505d12b9b300e699] | committer: Thomas Guillem
videotoolbox: cosmetic > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b7b2cb3a5d5c6bf806a3c0cd505d12b9b300e699 --- modules/codec/videotoolbox.m | 70 +++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m index 69efd7a..9f1008c 100644 --- a/modules/codec/videotoolbox.m +++ b/modules/codec/videotoolbox.m @@ -1119,45 +1119,43 @@ skip: imageBufferObject = [p_sys->outputFrames objectForKey:timeStamp]; } imageBuffer = (__bridge CVPixelBufferRef)imageBufferObject; - - if (imageBuffer != NULL) { - if (CVPixelBufferGetDataSize(imageBuffer) > 0) { - if (decoder_UpdateVideoFormat(p_dec)) - return NULL; - p_pic = decoder_NewPicture(p_dec); - - if (!p_pic) - return NULL; - - if (!p_sys->b_zero_copy) { - /* ehm, *cough*, memcpy.. */ - copy420YpCbCr8Planar(p_pic, - imageBuffer, - CVPixelBufferGetWidthOfPlane(imageBuffer, 0), - CVPixelBufferGetHeightOfPlane(imageBuffer, 0)); - } else { - /* the structure is allocated by the vout's pool */ - if (p_pic->p_sys) { - /* if we received a recycled picture from the pool - * we need release the previous reference first, - * otherwise we would leak it */ - if (p_pic->p_sys->pixelBuffer != nil) { - CFRelease(p_pic->p_sys->pixelBuffer); - p_pic->p_sys->pixelBuffer = nil; - } - - p_pic->p_sys->pixelBuffer = CFBridgingRetain(imageBufferObject); - } - /* will be freed by the vout */ + if (imageBuffer == NULL || CVPixelBufferGetDataSize(imageBuffer) == 0) + return NULL; + + if (decoder_UpdateVideoFormat(p_dec)) + return NULL; + p_pic = decoder_NewPicture(p_dec); + + if (!p_pic) + return NULL; + + if (!p_sys->b_zero_copy) { + /* ehm, *cough*, memcpy.. */ + copy420YpCbCr8Planar(p_pic, + imageBuffer, + CVPixelBufferGetWidthOfPlane(imageBuffer, 0), + CVPixelBufferGetHeightOfPlane(imageBuffer, 0)); + } else { + /* the structure is allocated by the vout's pool */ + if (p_pic->p_sys) { + /* if we received a recycled picture from the pool + * we need release the previous reference first, + * otherwise we would leak it */ + if (p_pic->p_sys->pixelBuffer != nil) { + CFRelease(p_pic->p_sys->pixelBuffer); + p_pic->p_sys->pixelBuffer = nil; } - p_pic->date = timeStamp.longLongValue; + p_pic->p_sys->pixelBuffer = CFBridgingRetain(imageBufferObject); + } + /* will be freed by the vout */ + } - if (imageBufferObject) { - @synchronized(p_sys->outputFrames) { - [p_sys->outputFrames removeObjectForKey:timeStamp]; - } - } + p_pic->date = timeStamp.longLongValue; + + if (imageBufferObject) { + @synchronized(p_sys->outputFrames) { + [p_sys->outputFrames removeObjectForKey:timeStamp]; } } return p_pic; _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
