lavc video: avoid nullptr dereference

When `--param keep-pixfmt` is used but the encoder doesn't produce a
packet (AVPacket.size == 0), nullptr dereference can occur.

fixes CID 416601
This commit is contained in:
Martin Pulec
2023-08-22 08:57:43 +02:00
parent 18c55c1191
commit d2f8f2df8b

View File

@@ -1147,6 +1147,9 @@ static void check_duration(struct state_video_compress_libav *s, time_ns_t dur_p
}
static void write_orig_format(struct video_frame *compressed_frame, codec_t orig_pixfmt) {
if (compressed_frame == nullptr) {
return;
}
if (compressed_frame->color_spec != H264 && compressed_frame->color_spec != H265) {
log_msg_once(LOG_LEVEL_ERROR, to_fourcc('L', 'W', 'P', 'T'), MOD_NAME
"Currently cannot store input format to different compression stream than H.264/HEVC\n");