Pass swscale_ctx back in to getCachedContext or it will create new

context every frame and leak memory like a mofo.
This commit is contained in:
Steve Gilvarry 2016-07-17 08:11:53 +10:00
parent b05eabfe1d
commit b9a48eb464
1 changed files with 5 additions and 5 deletions

View File

@ -154,10 +154,10 @@ int SWScale::Convert(const uint8_t* in_buffer, const size_t in_buffer_size, uint
// Error("Invalid input or output pixel formats"); // Error("Invalid input or output pixel formats");
// return -2; // return -2;
// } // }
// if(!width || !height) { if (!width || !height) {
// Error("Invalid width or height"); Error("Invalid width or height");
// return -3; return -3;
// } }
#if LIBSWSCALE_VERSION_CHECK(0, 8, 0, 8, 0) #if LIBSWSCALE_VERSION_CHECK(0, 8, 0, 8, 0)
/* Warn if the input or output pixelformat is not supported */ /* Warn if the input or output pixelformat is not supported */
@ -190,7 +190,7 @@ int SWScale::Convert(const uint8_t* in_buffer, const size_t in_buffer_size, uint
} }
/* Get the context */ /* Get the context */
swscale_ctx = sws_getCachedContext( NULL, width, height, in_pf, width, height, out_pf, 0, NULL, NULL, NULL ); swscale_ctx = sws_getCachedContext(swscale_ctx, width, height, in_pf, width, height, out_pf, 0, NULL, NULL, NULL);
if(swscale_ctx == NULL) { if(swscale_ctx == NULL) {
Error("Failed getting swscale context"); Error("Failed getting swscale context");
return -6; return -6;