Skip to content

Commit 98f8e31

Browse files
committedAug 2, 2024··
vcf/logo: replace assert with error messages
If either encoder or decoder is not found, print the error message rather than crashing with abort(). refer to GH-403
1 parent 04fe6be commit 98f8e31

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed
 

‎src/capture_filter/logo.c

+13-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include "utils/macros.h"
5252
#include "utils/pam.h"
5353
#include "video_codec.h"
54+
#include "video_frame.h" // for VIDEO_FRAME_DISPOSE
5455

5556
struct module;
5657

@@ -161,10 +162,21 @@ static struct video_frame *filter(void *state, struct video_frame *in)
161162
state;
162163
decoder_t decoder, coder;
163164
decoder = get_decoder_from_to(in->color_spec, RGB);
165+
if (decoder == NULL) {
166+
MSG(ERROR, "Cannot find decoder from %s to RGB!\n",
167+
get_codec_name(in->color_spec));
168+
VIDEO_FRAME_DISPOSE(in);
169+
return NULL;
170+
}
164171
coder = get_decoder_from_to(RGB, in->color_spec);
172+
if (coder == NULL) {
173+
MSG(ERROR, "Cannot find encoder from %s to RGB!\n",
174+
get_codec_name(in->color_spec));
175+
VIDEO_FRAME_DISPOSE(in);
176+
return NULL;
177+
}
165178
int rect_x = s->x;
166179
int rect_y = s->y;
167-
assert(coder != NULL && decoder != NULL);
168180

169181
if (decoder == NULL || coder == NULL)
170182
return in;

0 commit comments

Comments
 (0)
Please sign in to comment.