mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
validate:launcher:ges: Fix rendered duration checking
This commit is contained in:
parent
e847d7061a
commit
b8e1c3e64c
2 changed files with 15 additions and 9 deletions
|
@ -133,14 +133,15 @@ class GESRenderTest(GESTest):
|
|||
self.add_arguments("-f", profile, "-o", self.dest_file)
|
||||
|
||||
def check_results(self):
|
||||
if self.result is Result.PASSED and self.scenario is None:
|
||||
res, msg = utils.compare_rendered_with_original(self.duration, self.dest_file)
|
||||
if self.result in [Result.PASSED, Result.NOT_RUN] and self.scenario is None:
|
||||
res, msg = utils.compare_rendered_with_original(self.duration * utils.GST_SECOND,
|
||||
self.dest_file)
|
||||
self.set_result(res, msg)
|
||||
else:
|
||||
if self.result == utils.Result.TIMEOUT:
|
||||
missing_eos = False
|
||||
try:
|
||||
if utils.get_duration(self.dest_file) == self.duration:
|
||||
if utils.get_duration(self.dest_file) == self.duration * utils.GST_SECOND:
|
||||
missing_eos = True
|
||||
except Exception as e:
|
||||
pass
|
||||
|
|
|
@ -34,7 +34,7 @@ DEFAULT_TIMEOUT = 30
|
|||
DEFAULT_MAIN_DIR = os.path.expanduser("~/gst-validate/")
|
||||
DEFAULT_GST_QA_ASSETS = os.path.join(DEFAULT_MAIN_DIR, "gst-qa-assets")
|
||||
DISCOVERER_COMMAND = "gst-discoverer-1.0"
|
||||
DURATION_TOLERANCE = GST_SECOND / 2
|
||||
DURATION_TOLERANCE = GST_SECOND / 4
|
||||
# Use to set the duration from which a test is concidered as being 'long'
|
||||
LONG_TEST = 40
|
||||
|
||||
|
@ -165,6 +165,12 @@ def get_subclasses(klass, env):
|
|||
|
||||
return subclasses
|
||||
|
||||
def TIME_ARGS(time):
|
||||
return "%u:%02u:%02u.%09u" % (time / (GST_SECOND * 60 * 60),
|
||||
(time / (GST_SECOND * 60)) % 60,
|
||||
(time / GST_SECOND) % 60,
|
||||
time % GST_SECOND)
|
||||
|
||||
##############################
|
||||
# Encoding related utils #
|
||||
##############################
|
||||
|
@ -238,6 +244,7 @@ def parse_gsttimeargs(time):
|
|||
def get_duration(media_file):
|
||||
|
||||
duration = 0
|
||||
res = ''
|
||||
try:
|
||||
res = subprocess.check_output([DISCOVERER_COMMAND, media_file])
|
||||
except subprocess.CalledProcessError:
|
||||
|
@ -251,16 +258,14 @@ def get_duration(media_file):
|
|||
|
||||
return duration
|
||||
|
||||
|
||||
def compare_rendered_with_original(orig_duration, dest_file, tolerance=DURATION_TOLERANCE):
|
||||
duration = get_duration(dest_file)
|
||||
|
||||
if orig_duration - tolerance >= duration >= orig_duration + tolerance:
|
||||
if orig_duration - tolerance >= duration <= orig_duration + tolerance:
|
||||
return (Result.FAILED, "Duration of encoded file is "
|
||||
" wrong (%s instead of %s)" %
|
||||
(orig_duration / GST_SECOND,
|
||||
duration / GST_SECOND),
|
||||
"wrong-duration")
|
||||
(TIME_ARGS (duration),
|
||||
TIME_ARGS (orig_duration)))
|
||||
else:
|
||||
return (Result.PASSED, "")
|
||||
|
||||
|
|
Loading…
Reference in a new issue