mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 20:05:38 +00:00
validate:tools: Handle cases were EOS does not stop the pipeline in the launcher
+ Fix parsing of GstClockTime + Avoid using play_15s scenario when not necessary
This commit is contained in:
parent
90d9a686d7
commit
c3adb05b2a
3 changed files with 48 additions and 7 deletions
|
@ -17,6 +17,7 @@
|
|||
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
import os
|
||||
import time
|
||||
import urlparse
|
||||
import subprocess
|
||||
import ConfigParser
|
||||
|
@ -168,7 +169,15 @@ class GstValidateTranscodingTest(GstValidateTest):
|
|||
combination, uri, file_infos, timeout=DEFAULT_TIMEOUT,
|
||||
scenario_name="play_15s"):
|
||||
|
||||
scenario = self._scenarios.get_scenario(scenario_name)
|
||||
Loggable.__init__(self)
|
||||
|
||||
file_dur = long(file_infos.get("media-info", "file-duration")) / GST_SECOND
|
||||
if file_dur < 30:
|
||||
self.debug("%s is short (%ds< 30 secs) playing it all" % (uri, file_dur))
|
||||
scenario = None
|
||||
else:
|
||||
self.debug("%s is long (%ds > 30 secs) playing it all" % (uri, file_dur))
|
||||
scenario = self._scenarios.get_scenario(scenario_name)
|
||||
try:
|
||||
timeout = G_V_PROTOCOL_TIMEOUTS[file_infos.get("file-info", "protocol")]
|
||||
except KeyError:
|
||||
|
@ -206,14 +215,26 @@ class GstValidateTranscodingTest(GstValidateTest):
|
|||
self.add_arguments(self.uri, self.dest_file)
|
||||
|
||||
def get_current_value(self):
|
||||
sent_eos = self.sent_eos_position()
|
||||
if sent_eos is not None:
|
||||
if ((time.time() - sent_eos)) > 30:
|
||||
if self.file_infos.get("file-info", "protocol") == Protocols.HLS:
|
||||
self.set_result(Result.PASSED,
|
||||
"""Got no EOS 30 seconds after sending EOS,
|
||||
in HLS known and tolerated issue:
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=723868""")
|
||||
return Result.KNOWN_ERROR
|
||||
|
||||
return Result.FAILED
|
||||
|
||||
return self.get_current_size()
|
||||
|
||||
def check_results(self):
|
||||
if self.process.returncode == 0:
|
||||
if self.result is Result.PASSED:
|
||||
orig_duration = long(self.file_infos.get("media-info", "file-duration"))
|
||||
res, msg = compare_rendered_with_original(orig_duration, self.dest_file)
|
||||
self.set_result(res, msg)
|
||||
else:
|
||||
elif self.message == "":
|
||||
GstValidateTest.check_results(self)
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import ConfigParser
|
|||
from loggable import Loggable
|
||||
from optparse import OptionGroup
|
||||
|
||||
from utils import mkdir, Result, Colors, printc, DEFAULT_TIMEOUT
|
||||
from utils import mkdir, Result, Colors, printc, DEFAULT_TIMEOUT, GST_SECOND
|
||||
|
||||
|
||||
class Test(Loggable):
|
||||
|
@ -141,6 +141,8 @@ class Test(Loggable):
|
|||
elif val is Result.FAILED:
|
||||
self.result = Result.FAILED
|
||||
break
|
||||
elif val is Result.KNOWN_ERROR:
|
||||
break
|
||||
|
||||
self.log("New val %s" % val)
|
||||
|
||||
|
@ -214,6 +216,7 @@ class GstValidateTest(Test):
|
|||
# defines how much the process can be outside of the configured
|
||||
# segment / seek
|
||||
self.max_outside_segment = max_outside_segment
|
||||
self._sent_eos_pos = None
|
||||
|
||||
if scenario is None or scenario.name.lower() == "none":
|
||||
self.scenario = None
|
||||
|
@ -332,6 +335,22 @@ class GstValidateTest(Test):
|
|||
utils.gsttime_from_tuple(v[4:8]),
|
||||
float(str(v[8]) + "." + str(v[9])))
|
||||
|
||||
def sent_eos_position(self):
|
||||
if self._sent_eos_pos is not None:
|
||||
return self._sent_eos_pos
|
||||
|
||||
m = None
|
||||
rate = start = stop = None
|
||||
|
||||
for l in reversed(open(self.logfile, 'r').readlines()):
|
||||
l = l.lower()
|
||||
if "sending eos" in l:
|
||||
m = l
|
||||
self._sent_eos_pos = time.time()
|
||||
return self._sent_eos_pos
|
||||
|
||||
return None
|
||||
|
||||
def get_current_position(self):
|
||||
position, duration = self._get_position()
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import subprocess
|
|||
from operator import itemgetter
|
||||
|
||||
|
||||
GST_SECOND = 1000000000
|
||||
GST_SECOND = long(1000000000)
|
||||
DEFAULT_TIMEOUT = 10
|
||||
DEFAULT_MAIN_DIR = os.path.expanduser("~/gst-validate/")
|
||||
DEFAULT_GST_QA_ASSETS = os.path.join(DEFAULT_MAIN_DIR, "gst-qa-assets")
|
||||
|
@ -41,6 +41,7 @@ class Result(object):
|
|||
FAILED = "Failed"
|
||||
TIMEOUT = "Timeout"
|
||||
PASSED = "Passed"
|
||||
KNOWN_ERROR = "Known error"
|
||||
|
||||
|
||||
class Protocols(object):
|
||||
|
@ -203,12 +204,12 @@ def get_profile(combination):
|
|||
# Some utilities to parse gst-validate output #
|
||||
##################################################
|
||||
def gsttime_from_tuple(stime):
|
||||
return long((int(stime[0]) * 3600 + int(stime[1]) * 60 + int(stime[2]) * 60) * GST_SECOND + int(stime[3]))
|
||||
return long((int(stime[0]) * 3600 + int(stime[1]) * 60 + int(stime[2])) * GST_SECOND + int(stime[3]))
|
||||
|
||||
timeregex = re.compile(r'(?P<_0>.+):(?P<_1>.+):(?P<_2>.+)\.(?P<_3>.+)')
|
||||
def parse_gsttimeargs(time):
|
||||
stime = map(itemgetter(1), sorted(timeregex.match(time).groupdict().items()))
|
||||
return long((int(stime[0]) * 3600 + int(stime[1]) * 60 + int(stime[2]) * 60) * GST_SECOND + int(stime[3]))
|
||||
return long((int(stime[0]) * 3600 + int(stime[1]) * 60 + int(stime[2])) * GST_SECOND + int(stime[3]))
|
||||
|
||||
def get_duration(media_file):
|
||||
|
||||
|
|
Loading…
Reference in a new issue