summaryrefslogtreecommitdiff
path: root/subprojects/gst-editing-services/tests
diff options
context:
space:
mode:
authorThibault Saunier <tsaunier@igalia.com>2021-10-13 00:07:20 -0300
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-10-13 18:01:38 +0000
commit19c09211790ef2715350176a9b7551dabede9612 (patch)
treec672e5dfc7bde051ffa6b4470a50ae5b41f5781d /subprojects/gst-editing-services/tests
parentfbee6c8b230e7c2fb8f0a9ab7a0cc27ad1176fdf (diff)
downloadgstreamer-19c09211790ef2715350176a9b7551dabede9612.tar.gz
ges:tests: Create shorter assets to avoid timeouts
And use a simple GStreamer pipeline as testsrcbin with GstTranscoder doesn't let us easily set the framerate of the source and we end up having videorate dropping frames leading to the rendered file having an unprecise duration. This should fix races with `check.gst-editing-services.pythontests.pyunittest.python.test_assets.TestTimeline.test_reload_asset` Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1130>
Diffstat (limited to 'subprojects/gst-editing-services/tests')
-rw-r--r--subprojects/gst-editing-services/tests/check/python/common.py13
-rw-r--r--subprojects/gst-editing-services/tests/check/python/test_assets.py6
2 files changed, 12 insertions, 7 deletions
diff --git a/subprojects/gst-editing-services/tests/check/python/common.py b/subprojects/gst-editing-services/tests/check/python/common.py
index 1593d68982..a07fd8f447 100644
--- a/subprojects/gst-editing-services/tests/check/python/common.py
+++ b/subprojects/gst-editing-services/tests/check/python/common.py
@@ -18,6 +18,7 @@
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
+from urllib.parse import urlparse
import gi
gi.require_version("Gst", "1.0")
@@ -116,13 +117,17 @@ def can_generate_assets():
@contextlib.contextmanager
-def created_video_asset(uri=None, num_bufs=30):
+def created_video_asset(uri=None, num_bufs=30, framerate="30/1"):
with tempfile.NamedTemporaryFile(suffix=".ogg") as f:
if not uri:
uri = Gst.filename_to_uri(f.name)
- transcoder = GstTranscoder.Transcoder.new("testbin://video,num-buffers=%s" % num_bufs,
- uri, "application/ogg:video/x-theora:audio/x-vorbis")
- transcoder.run()
+ name = f.name
+ else:
+ name = urlparse(uri).path
+ pipe = Gst.parse_launch(f"videotestsrc num-buffers={num_bufs} ! video/x-raw,framerate={framerate} ! theoraenc ! oggmux ! filesink location={name}")
+ pipe.set_state(Gst.State.PLAYING)
+ assert pipe.get_bus().timed_pop_filtered(Gst.CLOCK_TIME_NONE, Gst.MessageType.EOS)
+ pipe.set_state(Gst.State.NULL)
yield uri
diff --git a/subprojects/gst-editing-services/tests/check/python/test_assets.py b/subprojects/gst-editing-services/tests/check/python/test_assets.py
index e33c623009..9e6f6437cc 100644
--- a/subprojects/gst-editing-services/tests/check/python/test_assets.py
+++ b/subprojects/gst-editing-services/tests/check/python/test_assets.py
@@ -62,17 +62,17 @@ class TestTimeline(GESSimpleTimelineTest):
@unittest.skipUnless(*common.can_generate_assets())
def test_reload_asset(self):
- with common.created_video_asset() as uri:
+ with common.created_video_asset(num_bufs=2, framerate="2/1") as uri:
asset0 = GES.UriClipAsset.request_sync(uri)
self.assertEqual(asset0.props.duration, Gst.SECOND)
- with common.created_video_asset(uri, 60) as uri:
+ with common.created_video_asset(uri, 4, framerate="2/1") as uri:
GES.Asset.needs_reload(GES.UriClip, uri)
asset1 = GES.UriClipAsset.request_sync(uri)
self.assertEqual(asset1.props.duration, 2 * Gst.SECOND)
self.assertEqual(asset1, asset0)
- with common.created_video_asset(uri, 90) as uri:
+ with common.created_video_asset(uri, 6, framerate="2/1") as uri:
mainloop = common.create_main_loop()
def asset_loaded_cb(_, res, mainloop):
asset2 = GES.Asset.request_finish(res)