Skip to content

Commit

Permalink
vcf/logo: replace assert with error messages
Browse files Browse the repository at this point in the history
If either encoder or decoder is not found, print the error message rather
than crashing with abort().

refer to GH-403
  • Loading branch information
MartinPulec committed Aug 2, 2024
1 parent 04fe6be commit 98f8e31
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/capture_filter/logo.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include "utils/macros.h"
#include "utils/pam.h"
#include "video_codec.h"
#include "video_frame.h" // for VIDEO_FRAME_DISPOSE

struct module;

Expand Down Expand Up @@ -161,10 +162,21 @@ static struct video_frame *filter(void *state, struct video_frame *in)
state;
decoder_t decoder, coder;
decoder = get_decoder_from_to(in->color_spec, RGB);
if (decoder == NULL) {
MSG(ERROR, "Cannot find decoder from %s to RGB!\n",
get_codec_name(in->color_spec));
VIDEO_FRAME_DISPOSE(in);
return NULL;
}
coder = get_decoder_from_to(RGB, in->color_spec);
if (coder == NULL) {
MSG(ERROR, "Cannot find encoder from %s to RGB!\n",
get_codec_name(in->color_spec));
VIDEO_FRAME_DISPOSE(in);
return NULL;
}
int rect_x = s->x;
int rect_y = s->y;
assert(coder != NULL && decoder != NULL);

if (decoder == NULL || coder == NULL)
return in;
Expand Down

0 comments on commit 98f8e31

Please sign in to comment.