validate:launcher: Move get_fakesink_for_media_type to utils

So it can be reused in other apps like GES
This commit is contained in:
Thibault Saunier 2019-06-23 12:48:06 -04:00
parent 1e1797ee3a
commit 3343f166da
3 changed files with 20 additions and 22 deletions

View file

@ -36,7 +36,7 @@ from launcher.baseclasses import GstValidateTest, Test, \
from launcher.utils import path2url, url2path, DEFAULT_TIMEOUT, which, \
GST_SECOND, Result, Protocols, mkdir, printc, Colors, get_data_file, \
kill_subprocess, format_config_template
kill_subprocess, format_config_template, get_fakesink_for_media_type
#
# Private global variables #
@ -287,10 +287,8 @@ class GstValidatePipelineTestsGenerator(GstValidateTestsGenerator):
if self.test_manager.options.mute:
needs_clock = scenario.needs_clock_sync() \
if scenario else False
audiosink = self.get_fakesink_for_media_type(
"audio", needs_clock)
videosink = self.get_fakesink_for_media_type(
"video", needs_clock)
audiosink = get_fakesink_for_media_type("audio", needs_clock)
videosink = get_fakesink_for_media_type("video", needs_clock)
else:
audiosink = 'autoaudiosink'
videosink = 'autovideosink'
@ -330,8 +328,8 @@ class GstValidatePlaybinTestsGenerator(GstValidatePipelineTestsGenerator):
if self.test_manager.options.mute:
needs_clock = scenario.needs_clock_sync() or minfo.media_descriptor.need_clock_sync()
afakesink = self.get_fakesink_for_media_type("audio", needs_clock)
vfakesink = self.get_fakesink_for_media_type("video", needs_clock)
afakesink = get_fakesink_for_media_type("audio", needs_clock)
vfakesink = get_fakesink_for_media_type("video", needs_clock)
pipe_str += " audio-sink='%s' video-sink='%s'" % (
afakesink, vfakesink)
@ -474,8 +472,8 @@ class GstValidateMixerTestsGenerator(GstValidatePipelineTestsGenerator):
self.debug("Adding: %s", fname)
if self.test_manager.options.mute:
pipe_arguments["sink"] = self.get_fakesink_for_media_type(self.media_type,
scenario.needs_clock_sync())
pipe_arguments["sink"] = get_fakesink_for_media_type(self.media_type,
scenario.needs_clock_sync())
else:
pipe_arguments["sink"] = "auto%ssink" % self.media_type

View file

@ -1562,19 +1562,6 @@ class GstValidateTestsGenerator(TestsGenerator):
def populate_tests(self, uri_minfo_special_scenarios, scenarios):
pass
@staticmethod
def get_fakesink_for_media_type(media_type, needs_clock=False):
if media_type == "video":
if needs_clock:
return 'fakevideosink qos=true max-lateness=20000000'
return "fakevideosink sync=false"
if needs_clock:
return "fakesink sync=true"
return "fakesink"
def generate_tests(self, uri_minfo_special_scenarios, scenarios):
self.populate_tests(uri_minfo_special_scenarios, scenarios)
return super(GstValidateTestsGenerator, self).generate_tests()

View file

@ -640,3 +640,16 @@ def format_config_template(extra_data, config_text, test_name):
extra_vars['validateflow'] = "validateflow, expectations-dir=\"%s\", actual-results-dir=\"%s\"" % (expectations_dir, actual_results_dir)
return config_text % extra_vars
def get_fakesink_for_media_type(media_type, needs_clock=False):
if media_type == "video":
if needs_clock:
return 'fakevideosink qos=true max-lateness=20000000'
return "fakevideosink sync=false"
if needs_clock:
return "fakesink sync=true"
return "fakesink"