From 81998ed929acce3d6bbf45ed4ec98768e8ef34d7 Mon Sep 17 00:00:00 2001 From: jcaballeros Date: Fri, 31 Jul 2020 18:47:28 -0600 Subject: [PATCH 1/7] Test stream-sync=compensate-ts instead of removed enable-sync property The enable-sync property test was failing because this property was removed since v1.0.7. The equivalent behaviour of enable-sync=true can be achieved with stream-sync=compensate-ts. --- tests/check/Makefile.am | 2 +- .../gst/{test_enable_sync.c => test_stream_sync.c} | 13 +++++++------ tests/check/meson.build | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) rename tests/check/gst/{test_enable_sync.c => test_stream_sync.c} (88%) mode change 100755 => 100644 diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index b5af6b3..5cf1b8f 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -27,7 +27,7 @@ check_PROGRAMS = gst/test_allow_renegotiation_property \ gst/test_block_switch \ gst/test_buffer_properties \ gst/test_caps_renegotiation \ - gst/test_enable_sync \ + gst/test_stream_sync \ gst/test_get_caps \ gst/test_hot_plug \ gst/test_in_bounds_events \ diff --git a/tests/check/gst/test_enable_sync.c b/tests/check/gst/test_stream_sync.c old mode 100755 new mode 100644 similarity index 88% rename from tests/check/gst/test_enable_sync.c rename to tests/check/gst/test_stream_sync.c index e5b5840..c0f10fa --- a/tests/check/gst/test_enable_sync.c +++ b/tests/check/gst/test_stream_sync.c @@ -1,5 +1,6 @@ /* GStreamer * Copyright (C) 2016 Erick Arroyo + * Copyright (C) 2020 Jennifer Caballero * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -27,11 +28,11 @@ #include /* - * Given two pipelines, play the first one, wait and the play + * Given two pipelines, play the first one, wait and then play * the other one, it should not be delay in the video when it is display - * only if the synchronization-switch property is enabled + * only if the stream-sync property is set to compensate-ts (2) */ -GST_START_TEST (interpipe_enable_sync) +GST_START_TEST (interpipe_stream_sync_compensate_ts) { GstPipeline *sink1; GstPipeline *sink2; @@ -66,7 +67,7 @@ GST_START_TEST (interpipe_enable_sync) /* Create one source pipeline */ src = GST_PIPELINE (gst_parse_launch - ("interpipesrc name=intersrc listen-to=intersink1 enable-sync=true block-switch=false allow-renegotiation=true format=3 ! capsfilter caps=video/x-raw,width=[320,1920],height=[240,1080],framerate=(fraction)5/1 ! " + ("interpipesrc name=intersrc listen-to=intersink1 stream-sync=compensate-ts block-switch=false allow-renegotiation=true format=3 ! capsfilter caps=video/x-raw,width=[320,1920],height=[240,1080],framerate=(fraction)5/1 ! " "appsink name=asink drop=true async=false sync=true", &error)); fail_if (error); intersrc = gst_bin_get_by_name (GST_BIN (src), "intersrc"); @@ -130,10 +131,10 @@ static Suite * gst_interpipe_suite (void) { Suite *suite = suite_create ("Interpipe"); - TCase *tc1 = tcase_create ("interpipe_enable_sync"); + TCase *tc1 = tcase_create ("interpipe_stream_sync"); suite_add_tcase (suite, tc1); - tcase_add_test (tc1, interpipe_enable_sync); + tcase_add_test (tc1, interpipe_stream_sync_compensate_ts); return suite; } diff --git a/tests/check/meson.build b/tests/check/meson.build index 66ab5b1..dba190d 100644 --- a/tests/check/meson.build +++ b/tests/check/meson.build @@ -4,7 +4,7 @@ core_tests = [ [ 'gst/test_anonymous_connection.c' ], [ 'gst/test_block_switch.c' ], [ 'gst/test_caps_renegotiation.c' ], - [ 'gst/test_enable_sync.c' ], + [ 'gst/test_stream_sync.c' ], [ 'gst/test_get_caps.c' ], [ 'gst/test_hot_plug.c' ], [ 'gst/test_in_bounds_events.c' ], From 944df352af992b830ad796631f86ef1b689707ed Mon Sep 17 00:00:00 2001 From: jcaballeros Date: Wed, 5 Aug 2020 10:02:40 -0600 Subject: [PATCH 2/7] Merge test_interpipe_synchronization into test_stream_sync --- tests/check/Makefile.am | 1 - .../gst/test_interpipe_synchronization.c | 143 ------------------ tests/check/gst/test_stream_sync.c | 15 +- tests/check/meson.build | 1 - 4 files changed, 11 insertions(+), 149 deletions(-) delete mode 100644 tests/check/gst/test_interpipe_synchronization.c diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 5cf1b8f..ae73661 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -31,7 +31,6 @@ check_PROGRAMS = gst/test_allow_renegotiation_property \ gst/test_get_caps \ gst/test_hot_plug \ gst/test_in_bounds_events \ - gst/test_interpipe_synchronization \ gst/test_invalid_caps \ gst/test_node_name_removed \ gst/test_out_of_bounds_events \ diff --git a/tests/check/gst/test_interpipe_synchronization.c b/tests/check/gst/test_interpipe_synchronization.c deleted file mode 100644 index 9dd76ec..0000000 --- a/tests/check/gst/test_interpipe_synchronization.c +++ /dev/null @@ -1,143 +0,0 @@ -/* GStreamer - * Copyright (C) 2016 Carlos Rodriguez - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include - -/* - * Given two pipelines, play the first one, wait and the play - * the other one, it should not be delay in the video when it is display - */ -GST_START_TEST (interpipe_synchronization) -{ - GstPipeline *sink1; - GstPipeline *sink2; - GstPipeline *src; - GstElement *vtsrc1; - GstElement *vtsrc2; - GstElement *intersrc; - GstElement *asink; - GstSample *outsample; - GstBuffer *buffer; - GstClockTime buffer_timestamp1, buffer_timestamp2; - GError *error = NULL; - - /* Create two sink pipelines */ - sink1 = - GST_PIPELINE (gst_parse_launch - ("videotestsrc name=vtsrc1 is-live=true pattern=18 ! capsfilter caps=video/x-raw,width=320,height=240,framerate=(fraction)5/1 ! interpipesink " - "name=intersink1 drop=true async=false sync=true", &error)); - fail_if (error); - vtsrc1 = gst_bin_get_by_name (GST_BIN (sink1), "vtsrc1"); - sink2 = - GST_PIPELINE (gst_parse_launch - ("videotestsrc name=vtsrc2 is-live=true ! capsfilter caps=video/x-raw,width=320,height=240,framerate=(fraction)5/1 ! interpipesink " - "name=intersink2 drop=true async=false sync=true", &error)); - fail_if (error); - vtsrc2 = gst_bin_get_by_name (GST_BIN (sink2), "vtsrc2"); - - /* Create one source pipeline */ - src = - GST_PIPELINE (gst_parse_launch - ("interpipesrc name=intersrc listen-to=intersink1 block-switch=false allow-renegotiation=true format=3 ! capsfilter caps=video/x-raw,width=[320,1920],height=[240,1080],framerate=(fraction)5/1 ! " - "appsink name=asink drop=true async=false sync=true", &error)); - fail_if (error); - intersrc = gst_bin_get_by_name (GST_BIN (src), "intersrc"); - asink = gst_bin_get_by_name (GST_BIN (src), "asink"); - - /* - * Play the pipelines - * gst_element_get_state blocks up execution until the state change is - * completed. It's used here to guarantee a secuential pipeline initialization - * and avoid concurrency errors. - */ - fail_if (GST_STATE_CHANGE_FAILURE == gst_element_set_state (GST_ELEMENT (src), - GST_STATE_PLAYING)); - fail_if (GST_STATE_CHANGE_FAILURE == gst_element_get_state (GST_ELEMENT (src), - NULL, NULL, GST_CLOCK_TIME_NONE)); - fail_if (GST_STATE_CHANGE_FAILURE == - gst_element_set_state (GST_ELEMENT (sink1), GST_STATE_PLAYING)); - fail_if (GST_STATE_CHANGE_FAILURE == - gst_element_get_state (GST_ELEMENT (sink1), NULL, NULL, - GST_CLOCK_TIME_NONE)); - fail_if (GST_STATE_CHANGE_FAILURE == - gst_element_set_state (GST_ELEMENT (sink2), GST_STATE_PLAYING)); - fail_if (GST_STATE_CHANGE_FAILURE == - gst_element_get_state (GST_ELEMENT (sink1), NULL, NULL, - GST_CLOCK_TIME_NONE)); - - /* Verifies if the caps are set correctly to the listeners - */ - outsample = gst_app_sink_pull_sample (GST_APP_SINK (asink)); - buffer = gst_sample_get_buffer (outsample); - fail_if (!buffer); - buffer_timestamp1 = GST_BUFFER_DTS (buffer); - GST_ERROR ("Buffer timestamp (dts): %" GST_TIME_FORMAT, - GST_TIME_ARGS (GST_BUFFER_DTS (buffer))); - fail_if (buffer_timestamp1 == 0); - - /* Change to another video src */ - g_object_set (G_OBJECT (intersrc), "listen-to", "intersink2", NULL); - outsample = gst_app_sink_pull_sample (GST_APP_SINK (asink)); - buffer = gst_sample_get_buffer (outsample); - buffer_timestamp2 = GST_BUFFER_PTS (buffer); - fail_if (buffer_timestamp2 == 0); - fail_if (buffer_timestamp2 < buffer_timestamp1); - - /* Stop pipelines */ - fail_if (GST_STATE_CHANGE_FAILURE == - gst_element_set_state (GST_ELEMENT (sink1), GST_STATE_NULL)); - fail_if (GST_STATE_CHANGE_FAILURE == - gst_element_set_state (GST_ELEMENT (sink2), GST_STATE_NULL)); - fail_if (GST_STATE_CHANGE_FAILURE == gst_element_set_state (GST_ELEMENT (src), - GST_STATE_NULL)); - - /* Cleanup */ - g_object_unref (sink1); - g_object_unref (sink2); - g_object_unref (vtsrc1); - g_object_unref (vtsrc2); - g_object_unref (intersrc); - g_object_unref (asink); - g_object_unref (src); - gst_sample_unref (outsample); -} - -GST_END_TEST; - -static Suite * -gst_interpipe_suite (void) -{ - Suite *suite = suite_create ("Interpipe"); - TCase *tc = tcase_create ("interpipe_synchronization"); - - tcase_set_timeout (tc, 0); - suite_add_tcase (suite, tc); - tcase_add_test (tc, interpipe_synchronization); - - return suite; -} - -GST_CHECK_MAIN (gst_interpipe); diff --git a/tests/check/gst/test_stream_sync.c b/tests/check/gst/test_stream_sync.c index c0f10fa..73c1718 100644 --- a/tests/check/gst/test_stream_sync.c +++ b/tests/check/gst/test_stream_sync.c @@ -1,5 +1,6 @@ /* GStreamer * Copyright (C) 2016 Erick Arroyo + * Copyright (C) 2016 Carlos Rodriguez * Copyright (C) 2020 Jennifer Caballero * * This library is free software; you can redistribute it and/or @@ -81,10 +82,18 @@ GST_START_TEST (interpipe_stream_sync_compensate_ts) */ fail_if (GST_STATE_CHANGE_FAILURE == gst_element_set_state (GST_ELEMENT (sink1), GST_STATE_PLAYING)); + fail_if (GST_STATE_CHANGE_FAILURE == + gst_element_get_state (GST_ELEMENT (sink1), NULL, NULL, + GST_CLOCK_TIME_NONE)); fail_if (GST_STATE_CHANGE_FAILURE == gst_element_set_state (GST_ELEMENT (src), GST_STATE_PLAYING)); + fail_if (GST_STATE_CHANGE_FAILURE == gst_element_get_state (GST_ELEMENT (src), + NULL, NULL, GST_CLOCK_TIME_NONE)); fail_if (GST_STATE_CHANGE_FAILURE == gst_element_set_state (GST_ELEMENT (sink2), GST_STATE_PLAYING)); + fail_if (GST_STATE_CHANGE_FAILURE == + gst_element_get_state (GST_ELEMENT (sink2), NULL, NULL, + GST_CLOCK_TIME_NONE)); /* Verifies if the caps are set correctly to the listeners */ @@ -92,11 +101,9 @@ GST_START_TEST (interpipe_stream_sync_compensate_ts) buffer = gst_sample_get_buffer (outsample); fail_if (!buffer); buffer_timestamp1 = GST_BUFFER_PTS (buffer); - GST_ERROR ("Buffer timestamp (dts): %" GST_TIME_FORMAT, - GST_TIME_ARGS (GST_BUFFER_DTS (buffer))); fail_if (buffer_timestamp1 == 0); - /* Change to another video src */ + /* Change to another video src */ g_object_set (G_OBJECT (intersrc), "listen-to", "intersink2", NULL); outsample = gst_app_sink_pull_sample (GST_APP_SINK (asink)); @@ -122,7 +129,7 @@ GST_START_TEST (interpipe_stream_sync_compensate_ts) g_object_unref (intersrc); g_object_unref (asink); g_object_unref (src); - + gst_sample_unref (outsample); } GST_END_TEST; diff --git a/tests/check/meson.build b/tests/check/meson.build index dba190d..57962cc 100644 --- a/tests/check/meson.build +++ b/tests/check/meson.build @@ -8,7 +8,6 @@ core_tests = [ [ 'gst/test_get_caps.c' ], [ 'gst/test_hot_plug.c' ], [ 'gst/test_in_bounds_events.c' ], - [ 'gst/test_interpipe_synchronization.c' ], [ 'gst/test_invalid_caps.c' ], [ 'gst/test_node_name_removed.c' ], [ 'gst/test_out_of_bounds_events.c' ], From 5e58be901107f4b786e4bd743b1a62963cd27512 Mon Sep 17 00:00:00 2001 From: jcaballeros Date: Wed, 5 Aug 2020 11:34:43 -0600 Subject: [PATCH 3/7] Test stream-sync=compensate-ts consistency switching src twice --- tests/check/gst/test_stream_sync.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/check/gst/test_stream_sync.c b/tests/check/gst/test_stream_sync.c index 73c1718..29b5485 100644 --- a/tests/check/gst/test_stream_sync.c +++ b/tests/check/gst/test_stream_sync.c @@ -102,6 +102,7 @@ GST_START_TEST (interpipe_stream_sync_compensate_ts) fail_if (!buffer); buffer_timestamp1 = GST_BUFFER_PTS (buffer); fail_if (buffer_timestamp1 == 0); + gst_sample_unref (outsample); /* Change to another video src */ g_object_set (G_OBJECT (intersrc), "listen-to", "intersink2", NULL); @@ -112,6 +113,17 @@ GST_START_TEST (interpipe_stream_sync_compensate_ts) fail_if (buffer_timestamp2 == 0); fail_if (buffer_timestamp2 < buffer_timestamp1); + gst_sample_unref (outsample); + + /* Now change to the first video src and pull another buffer */ + g_object_set (G_OBJECT (intersrc), "listen-to", "intersink1", NULL); + + outsample = gst_app_sink_pull_sample (GST_APP_SINK (asink)); + buffer = gst_sample_get_buffer (outsample); + buffer_timestamp1 = GST_BUFFER_PTS (buffer); + fail_if (buffer_timestamp1 == 0); + + fail_if (buffer_timestamp1 < buffer_timestamp2); /* Stop pipelines */ fail_if (GST_STATE_CHANGE_FAILURE == From d55004cc41c01a3ada2512cfaf0146aef9681df9 Mon Sep 17 00:00:00 2001 From: jcaballeros Date: Wed, 12 Aug 2020 09:21:23 -0600 Subject: [PATCH 4/7] Remove empty spaces --- tests/check/gst/test_stream_sync.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/check/gst/test_stream_sync.c b/tests/check/gst/test_stream_sync.c index 29b5485..c01596c 100644 --- a/tests/check/gst/test_stream_sync.c +++ b/tests/check/gst/test_stream_sync.c @@ -37,13 +37,9 @@ GST_START_TEST (interpipe_stream_sync_compensate_ts) { GstPipeline *sink1; GstPipeline *sink2; - - GstPipeline *src; GstElement *vtsrc1; GstElement *vtsrc2; - - GstElement *intersrc; GstElement *asink; GstSample *outsample; From 20f7cd08ba5837dae409bac17cb7e17204dfe291 Mon Sep 17 00:00:00 2001 From: jcaballeros Date: Wed, 12 Aug 2020 10:40:39 -0600 Subject: [PATCH 5/7] Break pipeline description long line --- tests/check/gst/test_stream_sync.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/check/gst/test_stream_sync.c b/tests/check/gst/test_stream_sync.c index c01596c..387b471 100644 --- a/tests/check/gst/test_stream_sync.c +++ b/tests/check/gst/test_stream_sync.c @@ -40,6 +40,7 @@ GST_START_TEST (interpipe_stream_sync_compensate_ts) GstPipeline *src; GstElement *vtsrc1; GstElement *vtsrc2; + GstElement *intersrc; GstElement *asink; GstSample *outsample; @@ -64,7 +65,9 @@ GST_START_TEST (interpipe_stream_sync_compensate_ts) /* Create one source pipeline */ src = GST_PIPELINE (gst_parse_launch - ("interpipesrc name=intersrc listen-to=intersink1 stream-sync=compensate-ts block-switch=false allow-renegotiation=true format=3 ! capsfilter caps=video/x-raw,width=[320,1920],height=[240,1080],framerate=(fraction)5/1 ! " + ("interpipesrc name=intersrc listen-to=intersink1 stream-sync=compensate-ts " + "block-switch=false allow-renegotiation=true format=3 ! capsfilter " + "caps=video/x-raw,width=[320,1920],height=[240,1080],framerate=(fraction)5/1 ! " "appsink name=asink drop=true async=false sync=true", &error)); fail_if (error); intersrc = gst_bin_get_by_name (GST_BIN (src), "intersrc"); From 9cc8b18aa5c5bf6f562aa412051fdf3ada56747f Mon Sep 17 00:00:00 2001 From: jcaballeros Date: Wed, 12 Aug 2020 11:04:19 -0600 Subject: [PATCH 6/7] Stream sync test flush old buffers when switching to another source --- tests/check/gst/test_stream_sync.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/check/gst/test_stream_sync.c b/tests/check/gst/test_stream_sync.c index 387b471..574293b 100644 --- a/tests/check/gst/test_stream_sync.c +++ b/tests/check/gst/test_stream_sync.c @@ -103,6 +103,11 @@ GST_START_TEST (interpipe_stream_sync_compensate_ts) fail_if (buffer_timestamp1 == 0); gst_sample_unref (outsample); + /* Disconnect interpipesrc and flush old buffers */ + g_object_set (G_OBJECT (intersrc), "listen-to", NULL, NULL); + fail_if (!gst_element_send_event(GST_ELEMENT(src), gst_event_new_flush_start())); + fail_if (!gst_element_send_event(GST_ELEMENT(src), gst_event_new_flush_stop(FALSE))); + /* Change to another video src */ g_object_set (G_OBJECT (intersrc), "listen-to", "intersink2", NULL); @@ -114,6 +119,11 @@ GST_START_TEST (interpipe_stream_sync_compensate_ts) fail_if (buffer_timestamp2 < buffer_timestamp1); gst_sample_unref (outsample); + /* Disconnect interpipesrc and flush old buffers */ + g_object_set (G_OBJECT (intersrc), "listen-to", NULL, NULL); + fail_if (!gst_element_send_event(GST_ELEMENT(src), gst_event_new_flush_start())); + fail_if (!gst_element_send_event(GST_ELEMENT(src), gst_event_new_flush_stop(FALSE))); + /* Now change to the first video src and pull another buffer */ g_object_set (G_OBJECT (intersrc), "listen-to", "intersink1", NULL); From 8253ee45b2f5a17feabd76c0ad5f7a05b71f3c4c Mon Sep 17 00:00:00 2001 From: jcaballeros Date: Thu, 13 Aug 2020 09:01:23 -0600 Subject: [PATCH 7/7] Bump version --- configure.ac | 2 +- gst-interpipe.doap | 10 ++++++++++ meson.build | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 3349cd0..65cbb6f 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ dnl please read gstreamer/docs/random/autotools before changing this file dnl initialize autoconf dnl releases only do -Wall, git and prerelease does -Werror too dnl use a three digit version number for releases, and four for git/pre -AC_INIT([GstInterpipe],[1.1.1], +AC_INIT([GstInterpipe],[1.1.2], [http://www.github.com/RidgeRun/gst-interpipe-1.0], [gst-interpipe], [http://developer.ridgerun.com/wiki/index.php?title=GstInterpipe]) diff --git a/gst-interpipe.doap b/gst-interpipe.doap index afc7035..4c04fe1 100644 --- a/gst-interpipe.doap +++ b/gst-interpipe.doap @@ -30,6 +30,16 @@ GstInterpipe is a plug-in with two elements which allow the communication betwee + + + 1.1.2 + master + + 2020-08-13 + + + + 1.1.1 diff --git a/meson.build b/meson.build index c76753d..08dee92 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('gst-interpipes', 'c', - version : '1.0.4', + version : '1.1.2', meson_version : '>= 0.50',) gst_interpipes_version = meson.project_version()