ccconverter: fix overflow when not doing framerate conversion

When converting from one framerate to another, counters are
reset periodically, however when not converting they never are
and can_genearte_output ends up making overflow-prone calculations
with large values for input_frames and output_frames.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2465>
This commit is contained in:
Mathieu Duponchelle 2021-08-12 20:39:24 +02:00 committed by GStreamer Marge Bot
parent 01c430fa45
commit 152813e71d

View file

@ -884,6 +884,12 @@ fit_and_scale_cc_data (GstCCConverter * self,
if (tc && tc->config.fps_n != 0) if (tc && tc->config.fps_n != 0)
interpolate_time_code_with_framerate (self, tc, out_fps_entry->fps_n, interpolate_time_code_with_framerate (self, tc, out_fps_entry->fps_n,
out_fps_entry->fps_d, 1, 1, &self->current_output_timecode); out_fps_entry->fps_d, 1, 1, &self->current_output_timecode);
self->scratch_ccp_len = 0;
self->scratch_cea608_1_len = 0;
self->scratch_cea608_2_len = 0;
self->input_frames = 0;
self->output_frames = 0;
} else { } else {
int input_frame_n, input_frame_d, output_frame_n, output_frame_d; int input_frame_n, input_frame_d, output_frame_n, output_frame_d;
int output_time_cmp, scale_n, scale_d, rate_cmp; int output_time_cmp, scale_n, scale_d, rate_cmp;