Skip to content

Commit

Permalink
glmixer: Fix unit test to actually work reliably
Browse files Browse the repository at this point in the history
Don't run the harness in live mode, or otherwise it would output frames
already in the very beginning before a buffer was provided to it due to
timeout.

Also send EOS/a second buffer before pulling a buffer as videoaggregator
has one frame of latency.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/812>
  • Loading branch information
sdroege committed Sep 10, 2020
1 parent 9ccc3db commit 40a1e01
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/check/elements/glmixer.c
Expand Up @@ -38,6 +38,8 @@ replace_display (GstHarness * h)

/* replaces the GstGLDisplay used by @h with verification */

fail_unless_equals_int (GST_FLOW_OK, gst_harness_push_from_src (h));
/* need a second buffer to pull one, videoaggregator has one frame latency */
fail_unless_equals_int (GST_FLOW_OK, gst_harness_push_from_src (h));
buf = gst_harness_pull (h);
fail_unless (buf != NULL);
Expand Down Expand Up @@ -82,15 +84,17 @@ GST_START_TEST (test_glvideomixer_negotiate)
GstBuffer *buf;

mix = gst_harness_new_with_padnames ("glvideomixer", "sink_0", "src");
gst_harness_use_systemclock (mix);
gst_harness_set_live (mix, FALSE);
gst_harness_set_blocking_push_mode (mix);
gst_harness_set_caps_str (mix,
"video/x-raw(memory:GLMemory),format=RGBA,width=1,height=1,framerate=25/1,texture-target=2D",
"video/x-raw(memory:GLMemory),format=RGBA,width=1,height=1,framerate=25/1,texture-target=2D");
gst_harness_add_src (mix, "gltestsrc", FALSE);
gst_harness_set_live (mix->src_harness, FALSE);
gst_harness_set_blocking_push_mode (mix->src_harness);

fail_unless_equals_int (GST_FLOW_OK, gst_harness_push_from_src (mix));
fail_unless (gst_harness_push_event (mix, gst_event_new_eos ()));

buf = gst_harness_pull (mix);
fail_unless (buf != NULL);
Expand All @@ -106,12 +110,13 @@ GST_START_TEST (test_glvideomixer_display_replace)
GstHarness *mix;

mix = gst_harness_new_with_padnames ("glvideomixer", "sink_0", "src");
gst_harness_use_systemclock (mix);
gst_harness_set_live (mix, FALSE);
gst_harness_set_blocking_push_mode (mix);
gst_harness_set_caps_str (mix,
"video/x-raw(memory:GLMemory),format=RGBA,width=1,height=1,framerate=25/1,texture-target=2D",
"video/x-raw(memory:GLMemory),format=RGBA,width=1,height=1,framerate=25/1,texture-target=2D");
gst_harness_add_src (mix, "gltestsrc", FALSE);
gst_harness_set_live (mix->src_harness, FALSE);
gst_harness_set_blocking_push_mode (mix->src_harness);

replace_display (mix);
Expand Down

0 comments on commit 40a1e01

Please sign in to comment.