mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-07 16:49:52 +00:00
value: fix union of int range and int when extending on a side
The internal representation uses bounds scaled by the step Add tests to catch those cases
This commit is contained in:
parent
058bdcfe6b
commit
371fe0be65
2 changed files with 12 additions and 7 deletions
|
@ -4150,9 +4150,8 @@ gst_value_union_int_int_range (GValue * dest, const GValue * src1,
|
|||
/* check if it extends the range */
|
||||
if (v == (INT_RANGE_MIN (src2) - 1) * INT_RANGE_STEP (src2)) {
|
||||
if (dest) {
|
||||
guint64 new_min =
|
||||
(guint) ((INT_RANGE_MIN (src2) - 1) * INT_RANGE_STEP (src2));
|
||||
guint64 new_max = (guint) (INT_RANGE_MAX (src2) * INT_RANGE_STEP (src2));
|
||||
guint64 new_min = INT_RANGE_MIN (src2) - 1;
|
||||
guint64 new_max = INT_RANGE_MAX (src2);
|
||||
|
||||
gst_value_init_and_copy (dest, src2);
|
||||
dest->data[0].v_uint64 = (new_min << 32) | (new_max);
|
||||
|
@ -4161,9 +4160,8 @@ gst_value_union_int_int_range (GValue * dest, const GValue * src1,
|
|||
}
|
||||
if (v == (INT_RANGE_MAX (src2) + 1) * INT_RANGE_STEP (src2)) {
|
||||
if (dest) {
|
||||
guint64 new_min = (guint) (INT_RANGE_MIN (src2) * INT_RANGE_STEP (src2));
|
||||
guint64 new_max =
|
||||
(guint) ((INT_RANGE_MAX (src2) + 1) * INT_RANGE_STEP (src2));
|
||||
guint64 new_min = INT_RANGE_MIN (src2);
|
||||
guint64 new_max = INT_RANGE_MAX (src2) + 1;
|
||||
|
||||
gst_value_init_and_copy (dest, src2);
|
||||
dest->data[0].v_uint64 = (new_min << 32) | (new_max);
|
||||
|
|
|
@ -3081,7 +3081,14 @@ GST_START_TEST (test_stepped_int_range_ops)
|
|||
"[16, 32, 16]", "union", "[48, 96, 16]", "[16, 96, 16]"}, {
|
||||
"[112, 192, 16]", "union", "[48, 96, 16]", "[48, 192, 16]"}, {
|
||||
"[16, 32, 16]", "union", "[64, 96, 16]", NULL}, {
|
||||
"[112, 192, 16]", "union", "[48, 96, 8]", NULL},};
|
||||
"[112, 192, 16]", "union", "[48, 96, 8]", NULL}, {
|
||||
"[10, 20, 5]", "union", "10", "[10, 20, 5]"}, {
|
||||
"[10, 20, 5]", "union", "20", "[10, 20, 5]"}, {
|
||||
"[10, 20, 5]", "union", "15", "[10, 20, 5]"}, {
|
||||
"[10, 20, 5]", "union", "5", "[5, 20, 5]"}, {
|
||||
"[10, 20, 5]", "union", "12", NULL}, {
|
||||
"[10, 20, 5]", "union", "30", NULL}, {
|
||||
"[10, 20, 5]", "union", "25", "[10, 25, 5]"},};
|
||||
|
||||
for (n = 0; n < G_N_ELEMENTS (ranges); ++n) {
|
||||
gchar *end = NULL;
|
||||
|
|
Loading…
Reference in a new issue