mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +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)
|
self.add_arguments("-f", profile, "-o", self.dest_file)
|
||||||
|
|
||||||
def check_results(self):
|
def check_results(self):
|
||||||
if self.result is Result.PASSED and self.scenario is None:
|
if self.result in [Result.PASSED, Result.NOT_RUN] and self.scenario is None:
|
||||||
res, msg = utils.compare_rendered_with_original(self.duration, self.dest_file)
|
res, msg = utils.compare_rendered_with_original(self.duration * utils.GST_SECOND,
|
||||||
|
self.dest_file)
|
||||||
self.set_result(res, msg)
|
self.set_result(res, msg)
|
||||||
else:
|
else:
|
||||||
if self.result == utils.Result.TIMEOUT:
|
if self.result == utils.Result.TIMEOUT:
|
||||||
missing_eos = False
|
missing_eos = False
|
||||||
try:
|
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
|
missing_eos = True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -34,7 +34,7 @@ DEFAULT_TIMEOUT = 30
|
||||||
DEFAULT_MAIN_DIR = os.path.expanduser("~/gst-validate/")
|
DEFAULT_MAIN_DIR = os.path.expanduser("~/gst-validate/")
|
||||||
DEFAULT_GST_QA_ASSETS = os.path.join(DEFAULT_MAIN_DIR, "gst-qa-assets")
|
DEFAULT_GST_QA_ASSETS = os.path.join(DEFAULT_MAIN_DIR, "gst-qa-assets")
|
||||||
DISCOVERER_COMMAND = "gst-discoverer-1.0"
|
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'
|
# Use to set the duration from which a test is concidered as being 'long'
|
||||||
LONG_TEST = 40
|
LONG_TEST = 40
|
||||||
|
|
||||||
|
@ -165,6 +165,12 @@ def get_subclasses(klass, env):
|
||||||
|
|
||||||
return subclasses
|
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 #
|
# Encoding related utils #
|
||||||
##############################
|
##############################
|
||||||
|
@ -238,6 +244,7 @@ def parse_gsttimeargs(time):
|
||||||
def get_duration(media_file):
|
def get_duration(media_file):
|
||||||
|
|
||||||
duration = 0
|
duration = 0
|
||||||
|
res = ''
|
||||||
try:
|
try:
|
||||||
res = subprocess.check_output([DISCOVERER_COMMAND, media_file])
|
res = subprocess.check_output([DISCOVERER_COMMAND, media_file])
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
|
@ -251,16 +258,14 @@ def get_duration(media_file):
|
||||||
|
|
||||||
return duration
|
return duration
|
||||||
|
|
||||||
|
|
||||||
def compare_rendered_with_original(orig_duration, dest_file, tolerance=DURATION_TOLERANCE):
|
def compare_rendered_with_original(orig_duration, dest_file, tolerance=DURATION_TOLERANCE):
|
||||||
duration = get_duration(dest_file)
|
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 "
|
return (Result.FAILED, "Duration of encoded file is "
|
||||||
" wrong (%s instead of %s)" %
|
" wrong (%s instead of %s)" %
|
||||||
(orig_duration / GST_SECOND,
|
(TIME_ARGS (duration),
|
||||||
duration / GST_SECOND),
|
TIME_ARGS (orig_duration)))
|
||||||
"wrong-duration")
|
|
||||||
else:
|
else:
|
||||||
return (Result.PASSED, "")
|
return (Result.PASSED, "")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue