videorate: properly handle variable framerate input and drop-only=true

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4969>
This commit is contained in:
Matthew Waters 2023-07-05 16:29:16 +10:00 committed by GStreamer Marge Bot
parent 32dfa102b3
commit cae434c6ff
2 changed files with 24 additions and 0 deletions

View file

@ -503,6 +503,11 @@ gst_video_rate_transform_caps (GstBaseTransform * trans,
/* We can provide everything up to the maximum framerate at the src */
gst_structure_set (s2, "framerate", GST_TYPE_FRACTION_RANGE,
0, 1, max_num, max_denom, NULL);
} else if (min_num == 0) {
/* if provided with variable framerate input, then we don't have a
* restriction on the output framerate currently */
gst_structure_set (s2, "framerate", GST_TYPE_FRACTION_RANGE,
min_num, 1, maxrate, 1, NULL);
}
} else if (direction == GST_PAD_SINK) {
gint min_num = 0, min_denom = 1;

View file

@ -1090,6 +1090,25 @@ static TestInfo caps_negotiation_tests[] = {
.expected_src_caps =
"video/x-raw, framerate=(fraction)15/1;"
"video/x-raw, framerate=(fraction)[0/1, 20/1]"},
{
.caps = "video/x-raw, framerate=0/1",
.drop_only = TRUE,
.expected_sink_caps =
"video/x-raw, framerate=(fraction)0/1;"
"video/x-raw, framerate=(fraction)[0/1, MAX];",
.expected_src_caps =
"video/x-raw, framerate=(fraction)0/1;"
"video/x-raw, framerate=(fraction)[0/1, MAX]"},
{
.caps = "video/x-raw, framerate=0/1",
.drop_only = TRUE,
.max_rate = 15,
.expected_sink_caps =
"video/x-raw, framerate=(fraction)0/1;"
"video/x-raw, framerate=(fraction)[0/1, MAX];",
.expected_src_caps =
"video/x-raw, framerate=(fraction)0/1;"
"video/x-raw, framerate=(fraction)[0/1, 15/1]"},
};
static gboolean