better debugging when fail to sws_scale

This commit is contained in:
Isaac Connor 2019-11-01 09:24:22 -04:00
parent 8f327f23bd
commit 46991f04e6
1 changed files with 10 additions and 4 deletions

View File

@ -1106,15 +1106,21 @@ int FfmpegCamera::transfer_to_image(
); );
} }
if ( sws_scale( int ret =
sws_scale(
mConvertContext, input_frame->data, input_frame->linesize, mConvertContext, input_frame->data, input_frame->linesize,
0, mVideoCodecContext->height, 0, mVideoCodecContext->height,
output_frame->data, output_frame->linesize) <= 0 ) { output_frame->data, output_frame->linesize);
Error("Unable to convert format %u %s to format %u %s at frame %d codec %u %s", if ( ret <= 0 ) {
Error("Unable to convert format %u %s linesize %d height %d to format %u %s linesize %d at frame %d codec %u %s : code: %d",
input_frame->format, av_get_pix_fmt_name((AVPixelFormat)input_frame->format), input_frame->format, av_get_pix_fmt_name((AVPixelFormat)input_frame->format),
input_frame->linesize, mVideoCodecContext->height,
imagePixFormat,
av_get_pix_fmt_name(imagePixFormat), av_get_pix_fmt_name(imagePixFormat),
output_frame->linesize,
frameCount, frameCount,
mVideoCodecContext->pix_fmt, av_get_pix_fmt_name(mVideoCodecContext->pix_fmt) mVideoCodecContext->pix_fmt, av_get_pix_fmt_name(mVideoCodecContext->pix_fmt),
ret
); );
return -1; return -1;
} }