From e7e1c660f7b911ae9068924e5dacc13c05bf8182 Mon Sep 17 00:00:00 2001 From: Doug Nazar Date: Sat, 1 May 2021 16:45:14 -0400 Subject: [PATCH 1/6] tests: Use correct caps for BE & LE --- tests/check/nle/common.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/check/nle/common.c b/tests/check/nle/common.c index ba05132a..65254ec0 100644 --- a/tests/check/nle/common.c +++ b/tests/check/nle/common.c @@ -268,6 +268,14 @@ videotest_in_bin_nle_src (const gchar * name, guint64 start, gint64 duration, return nlesource; } +#if G_BYTE_ORDER == G_LITTLE_ENDIAN +# define AUDIO_CAPS_SIGNED "audio/x-raw,format=(string)S16LE" +# define AUDIO_CAPS_FLOAT "audio/x-raw,format=(string)F32LE" +#else +# define AUDIO_CAPS_SIGNED "audio/x-raw,format=(string)S16BE" +# define AUDIO_CAPS_FLOAT "audio/x-raw,format=(string)F32BE" +#endif + GstElement * audiotest_bin_src (const gchar * name, guint64 start, gint64 duration, guint priority, gboolean intaudio) @@ -287,9 +295,9 @@ audiotest_bin_src (const gchar * name, guint64 start, audioconvert = gst_element_factory_make_or_warn ("audioconvert", NULL); if (intaudio) - caps = gst_caps_from_string ("audio/x-raw,format=(string)S16LE"); + caps = gst_caps_from_string (AUDIO_CAPS_SIGNED); else - caps = gst_caps_from_string ("audio/x-raw,format=(string)F32LE"); + caps = gst_caps_from_string (AUDIO_CAPS_FLOAT); gst_bin_add_many (GST_BIN (bin), audiotestsrc, audioconvert, identity, NULL); gst_element_link_pads_full (audiotestsrc, "src", audioconvert, "sink", -- GitLab From 18c05ea205d2434d37e1057cede1b291f542c89e Mon Sep 17 00:00:00 2001 From: Doug Nazar Date: Sat, 1 May 2021 16:46:27 -0400 Subject: [PATCH 2/6] tests: Ignore caps format due to differences on BE & LE systems --- tests/check/scenarios/seek_with_stop.validatetest | 2 +- .../flow-expectations/log-audiosink-sink-expected | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/check/scenarios/seek_with_stop.validatetest b/tests/check/scenarios/seek_with_stop.validatetest index 582d0a47..241ed698 100644 --- a/tests/check/scenarios/seek_with_stop.validatetest +++ b/tests/check/scenarios/seek_with_stop.validatetest @@ -9,7 +9,7 @@ meta, ignore-eos=true, configs = { "$(validateflow), pad=videosink:sink, record-buffers=true, ignored-fields=\"stream-start={stream-id,group-id,stream}, segment={position,}\", ignored-event-types={gap}", - "$(validateflow), pad=audiosink:sink, record-buffers=true, ignored-fields=\"stream-start={stream-id,group-id,stream}, segment={position,}\", ignored-event-types={gap}", + "$(validateflow), pad=audiosink:sink, record-buffers=true, ignored-fields=\"stream-start={stream-id,group-id,stream}, segment={position,}\", ignored-event-types={gap}, caps-properties={rate,channels,layout,channel-mask}", } add-clip, name=c0, asset-id=time-overlay, layer-priority=0, type=GESSourceClip, start=0, duration=1.0 diff --git a/tests/check/scenarios/seek_with_stop/flow-expectations/log-audiosink-sink-expected b/tests/check/scenarios/seek_with_stop/flow-expectations/log-audiosink-sink-expected index 17df4156..bd5bfec9 100644 --- a/tests/check/scenarios/seek_with_stop/flow-expectations/log-audiosink-sink-expected +++ b/tests/check/scenarios/seek_with_stop/flow-expectations/log-audiosink-sink-expected @@ -1,5 +1,5 @@ event stream-start: GstEventStreamStart, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE; -event caps: audio/x-raw, channel-mask=(bitmask)0x0000000000000003, channels=(int)2, format=(string)S32LE, layout=(string)interleaved, rate=(int)44100; +event caps: audio/x-raw, channel-mask=(bitmask)0x0000000000000003, channels=(int)2, layout=(string)interleaved, rate=(int)44100; event segment: format=TIME, start=0:00:00.000000000, offset=0:00:00.000000000, stop=0:00:01.000000000, flags=0x01, time=0:00:00.000000000, base=0:00:00.000000000 buffer: pts=0:00:00.000000000, dur=0:00:00.010000000 event flush-start: (no structure) -- GitLab From 34f06839370d2e5d35fb99465b4323f80a921914 Mon Sep 17 00:00:00 2001 From: Doug Nazar Date: Sat, 1 May 2021 16:50:11 -0400 Subject: [PATCH 3/6] tests: Use correct variable types when setting properties. --- tests/check/ges/layer.c | 14 +++++++------- tests/check/ges/project.c | 8 ++++---- tests/check/ges/test-utils.h | 11 +++++++---- tests/check/nle/nlecomposition.c | 15 ++++++++++----- tests/check/nle/tempochange.c | 8 ++++---- 5 files changed, 32 insertions(+), 24 deletions(-) diff --git a/tests/check/ges/layer.c b/tests/check/ges/layer.c index 763e78a0..bf96079a 100644 --- a/tests/check/ges/layer.c +++ b/tests/check/ges/layer.c @@ -53,7 +53,7 @@ GST_START_TEST (test_layer_properties) fail_unless (clip != NULL); /* Set some properties */ - g_object_set (clip, "start", (guint64) 42, "duration", (guint64) 51, + g_object_set (clip, "start", (guint64) 42, "duration", (gint64) 51, "in-point", (guint64) 12, NULL); assert_equals_uint64 (_START (clip), 42); assert_equals_uint64 (_DURATION (clip), 51); @@ -144,9 +144,9 @@ GST_START_TEST (test_layer_priorities) fail_unless (clip2 != NULL); fail_unless (clip3 != NULL); - g_object_set (clip1, "start", 0, "duration", 10, NULL); - g_object_set (clip2, "start", 10, "duration", 10, NULL); - g_object_set (clip3, "start", 20, "duration", 10, NULL); + g_object_set (clip1, "start", (guint64) 0, "duration", (gint64) 10, NULL); + g_object_set (clip2, "start", (guint64) 10, "duration", (gint64) 10, NULL); + g_object_set (clip3, "start", (guint64) 20, "duration", (gint64) 10, NULL); /* Add objects to the timeline */ fail_unless (ges_layer_add_clip (layer1, clip1)); @@ -1606,7 +1606,7 @@ GST_START_TEST (test_layer_get_clips_in_interval) clip = (GESClip *) ges_test_clip_new (); fail_unless (clip != NULL); - g_object_set (clip, "start", 10, "duration", 30, NULL); + g_object_set (clip, "start", (guint64) 10, "duration", (gint64) 30, NULL); assert_equals_uint64 (_START (clip), 10); assert_equals_uint64 (_DURATION (clip), 30); @@ -1662,7 +1662,7 @@ GST_START_TEST (test_layer_get_clips_in_interval) /* Multiple intersecting clips */ clip2 = (GESClip *) ges_test_clip_new (); fail_unless (clip2 != NULL); - g_object_set (clip2, "start", 50, "duration", 10, NULL); + g_object_set (clip2, "start", (guint64) 50, "duration", (gint64) 10, NULL); assert_equals_uint64 (_START (clip2), 50); assert_equals_uint64 (_DURATION (clip2), 10); @@ -1670,7 +1670,7 @@ GST_START_TEST (test_layer_get_clips_in_interval) clip3 = (GESClip *) ges_test_clip_new (); fail_unless (clip3 != NULL); - g_object_set (clip3, "start", 0, "duration", 5, NULL); + g_object_set (clip3, "start", (guint64) 0, "duration", (gint64) 5, NULL); assert_equals_uint64 (_START (clip3), 0); assert_equals_uint64 (_DURATION (clip3), 5); diff --git a/tests/check/ges/project.c b/tests/check/ges/project.c index d5d7c732..0e62734d 100644 --- a/tests/check/ges/project.c +++ b/tests/check/ges/project.c @@ -346,12 +346,12 @@ _add_properties (GESTimeline * timeline) gst_object_unref (source); } else if (GES_IS_VIDEO_SOURCE (element)) { /* Adding children properties */ - gint64 posx = 42; + gint posx = 42; ges_timeline_element_set_child_properties (GES_TIMELINE_ELEMENT (element), "posx", posx, NULL); ges_timeline_element_get_child_properties (GES_TIMELINE_ELEMENT (element), "posx", &posx, NULL); - fail_unless_equals_int64 (posx, 42); + fail_unless_equals_int (posx, 42); } } @@ -419,10 +419,10 @@ _check_properties (GESTimeline * timeline) /* Checking children properties */ else if (GES_IS_VIDEO_SOURCE (element)) { /* Init 'posx' with a wrong value */ - gint64 posx = 27; + gint posx = 27; ges_timeline_element_get_child_properties (GES_TIMELINE_ELEMENT (element), "posx", &posx, NULL); - fail_unless_equals_int64 (posx, 42); + fail_unless_equals_int (posx, 42); } } g_list_free_full (track_elements, g_object_unref); diff --git a/tests/check/ges/test-utils.h b/tests/check/ges/test-utils.h index 85ee03a9..e6adf4ca 100644 --- a/tests/check/ges/test-utils.h +++ b/tests/check/ges/test-utils.h @@ -55,13 +55,16 @@ void free_children_properties (GParamSpec ** list, guint num_props); #define nle_object_check(nleobj, start, duration, mstart, mduration, priority, active) { \ - guint64 pstart, pdur, inpoint, pprio, pact; \ + guint64 pstart, inpoint; \ + gint64 pdur; \ + guint pprio; \ + gboolean pact; \ g_object_get (nleobj, "start", &pstart, "duration", &pdur, \ - "inpoint", &inpoint, "priority", &pprio, "active", &pact, \ + "inpoint", &inpoint, "priority", &pprio, "active", &pact, \ NULL); \ assert_equals_uint64 (pstart, start); \ - assert_equals_uint64 (pdur, duration); \ - assert_equals_uint64 (inpoint, mstart); \ + assert_equals_int64 (pdur, duration); \ + assert_equals_uint64 (inpoint, mstart); \ assert_equals_int (pprio, priority); \ assert_equals_int (pact, active); \ } diff --git a/tests/check/nle/nlecomposition.c b/tests/check/nle/nlecomposition.c index 3607ddb3..667ae8d4 100644 --- a/tests/check/nle/nlecomposition.c +++ b/tests/check/nle/nlecomposition.c @@ -226,7 +226,8 @@ GST_START_TEST (test_remove_last_object) audiotestsrc = gst_element_factory_make ("audiotestsrc", "audiotestsrc1"); gst_bin_add (GST_BIN (source1), audiotestsrc); g_object_set (source1, "start", (guint64) 0 * GST_SECOND, - "duration", 10 * GST_SECOND, "inpoint", (guint64) 0, "priority", 1, NULL); + "duration", (gint64) 10 * GST_SECOND, "inpoint", (guint64) 0, "priority", + 1, NULL); nle_composition_add (composition, source1); @@ -234,7 +235,8 @@ GST_START_TEST (test_remove_last_object) audiotestsrc2 = gst_element_factory_make ("audiotestsrc", "audiotestsrc1"); gst_bin_add (GST_BIN (source2), audiotestsrc2); g_object_set (source2, "start", (guint64) 10 * GST_SECOND, - "duration", 10 * GST_SECOND, "inpoint", (guint64) 0, "priority", 1, NULL); + "duration", (gint64) 10 * GST_SECOND, "inpoint", (guint64) 0, "priority", + 1, NULL); nle_composition_add (composition, source2); @@ -314,7 +316,8 @@ GST_START_TEST (test_dispose_on_commit) audiotestsrc = gst_element_factory_make ("audiotestsrc", "audiotestsrc1"); gst_bin_add (GST_BIN (nlesource), audiotestsrc); g_object_set (nlesource, "start", (guint64) 0 * GST_SECOND, - "duration", 10 * GST_SECOND, "inpoint", (guint64) 0, "priority", 1, NULL); + "duration", (gint64) 10 * GST_SECOND, "inpoint", (guint64) 0, "priority", + 1, NULL); fail_unless (nle_composition_add (GST_BIN (composition), nlesource)); gst_bin_add_many (GST_BIN (pipeline), composition, fakesink, NULL); @@ -369,7 +372,8 @@ GST_START_TEST (test_simple_audiomixer) audiotestsrc1 = gst_element_factory_make ("audiotestsrc", "audiotestsrc1"); gst_bin_add (GST_BIN (nlesource1), audiotestsrc1); g_object_set (nlesource1, "start", (guint64) 0 * GST_SECOND, - "duration", total_time / 2, "inpoint", (guint64) 0, "priority", 1, NULL); + "duration", (gint64) total_time / 2, "inpoint", (guint64) 0, "priority", + 1, NULL); fail_unless (nle_composition_add (GST_BIN (composition), nlesource1)); /* nlesource2 */ @@ -459,7 +463,8 @@ create_nested_source (gint nesting_depth) name = g_strdup_printf ("nested_src%d", i); source = gst_element_factory_make_or_warn ("nlesource", name); g_free (name); - g_object_set (source, "start", 0, "duration", 2 * GST_SECOND, NULL); + g_object_set (source, "start", (guint64) 0, "duration", + (gint64) 2 * GST_SECOND, NULL); gst_bin_add (GST_BIN (source), bin); } diff --git a/tests/check/nle/tempochange.c b/tests/check/nle/tempochange.c index e3d8208c..212b3c4c 100644 --- a/tests/check/nle/tempochange.c +++ b/tests/check/nle/tempochange.c @@ -292,20 +292,20 @@ _setup_test (GstElement * pipeline, gdouble rate) nle_source = audiotest_bin_src ("nle_source", 3 * GST_SECOND, 4 * GST_SECOND, 3, FALSE); - g_object_set (nle_source, "inpoint", 7 * GST_SECOND, NULL); + g_object_set (nle_source, "inpoint", (guint64) 7 * GST_SECOND, NULL); src = _get_source (nle_source); g_object_set (src, "name", "middle-source", NULL); nle_prev = audiotest_bin_src ("nle_previous", 0 * GST_SECOND, 3 * GST_SECOND, 2, FALSE); - g_object_set (nle_prev, "inpoint", 99 * GST_SECOND, NULL); + g_object_set (nle_prev, "inpoint", (guint64) 99 * GST_SECOND, NULL); prev = _get_source (nle_prev); g_object_set (src, "name", "previous-source", NULL); nle_post = audiotest_bin_src ("post", 7 * GST_SECOND, 5 * GST_SECOND, 2, FALSE); - g_object_set (nle_post, "inpoint", 20 * GST_SECOND, NULL); + g_object_set (nle_post, "inpoint", (guint64) 20 * GST_SECOND, NULL); post = _get_source (nle_post); g_object_set (src, "name", "post-source", NULL); @@ -322,7 +322,7 @@ _setup_test (GstElement * pipeline, gdouble rate) * duration */ nle_identity = new_operation ("nle_identity", "identity", 0, 12 * GST_SECOND, 1); - g_object_set (nle_identity, "inpoint", 5 * GST_SECOND, NULL); + g_object_set (nle_identity, "inpoint", (guint64) 5 * GST_SECOND, NULL); fail_unless (g_list_length (GST_BIN_CHILDREN (nle_oper)) == 1); identity = GST_ELEMENT (GST_BIN_CHILDREN (nle_identity)->data); -- GitLab From 50039a8b45d91b903b3f8b41786b7cc9ff121c6d Mon Sep 17 00:00:00 2001 From: Doug Nazar Date: Sat, 1 May 2021 16:52:22 -0400 Subject: [PATCH 4/6] ges:validate: Use correct types when getting structure values --- ges/ges-validate.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ges/ges-validate.c b/ges/ges-validate.c index 3b666ed5..7d769869 100644 --- a/ges/ges-validate.c +++ b/ges/ges-validate.c @@ -367,11 +367,15 @@ GES_START_VALIDATE_ACTION (_edit) REPORT_UNLESS (element, beach, "Could not find element %s", element_name); if (!_get_clocktime (action->structure, "position", &position, &fposition)) { - fposition = 0; - if (!gst_structure_get_int (action->structure, "source-frame", - (gint *) & fposition) - && !gst_structure_get_int64 (action->structure, "source-frame", - &fposition)) { + gint pos; + gint64 pos64; + + if (gst_structure_get_int (action->structure, "source-frame", &pos)) { + fposition = pos; + } else if (gst_structure_get_int64 (action->structure, "source-frame", + &pos64)) { + fposition = pos64; + } else { gchar *structstr = gst_structure_to_string (action->structure); GST_VALIDATE_REPORT_ACTION (scenario, action, -- GitLab From 2391e65674f183a302dc76ef9c8aca71712f04d3 Mon Sep 17 00:00:00 2001 From: Doug Nazar Date: Sat, 1 May 2021 16:53:36 -0400 Subject: [PATCH 5/6] tests: Increase seek offset slightly in 'test_tempochange_seek' Test would consistently fail with an unexpected EOS after the last seek. Moving the seek to a bit earlier fixes this. --- tests/check/nle/tempochange.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/check/nle/tempochange.c b/tests/check/nle/tempochange.c index 212b3c4c..8a3df2ab 100644 --- a/tests/check/nle/tempochange.c +++ b/tests/check/nle/tempochange.c @@ -147,7 +147,7 @@ _test_pad_events (GstPad * pad, GstPadProbeInfo * info, PadEventData * data) data->num_eos++; fail_unless (data->num_eos <= data->expect_num_eos, "%s received %u " "EOS, more than the expected %u EOS", data->name, data->num_eos, - data->expect_num_seeks); + data->expect_num_eos); } return GST_PAD_PROBE_OK; @@ -514,7 +514,7 @@ GST_START_TEST (test_tempochange_seek) PadEventData **data; gdouble rates[3] = { 2.0, 0.25, 1.0 }; guint i, j; - GstClockTime offset = 0.1 * GST_SECOND; + GstClockTime offset = 0.2 * GST_SECOND; for (i = 0; i < G_N_ELEMENTS (rates); i++) { gdouble rate = rates[i]; -- GitLab From 82a9217cb52493a23930eef75f7f770ee63ca6d8 Mon Sep 17 00:00:00 2001 From: Doug Nazar Date: Sat, 1 May 2021 17:09:33 -0400 Subject: [PATCH 6/6] track: Silence warning if no layer --- ges/ges-track.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ges/ges-track.c b/ges/ges-track.c index d3bd2ef8..38f6d657 100644 --- a/ges/ges-track.c +++ b/ges/ges-track.c @@ -239,7 +239,7 @@ update_gaps (GESTrack * track) if (layer_prio != GES_TIMELINE_ELEMENT_NO_LAYER_PRIORITY) { GESLayer *layer = g_list_nth_data (priv->timeline->layers, layer_prio); - if (!ges_layer_get_active_for_track (layer, track)) + if (!layer || !ges_layer_get_active_for_track (layer, track)) continue; } } -- GitLab