mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 11:11:08 +00:00
ccconverter: Don't override in_fps_entry when trying to take output
This allows to handle CDP streams where the framerate is not provided by the caps and generally gives preference to the framerate inside the CDP packets over the one in the caps. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7532>
This commit is contained in:
parent
7e9866844f
commit
b5e119bbcc
2 changed files with 12 additions and 10 deletions
|
@ -502,7 +502,7 @@ static void
|
||||||
get_framerate_output_scale (GstCCConverter * self,
|
get_framerate_output_scale (GstCCConverter * self,
|
||||||
const struct cdp_fps_entry *in_fps_entry, gint * scale_n, gint * scale_d)
|
const struct cdp_fps_entry *in_fps_entry, gint * scale_n, gint * scale_d)
|
||||||
{
|
{
|
||||||
if (self->in_fps_n == 0 || self->out_fps_d == 0) {
|
if (in_fps_entry->fps_n == 0 || self->out_fps_d == 0) {
|
||||||
*scale_n = 1;
|
*scale_n = 1;
|
||||||
*scale_d = 1;
|
*scale_d = 1;
|
||||||
return;
|
return;
|
||||||
|
@ -590,24 +590,30 @@ can_take_buffer (GstCCConverter * self,
|
||||||
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;
|
int output_time_cmp, scale_n, scale_d;
|
||||||
|
|
||||||
|
g_assert (out_fps_entry);
|
||||||
|
|
||||||
|
if (!in_fps_entry || in_fps_entry->fps_n == 0)
|
||||||
|
in_fps_entry = cdp_fps_entry_from_fps (self->in_fps_n, self->in_fps_d);
|
||||||
|
g_assert (in_fps_entry);
|
||||||
|
|
||||||
/* TODO: handle input discont */
|
/* TODO: handle input discont */
|
||||||
|
|
||||||
if (self->in_fps_n == 0) {
|
if (in_fps_entry->fps_n == 0) {
|
||||||
input_frame_n = self->input_frames;
|
input_frame_n = self->input_frames;
|
||||||
input_frame_d = 1;
|
input_frame_d = 1;
|
||||||
} else {
|
} else {
|
||||||
/* compute the relative frame count for each */
|
/* compute the relative frame count for each */
|
||||||
if (!gst_util_fraction_multiply (self->in_fps_d, self->in_fps_n,
|
if (!gst_util_fraction_multiply (in_fps_entry->fps_d, in_fps_entry->fps_n,
|
||||||
self->input_frames, 1, &input_frame_n, &input_frame_d))
|
self->input_frames, 1, &input_frame_n, &input_frame_d))
|
||||||
/* we should never overflow */
|
/* we should never overflow */
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->in_fps_n == 0) {
|
if (in_fps_entry->fps_n == 0) {
|
||||||
output_frame_n = self->output_frames;
|
output_frame_n = self->output_frames;
|
||||||
output_frame_d = 1;
|
output_frame_d = 1;
|
||||||
} else {
|
} else {
|
||||||
if (!gst_util_fraction_multiply (self->out_fps_d, self->out_fps_n,
|
if (!gst_util_fraction_multiply (out_fps_entry->fps_d, out_fps_entry->fps_n,
|
||||||
self->output_frames, 1, &output_frame_n, &output_frame_d))
|
self->output_frames, 1, &output_frame_n, &output_frame_d))
|
||||||
/* we should never overflow */
|
/* we should never overflow */
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
@ -621,10 +627,6 @@ can_take_buffer (GstCCConverter * self,
|
||||||
self->input_frames = 0;
|
self->input_frames = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
in_fps_entry = cdp_fps_entry_from_fps (self->in_fps_n, self->in_fps_d);
|
|
||||||
if (!in_fps_entry || in_fps_entry->fps_n == 0)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
/* compute the relative rates of the two framerates */
|
/* compute the relative rates of the two framerates */
|
||||||
get_framerate_output_scale (self, in_fps_entry, &scale_n, &scale_d);
|
get_framerate_output_scale (self, in_fps_entry, &scale_n, &scale_d);
|
||||||
|
|
||||||
|
|
|
@ -524,7 +524,7 @@ GST_START_TEST (convert_cea708_cdp_cea708_cc_data_too_big)
|
||||||
{
|
{
|
||||||
/* tests that too large input is truncated */
|
/* tests that too large input is truncated */
|
||||||
const guint8 in[] =
|
const guint8 in[] =
|
||||||
{ 0x96, 0x69, 0x4c, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xf5, 0xfc, 0x81, 0x82,
|
{ 0x96, 0x69, 0x4c, 0x5f, 0x43, 0x00, 0x00, 0x72, 0xf5, 0xfc, 0x81, 0x82,
|
||||||
0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80,
|
0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80,
|
||||||
0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80,
|
0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80,
|
||||||
0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80,
|
0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80,
|
||||||
|
|
Loading…
Reference in a new issue