if( tjDecompress2( autoJpg.GetHandle(), jpegBufferPtr, jpegBufferSize, bitmapPixelBuffer, scaledPreXformWidth, 0, scaledPreXformHeight, DECODED_PIXEL_LIBJPEG_TYPE, flags ) == -1 )
{
- DALI_LOG_ERROR("%s\n", tjGetErrorStr());
- return false;
+ std::string errorString = tjGetErrorStr();
+
+ if( errorString.find("Corrupt JPEG data") == std::string::npos )
+ {
+ DALI_LOG_ERROR("%s\n", errorString.c_str());
+ return false;
+ }
+ else
+ {
+ DALI_LOG_WARNING("%s\n", errorString.c_str());
+ }
+
+ //TurboJPEG API functions will now return an error code if a warning is triggered in the underlying libjpeg API.
+ //So, we need to distinguish return of tjGetErrorStr() is warning or error.
+ //If the return string has 'Corrupt JPEG data' prefix, it means warning.
}
const unsigned int bufferWidth = GetTextureDimension( scaledPreXformWidth );