Fix crash when decoder returns 0 and when are using hwaccel

This commit is contained in:
Isaac Connor 2021-02-19 21:03:10 -05:00
parent bf0ae8b270
commit e562888ed0
1 changed files with 66 additions and 67 deletions

View File

@ -159,7 +159,7 @@ int ZMPacket::decode(AVCodecContext *ctx) {
return 0;
}
int bytes_consumed = ret;
if ( ret > 0 )
if ( ret > 0 ) {
zm_dump_video_frame(in_frame, "got frame");
#if HAVE_LIBAVUTIL_HWCONTEXT_H
@ -237,7 +237,6 @@ int ZMPacket::decode(AVCodecContext *ctx) {
} else
#endif
#endif
if ( ret > 0 ) {
Debug(2, "Same pix format %s so not hwtransferring. sw_pix_fmt is %s",
av_get_pix_fmt_name(ctx->pix_fmt),
av_get_pix_fmt_name(ctx->sw_pix_fmt)
@ -247,7 +246,7 @@ int ZMPacket::decode(AVCodecContext *ctx) {
image->Assign(in_frame);
}
#endif
}
} // end if if ( ret > 0 ) {
return bytes_consumed;
} // end ZMPacket::decode