Skip to content

Commit

Permalink
lavc video: try_open_remaining_pixfmts - do not crash on pix_fmts==NULL
Browse files Browse the repository at this point in the history
Do not crash on codec->pix_fmts == NULL in try_open_remaining_pixfmts.

This can occur eg. for h264_v4l2m2m encoder on RPi.
  • Loading branch information
MartinPulec committed Aug 28, 2023
1 parent efe73aa commit 5e525db
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/video_compress/libavcodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,9 @@ try_open_remaining_pixfmts(state_video_compress_libav *s, video_desc desc,
return AV_PIX_FMT_NONE;
#endif
unsigned usable_fmt_cnt = 0;
if (codec->pix_fmts == nullptr) {
return AV_PIX_FMT_NONE;
}
for (const auto *pix = codec->pix_fmts; *pix != AV_PIX_FMT_NONE;
++pix) {
usable_fmt_cnt += 1;
Expand Down

0 comments on commit 5e525db

Please sign in to comment.