Skip to content

Commit eec7bc0

Browse files
author
Clement Champetier
committed
VideoTransform: use sws_getCachedContext instead of sws_getContext
* Check if context can be reused, otherwise reallocate a new one. * sws_getContext is deprecated in ffmpeg documentation.
1 parent f66a554 commit eec7bc0

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/AvTranscoder/transform/VideoTransform.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,10 @@ bool VideoTransform::init( const Frame& srcFrame, const Frame& dstFrame )
4141
const VideoFrame& src = static_cast<const VideoFrame&>( srcFrame );
4242
const VideoFrame& dst = static_cast<const VideoFrame&>( dstFrame );
4343

44-
4544
const AVPixelFormat srcPixelFormat = src.desc().getPixelFormat();
4645
const AVPixelFormat dstPixelFormat = dst.desc().getPixelFormat();
4746

48-
_imageConvertContext = sws_getContext(
47+
_imageConvertContext = sws_getCachedContext( _imageConvertContext,
4948
src.desc().getWidth(), src.desc().getHeight(), srcPixelFormat,
5049
dst.desc().getWidth(), dst.desc().getHeight(), dstPixelFormat,
5150
SWS_POINT, NULL, NULL, NULL);

0 commit comments

Comments
 (0)