From 4f8da84c94d676df8b6dadf6b32fbe46ffc6b816 Mon Sep 17 00:00:00 2001 From: Single Date: Tue, 5 Nov 2019 16:02:33 +0800 Subject: [PATCH] SGVideoFrame: Use presentation size to generate image. --- SGPlayer/Classes/Core/SGData/SGVideoFrame.m | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/SGPlayer/Classes/Core/SGData/SGVideoFrame.m b/SGPlayer/Classes/Core/SGData/SGVideoFrame.m index c4f3996f..e725c9bd 100644 --- a/SGPlayer/Classes/Core/SGData/SGVideoFrame.m +++ b/SGPlayer/Classes/Core/SGData/SGVideoFrame.m @@ -64,16 +64,15 @@ - (SGPLFImage *)image SGVideoDescriptor *inputDescriptor = [self->_descriptor copy]; SGVideoDescriptor *outputDescriptor = [self->_descriptor copy]; outputDescriptor.format = AV_PIX_FMT_RGB24; + outputDescriptor.width = self->_descriptor.presentationSize.num; + outputDescriptor.height = self->_descriptor.presentationSize.den; const uint8_t *src_data[SGFramePlaneCount] = {nil}; uint8_t *dst_data[SGFramePlaneCount] = {nil}; int src_linesize[SGFramePlaneCount] = {0}; int dst_linesize[SGFramePlaneCount] = {0}; - if (inputDescriptor.format == AV_PIX_FMT_VIDEOTOOLBOX) { - if (!self->_pixelBuffer) { - return nil; - } + if (self->_pixelBuffer) { OSType type = CVPixelBufferGetPixelFormatType(self->_pixelBuffer); inputDescriptor.format = SGPixelFormatAV2FF(type);