2014-05-16 14:20:26 +00:00
|
|
|
#!/usr/bin/env python2
|
2014-01-08 08:49:38 +00:00
|
|
|
#
|
|
|
|
# Copyright (c) 2013,Thibault Saunier <thibault.saunier@collabora.com>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this program; if not, write to the
|
|
|
|
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
# Boston, MA 02110-1301, USA.
|
|
|
|
import os
|
2014-09-06 09:38:38 +00:00
|
|
|
import sys
|
2014-02-13 14:31:58 +00:00
|
|
|
import time
|
2014-01-08 08:49:38 +00:00
|
|
|
import urlparse
|
2014-01-09 08:14:27 +00:00
|
|
|
import subprocess
|
2014-01-08 08:49:38 +00:00
|
|
|
import ConfigParser
|
2014-12-07 11:30:25 +00:00
|
|
|
from launcher.loggable import Loggable
|
2014-01-08 08:49:38 +00:00
|
|
|
|
2014-12-07 11:30:25 +00:00
|
|
|
from launcher.baseclasses import GstValidateTest, Test, \
|
2014-07-16 08:10:44 +00:00
|
|
|
ScenarioManager, NamedDic, GstValidateTestsGenerator, \
|
2014-09-06 09:38:38 +00:00
|
|
|
GstValidateMediaDescriptor, GstValidateEncodingTestInterface, \
|
2015-03-13 17:09:08 +00:00
|
|
|
GstValidateBaseTestManager, MediaDescriptor, MediaFormatCombination
|
2014-07-16 08:10:44 +00:00
|
|
|
|
2015-08-07 12:38:20 +00:00
|
|
|
from launcher.utils import path2url, url2path, DEFAULT_TIMEOUT, which, \
|
2015-05-11 10:22:25 +00:00
|
|
|
GST_SECOND, Result, Protocols, mkdir, printc, Colors, get_data_file
|
2014-01-08 08:49:38 +00:00
|
|
|
|
2014-10-24 12:23:52 +00:00
|
|
|
#
|
|
|
|
# Private global variables #
|
|
|
|
#
|
2014-06-18 15:26:05 +00:00
|
|
|
|
2014-06-18 10:51:02 +00:00
|
|
|
# definitions of commands to use
|
|
|
|
GST_VALIDATE_COMMAND = "gst-validate-1.0"
|
|
|
|
GST_VALIDATE_TRANSCODING_COMMAND = "gst-validate-transcoding-1.0"
|
|
|
|
G_V_DISCOVERER_COMMAND = "gst-validate-media-check-1.0"
|
|
|
|
if "win32" in sys.platform:
|
|
|
|
GST_VALIDATE_COMMAND += ".exe"
|
|
|
|
GST_VALIDATE_TRANSCODING_COMMAND += ".exe"
|
|
|
|
G_V_DISCOVERER_COMMAND += ".exe"
|
|
|
|
|
2014-07-16 08:09:32 +00:00
|
|
|
AUDIO_ONLY_FILE_TRANSCODING_RATIO = 5
|
2014-06-18 10:51:02 +00:00
|
|
|
|
2014-10-24 12:23:52 +00:00
|
|
|
#
|
|
|
|
# API to be used to create testsuites #
|
|
|
|
#
|
2014-06-18 10:51:02 +00:00
|
|
|
|
2014-06-18 15:26:05 +00:00
|
|
|
"""
|
|
|
|
Some info about protocols and how to handle them
|
|
|
|
"""
|
2014-08-09 14:34:09 +00:00
|
|
|
GST_VALIDATE_CAPS_TO_PROTOCOL = [("application/x-hls", Protocols.HLS),
|
|
|
|
("application/dash+xml", Protocols.DASH)]
|
2014-06-18 15:26:05 +00:00
|
|
|
GST_VALIDATE_PROTOCOL_TIMEOUTS = {Protocols.HTTP: 120,
|
2014-08-09 14:34:09 +00:00
|
|
|
Protocols.HLS: 240,
|
|
|
|
Protocols.DASH: 240}
|
2014-06-18 15:26:05 +00:00
|
|
|
|
2014-01-30 15:59:21 +00:00
|
|
|
|
2014-06-26 10:42:38 +00:00
|
|
|
class GstValidateMediaCheckTestsGenerator(GstValidateTestsGenerator):
|
2014-10-24 12:23:52 +00:00
|
|
|
|
2014-06-26 10:42:38 +00:00
|
|
|
def __init__(self, test_manager):
|
|
|
|
GstValidateTestsGenerator.__init__(self, "media_check", test_manager)
|
2014-06-18 10:51:02 +00:00
|
|
|
|
2014-06-18 15:26:05 +00:00
|
|
|
def populate_tests(self, uri_minfo_special_scenarios, scenarios):
|
2014-06-18 10:51:02 +00:00
|
|
|
for uri, mediainfo, special_scenarios in uri_minfo_special_scenarios:
|
|
|
|
protocol = mediainfo.media_descriptor.get_protocol()
|
|
|
|
try:
|
2014-06-18 15:26:05 +00:00
|
|
|
timeout = GST_VALIDATE_PROTOCOL_TIMEOUTS[protocol]
|
2014-06-18 10:51:02 +00:00
|
|
|
except KeyError:
|
|
|
|
timeout = DEFAULT_TIMEOUT
|
|
|
|
|
|
|
|
classname = "validate.%s.media_check.%s" % (protocol,
|
2015-08-07 12:38:20 +00:00
|
|
|
os.path.basename(url2path(uri)).replace(".", "_"))
|
2014-06-18 15:26:05 +00:00
|
|
|
self.add_test(GstValidateMediaCheckTest(classname,
|
2014-06-26 10:42:38 +00:00
|
|
|
self.test_manager.options,
|
|
|
|
self.test_manager.reporter,
|
2014-06-18 10:51:02 +00:00
|
|
|
mediainfo.media_descriptor,
|
|
|
|
uri,
|
|
|
|
mediainfo.path,
|
|
|
|
timeout=timeout))
|
2014-01-30 15:59:21 +00:00
|
|
|
|
|
|
|
|
2014-06-26 10:42:38 +00:00
|
|
|
class GstValidateTranscodingTestsGenerator(GstValidateTestsGenerator):
|
2014-10-24 12:23:52 +00:00
|
|
|
|
2014-06-26 10:42:38 +00:00
|
|
|
def __init__(self, test_manager):
|
|
|
|
GstValidateTestsGenerator.__init__(self, "transcode", test_manager)
|
2014-01-30 15:59:21 +00:00
|
|
|
|
2014-06-18 15:26:05 +00:00
|
|
|
def populate_tests(self, uri_minfo_special_scenarios, scenarios):
|
2014-06-18 10:51:02 +00:00
|
|
|
for uri, mediainfo, special_scenarios in uri_minfo_special_scenarios:
|
|
|
|
if mediainfo.media_descriptor.is_image():
|
|
|
|
continue
|
2014-01-30 15:59:21 +00:00
|
|
|
|
2014-06-26 10:42:38 +00:00
|
|
|
for comb in self.test_manager.get_encoding_formats():
|
2014-06-18 10:51:02 +00:00
|
|
|
classname = "validate.%s.transcode.to_%s.%s" % (mediainfo.media_descriptor.get_protocol(),
|
2014-10-24 12:23:52 +00:00
|
|
|
str(comb).replace(
|
|
|
|
' ', '_'),
|
2014-09-12 08:47:18 +00:00
|
|
|
mediainfo.media_descriptor.get_clean_name())
|
2014-06-18 15:26:05 +00:00
|
|
|
self.add_test(GstValidateTranscodingTest(classname,
|
2014-06-26 10:42:38 +00:00
|
|
|
self.test_manager.options,
|
|
|
|
self.test_manager.reporter,
|
2014-06-18 15:26:05 +00:00
|
|
|
comb,
|
|
|
|
uri,
|
|
|
|
mediainfo.media_descriptor))
|
|
|
|
|
|
|
|
|
2014-12-13 15:01:49 +00:00
|
|
|
class FakeMediaDescriptor(MediaDescriptor):
|
|
|
|
def __init__(self, infos, pipeline_desc):
|
|
|
|
MediaDescriptor.__init__(self)
|
|
|
|
self._infos = infos
|
|
|
|
self._pipeline_desc = pipeline_desc
|
|
|
|
|
|
|
|
def get_path(self):
|
|
|
|
return self._infos.get('path', None)
|
|
|
|
|
|
|
|
def get_media_filepath(self):
|
|
|
|
return self._infos.get('media-filepath', None)
|
|
|
|
|
|
|
|
def get_caps(self):
|
|
|
|
return self._infos.get('caps', None)
|
|
|
|
|
|
|
|
def get_uri(self):
|
|
|
|
return self._infos.get('uri', None)
|
|
|
|
|
|
|
|
def get_duration(self):
|
|
|
|
return int(self._infos.get('duration', 0)) * GST_SECOND
|
|
|
|
|
|
|
|
def get_protocol(self):
|
|
|
|
return self._infos.get('protocol', "launch_pipeline")
|
|
|
|
|
|
|
|
def is_seekable(self):
|
|
|
|
return self._infos.get('is-seekable', True)
|
|
|
|
|
|
|
|
def is_image(self):
|
|
|
|
return self._infos.get('is-image', False)
|
|
|
|
|
|
|
|
def get_num_tracks(self, track_type):
|
|
|
|
return self._infos.get('num-%s-tracks' % track_type,
|
|
|
|
self._pipeline_desc.count(track_type + "sink"))
|
|
|
|
|
|
|
|
def can_play_reverse(self):
|
|
|
|
return self._infos.get('plays-reverse', False)
|
|
|
|
|
|
|
|
|
2014-06-26 10:42:38 +00:00
|
|
|
class GstValidatePipelineTestsGenerator(GstValidateTestsGenerator):
|
2014-10-24 12:23:52 +00:00
|
|
|
|
2014-10-25 12:59:49 +00:00
|
|
|
def __init__(self, name, test_manager, pipeline_template=None,
|
|
|
|
pipelines_descriptions=None, valid_scenarios=[]):
|
2014-06-18 15:26:05 +00:00
|
|
|
"""
|
|
|
|
@name: The name of the generator
|
|
|
|
@pipeline_template: A template pipeline to be used to generate actual pipelines
|
|
|
|
@pipelines_descriptions: A list of tuple of the form:
|
2014-12-12 13:36:16 +00:00
|
|
|
(test_name, pipeline_description, extra_data)
|
|
|
|
extra_data being a dictionnary with the follwing keys:
|
|
|
|
'scenarios': ["the", "valide", "scenarios", "names"]
|
|
|
|
'duration': the_duration # in seconds
|
|
|
|
'timeout': a_timeout # in seconds
|
|
|
|
'hard_timeout': a_hard_timeout # in seconds
|
|
|
|
|
2014-06-18 15:26:05 +00:00
|
|
|
@valid_scenarios: A list of scenario name that can be used with that generator
|
|
|
|
"""
|
2014-06-26 10:42:38 +00:00
|
|
|
GstValidateTestsGenerator.__init__(self, name, test_manager)
|
2014-06-18 15:26:05 +00:00
|
|
|
self._pipeline_template = pipeline_template
|
|
|
|
self._pipelines_descriptions = pipelines_descriptions
|
|
|
|
self._valid_scenarios = valid_scenarios
|
|
|
|
|
|
|
|
def get_fname(self, scenario, protocol=None, name=None):
|
|
|
|
if name is None:
|
|
|
|
name = self.name
|
|
|
|
|
|
|
|
if protocol is not None:
|
|
|
|
protocol_str = "%s." % protocol
|
|
|
|
else:
|
|
|
|
protocol_str = ""
|
|
|
|
|
|
|
|
if scenario is not None and scenario.name.lower() != "none":
|
|
|
|
return "%s.%s%s.%s" % ("validate", protocol_str, name, scenario.name)
|
2014-01-30 15:59:21 +00:00
|
|
|
|
2014-12-12 13:36:16 +00:00
|
|
|
return ("%s.%s.%s.%s" % ("validate", protocol_str, self.name, name)).replace("..", ".")
|
2014-01-30 15:59:21 +00:00
|
|
|
|
2014-06-18 15:26:05 +00:00
|
|
|
def generate_tests(self, uri_minfo_special_scenarios, scenarios):
|
2014-12-12 13:36:16 +00:00
|
|
|
if self._valid_scenarios is None:
|
|
|
|
scenarios = [None]
|
|
|
|
elif self._valid_scenarios:
|
2014-06-18 15:26:05 +00:00
|
|
|
scenarios = [scenario for scenario in scenarios if
|
2015-02-04 14:27:37 +00:00
|
|
|
scenario is not None and scenario.name in self._valid_scenarios]
|
2014-06-18 15:26:05 +00:00
|
|
|
|
2014-06-26 10:42:38 +00:00
|
|
|
return super(GstValidatePipelineTestsGenerator, self).generate_tests(
|
2014-10-24 12:23:52 +00:00
|
|
|
uri_minfo_special_scenarios, scenarios)
|
2014-01-30 15:59:21 +00:00
|
|
|
|
2014-06-18 15:26:05 +00:00
|
|
|
def populate_tests(self, uri_minfo_special_scenarios, scenarios):
|
2014-12-12 13:36:16 +00:00
|
|
|
for description in self._pipelines_descriptions:
|
|
|
|
name = description[0]
|
|
|
|
pipeline = description[1]
|
|
|
|
if len(description) == 3:
|
|
|
|
extra_datas = description[2]
|
|
|
|
else:
|
|
|
|
extra_datas = {}
|
|
|
|
|
2014-12-13 15:01:49 +00:00
|
|
|
for scenario in extra_datas.get('scenarios', scenarios):
|
|
|
|
if isinstance(scenario, str):
|
|
|
|
scenario = self.test_manager.scenarios_manager.get_scenario(scenario)
|
|
|
|
|
|
|
|
mediainfo = FakeMediaDescriptor(extra_datas, pipeline)
|
|
|
|
if not mediainfo.is_compatible(scenario):
|
|
|
|
continue
|
|
|
|
|
2014-12-12 13:36:16 +00:00
|
|
|
if self.test_manager.options.mute:
|
|
|
|
if scenario and scenario.needs_clock_sync():
|
2014-12-13 15:01:49 +00:00
|
|
|
fakesink = "fakesink sync=true"
|
2014-12-12 13:36:16 +00:00
|
|
|
else:
|
|
|
|
fakesink = "fakesink"
|
|
|
|
|
|
|
|
audiosink = videosink = fakesink
|
|
|
|
else:
|
|
|
|
audiosink = 'autoaudiosink'
|
|
|
|
videosink = 'autovideosink'
|
|
|
|
|
2014-12-13 15:01:49 +00:00
|
|
|
pipeline_desc = pipeline % {'videosink': videosink,
|
2015-03-13 17:09:08 +00:00
|
|
|
'audiosink': audiosink}
|
2014-12-12 13:36:16 +00:00
|
|
|
|
2014-12-13 15:01:49 +00:00
|
|
|
fname = self.get_fname(scenario, protocol=mediainfo.get_protocol(), name=name)
|
2014-12-12 13:36:16 +00:00
|
|
|
|
2014-06-18 15:26:05 +00:00
|
|
|
self.add_test(GstValidateLaunchTest(fname,
|
2014-06-26 10:42:38 +00:00
|
|
|
self.test_manager.options,
|
|
|
|
self.test_manager.reporter,
|
2014-12-13 15:01:49 +00:00
|
|
|
pipeline_desc,
|
2014-12-12 13:36:16 +00:00
|
|
|
scenario=scenario,
|
2014-12-13 15:01:49 +00:00
|
|
|
media_descriptor=mediainfo)
|
2014-06-18 15:26:05 +00:00
|
|
|
)
|
2014-01-14 09:32:53 +00:00
|
|
|
|
2014-01-08 08:49:38 +00:00
|
|
|
|
2014-06-26 10:42:38 +00:00
|
|
|
class GstValidatePlaybinTestsGenerator(GstValidatePipelineTestsGenerator):
|
2014-01-08 08:49:38 +00:00
|
|
|
|
2014-06-26 10:42:38 +00:00
|
|
|
def __init__(self, test_manager):
|
2014-10-24 12:23:52 +00:00
|
|
|
GstValidatePipelineTestsGenerator.__init__(
|
|
|
|
self, "playback", test_manager, "playbin")
|
2014-01-30 14:40:21 +00:00
|
|
|
|
2014-06-18 15:26:05 +00:00
|
|
|
def populate_tests(self, uri_minfo_special_scenarios, scenarios):
|
2014-06-18 10:51:02 +00:00
|
|
|
for uri, minfo, special_scenarios in uri_minfo_special_scenarios:
|
2014-06-18 15:26:05 +00:00
|
|
|
pipe = self._pipeline_template
|
2014-06-18 10:51:02 +00:00
|
|
|
protocol = minfo.media_descriptor.get_protocol()
|
2014-01-08 08:49:38 +00:00
|
|
|
|
2014-06-18 10:51:02 +00:00
|
|
|
pipe += " uri=%s" % uri
|
2015-02-04 14:27:37 +00:00
|
|
|
|
2014-06-18 10:51:02 +00:00
|
|
|
for scenario in special_scenarios + scenarios:
|
2014-07-23 12:43:29 +00:00
|
|
|
cpipe = pipe
|
2014-06-18 10:51:02 +00:00
|
|
|
if not minfo.media_descriptor.is_compatible(scenario):
|
|
|
|
continue
|
2014-01-13 10:13:02 +00:00
|
|
|
|
2014-07-23 12:43:29 +00:00
|
|
|
if self.test_manager.options.mute:
|
2014-11-20 10:55:45 +00:00
|
|
|
if scenario.needs_clock_sync() or \
|
|
|
|
minfo.media_descriptor.need_clock_sync():
|
2014-07-23 12:43:29 +00:00
|
|
|
fakesink = "'fakesink sync=true'"
|
|
|
|
else:
|
|
|
|
fakesink = "'fakesink'"
|
|
|
|
|
2014-10-24 12:23:52 +00:00
|
|
|
cpipe += " audio-sink=%s video-sink=%s" % (
|
|
|
|
fakesink, fakesink)
|
2014-07-23 12:43:29 +00:00
|
|
|
|
2014-06-18 10:51:02 +00:00
|
|
|
fname = "%s.%s" % (self.get_fname(scenario,
|
|
|
|
protocol),
|
2014-09-12 08:47:18 +00:00
|
|
|
os.path.basename(minfo.media_descriptor.get_clean_name()))
|
2014-06-18 10:51:02 +00:00
|
|
|
self.debug("Adding: %s", fname)
|
2014-02-13 14:33:25 +00:00
|
|
|
|
2014-06-18 10:51:02 +00:00
|
|
|
if scenario.does_reverse_playback() and protocol == Protocols.HTTP:
|
|
|
|
# 10MB so we can reverse playback
|
2014-07-23 12:43:29 +00:00
|
|
|
cpipe += " ring-buffer-max-size=10485760"
|
2014-05-01 09:32:42 +00:00
|
|
|
|
2014-06-18 15:26:05 +00:00
|
|
|
self.add_test(GstValidateLaunchTest(fname,
|
2014-06-26 10:42:38 +00:00
|
|
|
self.test_manager.options,
|
|
|
|
self.test_manager.reporter,
|
2014-07-23 12:43:29 +00:00
|
|
|
cpipe,
|
2014-06-18 15:26:05 +00:00
|
|
|
scenario=scenario,
|
|
|
|
media_descriptor=minfo.media_descriptor)
|
|
|
|
)
|
2014-05-01 09:32:42 +00:00
|
|
|
|
2014-01-30 11:20:33 +00:00
|
|
|
|
2014-06-26 11:01:13 +00:00
|
|
|
class GstValidateMixerTestsGenerator(GstValidatePipelineTestsGenerator):
|
2014-10-24 12:23:52 +00:00
|
|
|
|
2014-10-25 12:59:49 +00:00
|
|
|
def __init__(self, name, test_manager, mixer, media_type, converter="",
|
|
|
|
num_sources=3, mixed_srcs={}, valid_scenarios=[]):
|
2014-10-24 12:23:52 +00:00
|
|
|
pipe_template = "%(mixer)s name=_mixer ! " + \
|
|
|
|
converter + " ! %(sink)s "
|
2014-06-26 11:01:13 +00:00
|
|
|
self.converter = converter
|
|
|
|
self.mixer = mixer
|
|
|
|
self.media_type = media_type
|
|
|
|
self.num_sources = num_sources
|
|
|
|
self.mixed_srcs = mixed_srcs
|
2014-10-24 12:23:52 +00:00
|
|
|
super(
|
|
|
|
GstValidateMixerTestsGenerator, self).__init__(name, test_manager, pipe_template,
|
|
|
|
valid_scenarios=valid_scenarios)
|
2014-06-26 11:01:13 +00:00
|
|
|
|
|
|
|
def populate_tests(self, uri_minfo_special_scenarios, scenarios):
|
2015-03-13 17:09:08 +00:00
|
|
|
if self.test_manager.options.validate_uris:
|
|
|
|
return
|
|
|
|
|
2014-06-26 11:01:13 +00:00
|
|
|
wanted_ressources = []
|
|
|
|
for uri, minfo, special_scenarios in uri_minfo_special_scenarios:
|
|
|
|
protocol = minfo.media_descriptor.get_protocol()
|
|
|
|
if protocol == Protocols.FILE and \
|
|
|
|
minfo.media_descriptor.get_num_tracks(self.media_type) > 0:
|
|
|
|
wanted_ressources.append((uri, minfo))
|
|
|
|
|
|
|
|
if not self.mixed_srcs:
|
|
|
|
if not wanted_ressources:
|
|
|
|
return
|
|
|
|
|
|
|
|
for i in range(len(uri_minfo_special_scenarios) / self.num_sources):
|
|
|
|
srcs = []
|
|
|
|
name = ""
|
|
|
|
for nsource in range(self.num_sources):
|
|
|
|
uri, minfo = wanted_ressources[i + nsource]
|
2014-10-24 12:23:52 +00:00
|
|
|
srcs.append(
|
|
|
|
"uridecodebin uri=%s ! %s" % (uri, self.converter))
|
2014-06-26 11:01:13 +00:00
|
|
|
fname = os.path.basename(uri).replace(".", "_")
|
|
|
|
if not name:
|
|
|
|
name = fname
|
|
|
|
else:
|
|
|
|
name += "+%s" % fname
|
|
|
|
|
|
|
|
self.mixed_srcs[name] = tuple(srcs)
|
|
|
|
|
|
|
|
for name, srcs in self.mixed_srcs.iteritems():
|
|
|
|
if isinstance(srcs, dict):
|
2014-10-24 12:23:52 +00:00
|
|
|
pipe_arguments = {
|
|
|
|
"mixer": self.mixer + " %s" % srcs["mixer_props"]}
|
2014-06-26 11:01:13 +00:00
|
|
|
srcs = srcs["sources"]
|
|
|
|
else:
|
|
|
|
pipe_arguments = {"mixer": self.mixer}
|
|
|
|
|
|
|
|
for scenario in scenarios:
|
|
|
|
fname = self.get_fname(scenario, Protocols.FILE) + "."
|
|
|
|
fname += name
|
|
|
|
|
|
|
|
self.debug("Adding: %s", fname)
|
|
|
|
|
2014-12-13 22:23:11 +00:00
|
|
|
if self.test_manager.options.mute:
|
|
|
|
if scenario.needs_clock_sync():
|
|
|
|
pipe_arguments["sink"] = "fakesink sync=true"
|
|
|
|
else:
|
|
|
|
pipe_arguments["sink"] = "'fakesink'"
|
|
|
|
else:
|
|
|
|
pipe_arguments["sink"] = "auto%ssink" % self.media_type
|
|
|
|
|
|
|
|
pipe = self._pipeline_template % pipe_arguments
|
|
|
|
|
|
|
|
for src in srcs:
|
|
|
|
pipe += "%s ! _mixer. " % src
|
|
|
|
|
2014-06-26 11:01:13 +00:00
|
|
|
self.add_test(GstValidateLaunchTest(fname,
|
|
|
|
self.test_manager.options,
|
|
|
|
self.test_manager.reporter,
|
|
|
|
pipe,
|
|
|
|
scenario=scenario)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2014-01-09 08:14:27 +00:00
|
|
|
class GstValidateLaunchTest(GstValidateTest):
|
2014-10-24 12:23:52 +00:00
|
|
|
|
2014-01-09 08:14:27 +00:00
|
|
|
def __init__(self, classname, options, reporter, pipeline_desc,
|
2014-12-12 13:36:16 +00:00
|
|
|
timeout=DEFAULT_TIMEOUT, scenario=None,
|
2015-05-13 13:29:43 +00:00
|
|
|
media_descriptor=None, duration=0, hard_timeout=None,
|
2015-08-15 14:40:11 +00:00
|
|
|
extra_env_variables=None):
|
|
|
|
|
|
|
|
extra_env_variables = extra_env_variables or {}
|
|
|
|
|
2014-01-24 10:31:42 +00:00
|
|
|
try:
|
2014-10-24 12:23:52 +00:00
|
|
|
timeout = GST_VALIDATE_PROTOCOL_TIMEOUTS[
|
|
|
|
media_descriptor.get_protocol()]
|
2014-01-24 10:31:42 +00:00
|
|
|
except KeyError:
|
|
|
|
pass
|
2014-06-18 10:51:02 +00:00
|
|
|
except AttributeError:
|
|
|
|
pass
|
2014-01-24 10:31:42 +00:00
|
|
|
|
2014-05-07 09:30:09 +00:00
|
|
|
if scenario:
|
|
|
|
duration = scenario.get_duration()
|
|
|
|
elif media_descriptor:
|
|
|
|
duration = media_descriptor.get_duration() / GST_SECOND
|
2014-12-08 14:27:54 +00:00
|
|
|
|
2014-10-24 12:23:52 +00:00
|
|
|
super(
|
|
|
|
GstValidateLaunchTest, self).__init__(GST_VALIDATE_COMMAND, classname,
|
|
|
|
options, reporter,
|
|
|
|
duration=duration,
|
|
|
|
scenario=scenario,
|
2014-12-12 13:36:16 +00:00
|
|
|
timeout=timeout,
|
2015-05-13 13:29:43 +00:00
|
|
|
hard_timeout=hard_timeout,
|
2015-08-15 14:23:02 +00:00
|
|
|
media_descriptor=media_descriptor,
|
2015-05-13 13:29:43 +00:00
|
|
|
extra_env_variables=extra_env_variables)
|
2014-01-24 12:59:56 +00:00
|
|
|
|
2014-01-08 08:49:38 +00:00
|
|
|
self.pipeline_desc = pipeline_desc
|
2014-04-25 09:31:01 +00:00
|
|
|
self.media_descriptor = media_descriptor
|
2014-01-08 08:49:38 +00:00
|
|
|
|
|
|
|
def build_arguments(self):
|
2014-01-09 08:14:27 +00:00
|
|
|
GstValidateTest.build_arguments(self)
|
2014-01-08 08:49:38 +00:00
|
|
|
self.add_arguments(self.pipeline_desc)
|
2014-12-13 15:01:49 +00:00
|
|
|
if self.media_descriptor is not None and self.media_descriptor.get_path():
|
2014-10-24 12:23:52 +00:00
|
|
|
self.add_arguments(
|
2015-07-20 10:37:41 +00:00
|
|
|
"--set-media-info", '"' + self.media_descriptor.get_path() + '"')
|
2014-01-08 08:49:38 +00:00
|
|
|
|
2014-01-09 08:14:27 +00:00
|
|
|
|
2015-03-27 11:16:03 +00:00
|
|
|
class GstValidateMediaCheckTest(GstValidateTest):
|
2014-10-24 12:23:52 +00:00
|
|
|
|
2014-10-25 12:59:49 +00:00
|
|
|
def __init__(self, classname, options, reporter, media_descriptor,
|
2015-08-15 14:40:11 +00:00
|
|
|
uri, minfo_path, timeout=DEFAULT_TIMEOUT,
|
|
|
|
extra_env_variables=None):
|
|
|
|
extra_env_variables = extra_env_variables or {}
|
|
|
|
|
2014-10-24 12:23:52 +00:00
|
|
|
super(
|
|
|
|
GstValidateMediaCheckTest, self).__init__(G_V_DISCOVERER_COMMAND, classname,
|
|
|
|
options, reporter,
|
2015-05-13 13:29:43 +00:00
|
|
|
timeout=timeout,
|
2015-08-15 14:23:02 +00:00
|
|
|
media_descriptor=media_descriptor,
|
2015-05-13 13:29:43 +00:00
|
|
|
extra_env_variables=extra_env_variables)
|
2014-01-13 10:13:02 +00:00
|
|
|
self._uri = uri
|
2014-04-02 10:12:11 +00:00
|
|
|
self._media_info_path = minfo_path
|
2014-01-13 10:13:02 +00:00
|
|
|
|
|
|
|
def build_arguments(self):
|
2015-02-27 23:20:43 +00:00
|
|
|
Test.build_arguments(self)
|
2014-01-13 10:13:02 +00:00
|
|
|
self.add_arguments(self._uri, "--expected-results",
|
2015-07-20 10:37:41 +00:00
|
|
|
'"' + self._media_info_path + '"')
|
2014-01-13 10:13:02 +00:00
|
|
|
|
|
|
|
|
2014-07-16 10:03:14 +00:00
|
|
|
class GstValidateTranscodingTest(GstValidateTest, GstValidateEncodingTestInterface):
|
2014-06-26 10:42:38 +00:00
|
|
|
scenarios_manager = ScenarioManager()
|
2014-10-24 12:23:52 +00:00
|
|
|
|
2014-01-09 08:14:27 +00:00
|
|
|
def __init__(self, classname, options, reporter,
|
2014-05-07 09:30:09 +00:00
|
|
|
combination, uri, media_descriptor,
|
|
|
|
timeout=DEFAULT_TIMEOUT,
|
2015-08-15 14:40:11 +00:00
|
|
|
scenario=None,
|
|
|
|
extra_env_variables=None):
|
2014-02-13 14:31:58 +00:00
|
|
|
Loggable.__init__(self)
|
|
|
|
|
2015-08-15 14:40:11 +00:00
|
|
|
extra_env_variables = extra_env_variables or {}
|
|
|
|
|
2014-04-25 09:31:01 +00:00
|
|
|
file_dur = long(media_descriptor.get_duration()) / GST_SECOND
|
2014-07-16 08:09:32 +00:00
|
|
|
if not media_descriptor.get_num_tracks("video"):
|
|
|
|
self.debug("%s audio only file applying transcoding ratio."
|
2014-10-24 12:23:52 +00:00
|
|
|
"File 'duration' : %s" % (classname, file_dur))
|
2014-07-16 08:09:32 +00:00
|
|
|
duration = file_dur / AUDIO_ONLY_FILE_TRANSCODING_RATIO
|
|
|
|
else:
|
|
|
|
duration = file_dur
|
|
|
|
|
2014-01-24 12:59:56 +00:00
|
|
|
try:
|
2014-10-24 12:23:52 +00:00
|
|
|
timeout = GST_VALIDATE_PROTOCOL_TIMEOUTS[
|
|
|
|
media_descriptor.get_protocol()]
|
2014-01-24 12:59:56 +00:00
|
|
|
except KeyError:
|
|
|
|
pass
|
|
|
|
|
2014-10-24 12:23:52 +00:00
|
|
|
super(
|
|
|
|
GstValidateTranscodingTest, self).__init__(GST_VALIDATE_TRANSCODING_COMMAND,
|
|
|
|
classname,
|
|
|
|
options,
|
|
|
|
reporter,
|
|
|
|
duration=duration,
|
|
|
|
timeout=timeout,
|
2015-05-13 13:29:43 +00:00
|
|
|
scenario=scenario,
|
2015-08-15 14:23:02 +00:00
|
|
|
media_descriptor=media_descriptor,
|
2015-08-15 14:40:11 +00:00
|
|
|
extra_env_variables=None)
|
|
|
|
extra_env_variables = extra_env_variables or {}
|
2014-07-16 10:03:14 +00:00
|
|
|
|
2014-10-24 12:23:52 +00:00
|
|
|
GstValidateEncodingTestInterface.__init__(
|
|
|
|
self, combination, media_descriptor)
|
2014-01-24 12:59:56 +00:00
|
|
|
|
2014-01-09 08:14:27 +00:00
|
|
|
self.uri = uri
|
|
|
|
|
|
|
|
def set_rendering_info(self):
|
2014-10-25 12:59:49 +00:00
|
|
|
self.dest_file = os.path.join(self.options.dest,
|
|
|
|
self.classname.replace(".transcode.", os.sep).
|
|
|
|
replace(".", os.sep))
|
|
|
|
mkdir(os.path.dirname(urlparse.urlsplit(self.dest_file).path))
|
2014-01-09 08:14:27 +00:00
|
|
|
if urlparse.urlparse(self.dest_file).scheme == "":
|
|
|
|
self.dest_file = path2url(self.dest_file)
|
|
|
|
|
2014-07-16 10:03:14 +00:00
|
|
|
profile = self.get_profile()
|
2014-01-09 08:14:27 +00:00
|
|
|
self.add_arguments("-o", profile)
|
|
|
|
|
|
|
|
def build_arguments(self):
|
2014-01-24 10:41:25 +00:00
|
|
|
GstValidateTest.build_arguments(self)
|
2014-01-09 08:14:27 +00:00
|
|
|
self.set_rendering_info()
|
2015-10-08 01:19:39 +00:00
|
|
|
self.add_arguments(self.uri, '"' + self.dest_file + '"')
|
2014-01-09 08:14:27 +00:00
|
|
|
|
|
|
|
def get_current_value(self):
|
2014-02-14 15:07:51 +00:00
|
|
|
if self.scenario:
|
|
|
|
sent_eos = self.sent_eos_position()
|
|
|
|
if sent_eos is not None:
|
2014-02-19 12:07:03 +00:00
|
|
|
t = time.time()
|
|
|
|
if ((t - sent_eos)) > 30:
|
2014-04-25 09:31:01 +00:00
|
|
|
if self.media_descriptor.get_protocol() == Protocols.HLS:
|
2014-02-14 15:07:51 +00:00
|
|
|
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
|
|
|
|
|
2014-10-24 12:23:52 +00:00
|
|
|
self.set_result(
|
|
|
|
Result.FAILED, "Pipeline did not stop 30 Seconds after sending EOS")
|
2014-02-19 12:07:03 +00:00
|
|
|
|
2014-02-14 15:07:51 +00:00
|
|
|
return Result.FAILED
|
2014-02-13 14:31:58 +00:00
|
|
|
|
2014-07-16 10:03:14 +00:00
|
|
|
size = self.get_current_size()
|
|
|
|
if size is None:
|
|
|
|
return self.get_current_position()
|
|
|
|
|
|
|
|
return size
|
2014-01-09 08:14:27 +00:00
|
|
|
|
2014-01-09 14:23:38 +00:00
|
|
|
def check_results(self):
|
2014-08-05 08:59:21 +00:00
|
|
|
if self.result in [Result.FAILED, Result.TIMEOUT] or \
|
|
|
|
self.process.returncode != 0:
|
2014-01-09 14:23:38 +00:00
|
|
|
GstValidateTest.check_results(self)
|
2014-05-07 09:30:39 +00:00
|
|
|
return
|
|
|
|
|
2014-07-16 10:03:14 +00:00
|
|
|
res, msg = self.check_encoded_file()
|
2014-05-07 09:30:39 +00:00
|
|
|
self.set_result(res, msg)
|
2014-01-09 14:23:38 +00:00
|
|
|
|
2014-01-08 08:49:38 +00:00
|
|
|
|
2014-06-26 10:42:38 +00:00
|
|
|
class GstValidateTestManager(GstValidateBaseTestManager):
|
2014-01-08 08:49:38 +00:00
|
|
|
|
|
|
|
name = "validate"
|
|
|
|
|
2014-08-10 10:41:57 +00:00
|
|
|
# List of all classes to create testsuites
|
|
|
|
GstValidateMediaCheckTestsGenerator = GstValidateMediaCheckTestsGenerator
|
|
|
|
GstValidateTranscodingTestsGenerator = GstValidateTranscodingTestsGenerator
|
|
|
|
GstValidatePipelineTestsGenerator = GstValidatePipelineTestsGenerator
|
|
|
|
GstValidatePlaybinTestsGenerator = GstValidatePlaybinTestsGenerator
|
|
|
|
GstValidateMixerTestsGenerator = GstValidateMixerTestsGenerator
|
|
|
|
GstValidateLaunchTest = GstValidateLaunchTest
|
|
|
|
GstValidateMediaCheckTest = GstValidateMediaCheckTest
|
|
|
|
GstValidateTranscodingTest = GstValidateTranscodingTest
|
|
|
|
|
2014-01-08 08:49:38 +00:00
|
|
|
def __init__(self):
|
2014-06-26 10:42:38 +00:00
|
|
|
super(GstValidateTestManager, self).__init__()
|
2014-01-08 08:49:38 +00:00
|
|
|
self._uris = []
|
2014-04-25 09:32:04 +00:00
|
|
|
self._run_defaults = True
|
2014-06-18 15:26:05 +00:00
|
|
|
self._is_populated = False
|
2014-11-28 23:03:04 +00:00
|
|
|
self._default_generators_registered = False
|
2014-01-08 08:49:38 +00:00
|
|
|
|
2014-01-09 14:17:53 +00:00
|
|
|
def init(self):
|
2014-01-30 14:40:21 +00:00
|
|
|
if which(GST_VALIDATE_COMMAND) and which(GST_VALIDATE_TRANSCODING_COMMAND):
|
2014-01-09 14:17:53 +00:00
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
2014-04-30 13:40:10 +00:00
|
|
|
def add_options(self, parser):
|
2015-03-13 17:09:08 +00:00
|
|
|
group = parser.add_argument_group("GstValidate tools specific options"
|
|
|
|
" and behaviours",
|
|
|
|
description="""When using --wanted-tests, all the scenarios can be used, even those which have
|
2014-06-19 07:38:52 +00:00
|
|
|
not been tested and explicitely activated if you set use --wanted-tests ALL""")
|
2015-03-13 17:09:08 +00:00
|
|
|
group.add_argument("--validate-check-uri", dest="validate_uris",
|
|
|
|
action="append", help="defines the uris to run default tests on")
|
2014-04-30 13:40:10 +00:00
|
|
|
|
2015-04-27 12:04:05 +00:00
|
|
|
def print_valgrind_bugs(self):
|
|
|
|
# Look for all the 'pending' bugs in our supp file
|
|
|
|
bugs = []
|
2015-05-11 10:22:25 +00:00
|
|
|
p = get_data_file('data', 'gstvalidate.supp')
|
2015-04-27 12:04:05 +00:00
|
|
|
with open(p) as f:
|
|
|
|
for l in f.readlines():
|
|
|
|
l = l.strip()
|
|
|
|
if l.startswith('# PENDING:'):
|
|
|
|
tmp = l.split(' ')
|
|
|
|
bugs.append(tmp[2])
|
|
|
|
|
|
|
|
if bugs:
|
|
|
|
msg = "Ignored valgrind bugs:\n"
|
|
|
|
for b in bugs:
|
|
|
|
msg += " + %s\n" % b
|
|
|
|
printc(msg, Colors.FAIL, True)
|
|
|
|
|
2014-06-26 10:42:38 +00:00
|
|
|
def populate_testsuite(self):
|
2014-06-18 15:26:05 +00:00
|
|
|
|
|
|
|
if self._is_populated is True:
|
|
|
|
return
|
|
|
|
|
2014-11-28 23:03:04 +00:00
|
|
|
if not self.options.config and not self.options.testsuites:
|
2014-06-26 11:01:13 +00:00
|
|
|
if self._run_defaults:
|
|
|
|
self.register_defaults()
|
|
|
|
else:
|
|
|
|
self.register_all()
|
2014-06-18 15:26:05 +00:00
|
|
|
|
|
|
|
self._is_populated = True
|
|
|
|
|
2014-01-08 08:49:38 +00:00
|
|
|
def list_tests(self):
|
2014-04-02 17:14:30 +00:00
|
|
|
if self.tests:
|
|
|
|
return self.tests
|
|
|
|
|
2014-06-18 10:51:02 +00:00
|
|
|
if self._run_defaults:
|
2014-06-26 10:42:38 +00:00
|
|
|
scenarios = [self.scenarios_manager.get_scenario(scenario_name)
|
|
|
|
for scenario_name in self.get_scenarios()]
|
2014-06-18 10:51:02 +00:00
|
|
|
else:
|
2014-06-26 10:42:38 +00:00
|
|
|
scenarios = self.scenarios_manager.get_scenario(None)
|
2014-06-18 10:51:02 +00:00
|
|
|
uris = self._list_uris()
|
2014-01-29 16:39:14 +00:00
|
|
|
|
2016-02-22 02:49:48 +00:00
|
|
|
for generator in self.get_generators():
|
|
|
|
for test in generator.generate_tests(uris, scenarios):
|
|
|
|
self.add_test(test)
|
|
|
|
|
|
|
|
if not self.tests and not uris:
|
2015-10-05 04:38:10 +00:00
|
|
|
printc("No valid uris present in the path. Check if media files and info files exist", Colors.FAIL)
|
2014-01-13 10:13:02 +00:00
|
|
|
|
2014-03-26 10:00:32 +00:00
|
|
|
return self.tests
|
2014-01-08 08:49:38 +00:00
|
|
|
|
2014-07-16 10:50:41 +00:00
|
|
|
def _add_media(self, media_info, uri=None):
|
2014-01-08 17:51:14 +00:00
|
|
|
self.debug("Checking %s", media_info)
|
2014-07-16 10:50:41 +00:00
|
|
|
if isinstance(media_info, GstValidateMediaDescriptor):
|
|
|
|
media_descriptor = media_info
|
|
|
|
media_info = media_descriptor.get_path()
|
|
|
|
else:
|
|
|
|
media_descriptor = GstValidateMediaDescriptor(media_info)
|
|
|
|
|
2014-01-08 08:49:38 +00:00
|
|
|
try:
|
|
|
|
# Just testing that the vairous mandatory infos are present
|
2014-04-25 09:31:01 +00:00
|
|
|
caps = media_descriptor.get_caps()
|
2014-01-08 08:49:38 +00:00
|
|
|
if uri is None:
|
2014-04-25 09:31:01 +00:00
|
|
|
uri = media_descriptor.get_uri()
|
|
|
|
|
|
|
|
media_descriptor.set_protocol(urlparse.urlparse(uri).scheme)
|
2014-06-18 15:26:05 +00:00
|
|
|
for caps2, prot in GST_VALIDATE_CAPS_TO_PROTOCOL:
|
2014-01-08 08:49:38 +00:00
|
|
|
if caps2 == caps:
|
2014-04-25 09:31:01 +00:00
|
|
|
media_descriptor.set_protocol(prot)
|
2014-01-08 08:49:38 +00:00
|
|
|
break
|
2014-04-30 09:06:09 +00:00
|
|
|
|
|
|
|
scenario_bname = media_descriptor.get_media_filepath()
|
2014-10-24 12:23:52 +00:00
|
|
|
special_scenarios = self.scenarios_manager.find_special_scenarios(
|
|
|
|
scenario_bname)
|
2014-01-13 10:13:02 +00:00
|
|
|
self._uris.append((uri,
|
|
|
|
NamedDic({"path": media_info,
|
2014-04-30 09:06:09 +00:00
|
|
|
"media_descriptor": media_descriptor}),
|
|
|
|
special_scenarios))
|
2014-01-08 08:49:38 +00:00
|
|
|
except ConfigParser.NoOptionError as e:
|
2014-01-08 17:51:14 +00:00
|
|
|
self.debug("Exception: %s for %s", e, media_info)
|
2014-01-08 08:49:38 +00:00
|
|
|
|
|
|
|
def _discover_file(self, uri, fpath):
|
|
|
|
try:
|
2014-10-24 12:23:52 +00:00
|
|
|
media_info = "%s.%s" % (
|
|
|
|
fpath, GstValidateMediaDescriptor.MEDIA_INFO_EXT)
|
2014-01-30 14:40:21 +00:00
|
|
|
args = G_V_DISCOVERER_COMMAND.split(" ")
|
2014-01-08 08:49:38 +00:00
|
|
|
args.append(uri)
|
2014-11-19 16:58:23 +00:00
|
|
|
if os.path.isfile(media_info) and not self.options.update_media_info:
|
2014-07-16 10:50:41 +00:00
|
|
|
self._add_media(media_info, uri)
|
2014-01-13 10:13:02 +00:00
|
|
|
return True
|
2014-07-16 08:10:44 +00:00
|
|
|
elif fpath.endswith(GstValidateMediaDescriptor.STREAM_INFO_EXT):
|
2014-07-16 10:50:41 +00:00
|
|
|
self._add_media(fpath)
|
2014-01-13 10:13:02 +00:00
|
|
|
return True
|
2015-03-13 17:09:08 +00:00
|
|
|
elif not self.options.generate_info and not self.options.update_media_info and not self.options.validate_uris:
|
2015-10-05 04:38:10 +00:00
|
|
|
self.info("%s not present. Use --generate-media-info", media_info)
|
2014-11-19 16:58:23 +00:00
|
|
|
return True
|
|
|
|
elif self.options.update_media_info and not os.path.isfile(media_info):
|
2015-10-05 04:38:10 +00:00
|
|
|
self.info("%s not present. Use --generate-media-info", media_info)
|
2014-01-10 14:29:31 +00:00
|
|
|
return True
|
2014-01-08 08:49:38 +00:00
|
|
|
|
2014-10-24 12:23:52 +00:00
|
|
|
media_descriptor = GstValidateMediaDescriptor.new_from_uri(
|
|
|
|
uri, True,
|
2014-10-25 12:59:49 +00:00
|
|
|
self.options.generate_info_full)
|
2014-09-15 17:14:27 +00:00
|
|
|
if media_descriptor:
|
|
|
|
self._add_media(media_descriptor, uri)
|
|
|
|
else:
|
|
|
|
self.warning("Could not get any descriptor for %s" % uri)
|
2014-06-26 10:42:38 +00:00
|
|
|
|
2014-01-08 08:49:38 +00:00
|
|
|
return True
|
|
|
|
|
2014-01-08 17:51:14 +00:00
|
|
|
except subprocess.CalledProcessError as e:
|
2014-06-26 10:42:38 +00:00
|
|
|
if self.options.generate_info:
|
|
|
|
printc("Result: Failed", Colors.FAIL)
|
|
|
|
else:
|
|
|
|
self.error("Exception: %s", e)
|
2014-01-08 08:49:38 +00:00
|
|
|
return False
|
|
|
|
|
|
|
|
def _list_uris(self):
|
|
|
|
if self._uris:
|
|
|
|
return self._uris
|
|
|
|
|
2015-03-13 17:09:08 +00:00
|
|
|
if self.options.validate_uris:
|
|
|
|
for uri in self.options.validate_uris:
|
|
|
|
self._discover_file(uri, uri)
|
|
|
|
return self._uris
|
|
|
|
|
2014-01-08 08:49:38 +00:00
|
|
|
if not self.args:
|
|
|
|
if isinstance(self.options.paths, str):
|
|
|
|
self.options.paths = [os.path.join(self.options.paths)]
|
|
|
|
|
|
|
|
for path in self.options.paths:
|
2015-07-22 06:20:54 +00:00
|
|
|
if os.path.isfile(path):
|
|
|
|
self._discover_file(path2url(path), path)
|
|
|
|
else:
|
|
|
|
for root, dirs, files in os.walk(path):
|
|
|
|
for f in files:
|
2015-08-26 01:36:51 +00:00
|
|
|
fpath = os.path.abspath(os.path.join(root, f))
|
2015-07-22 06:20:54 +00:00
|
|
|
if os.path.isdir(fpath) or \
|
|
|
|
fpath.endswith(GstValidateMediaDescriptor.MEDIA_INFO_EXT) or\
|
|
|
|
fpath.endswith(ScenarioManager.FILE_EXTENSION):
|
|
|
|
continue
|
|
|
|
else:
|
|
|
|
self._discover_file(path2url(fpath), fpath)
|
2014-01-08 08:49:38 +00:00
|
|
|
|
2014-01-08 17:51:14 +00:00
|
|
|
self.debug("Uris found: %s", self._uris)
|
2014-01-08 08:49:38 +00:00
|
|
|
|
|
|
|
return self._uris
|
|
|
|
|
2014-01-13 16:31:57 +00:00
|
|
|
def needs_http_server(self):
|
2014-03-26 10:00:32 +00:00
|
|
|
for test in self.list_tests():
|
2014-06-18 10:51:02 +00:00
|
|
|
if self._is_test_wanted(test) and test.media_descriptor is not None:
|
2014-04-25 09:31:01 +00:00
|
|
|
protocol = test.media_descriptor.get_protocol()
|
|
|
|
uri = test.media_descriptor.get_uri()
|
2014-03-26 10:00:32 +00:00
|
|
|
|
2014-08-09 14:34:09 +00:00
|
|
|
if protocol in [Protocols.HTTP, Protocols.HLS, Protocols.DASH] and \
|
2014-10-24 12:23:52 +00:00
|
|
|
"127.0.0.1:%s" % (self.options.http_server_port) in uri:
|
2014-03-26 10:00:32 +00:00
|
|
|
return True
|
|
|
|
return False
|
2014-01-30 11:20:33 +00:00
|
|
|
|
2014-04-25 09:32:04 +00:00
|
|
|
def set_settings(self, options, args, reporter):
|
2014-06-19 07:38:52 +00:00
|
|
|
if options.wanted_tests:
|
|
|
|
for i in range(len(options.wanted_tests)):
|
|
|
|
if "ALL" in options.wanted_tests[i]:
|
|
|
|
self._run_defaults = False
|
2014-10-24 12:23:52 +00:00
|
|
|
options.wanted_tests[
|
|
|
|
i] = options.wanted_tests[i].replace("ALL", "")
|
2014-06-19 07:38:52 +00:00
|
|
|
try:
|
|
|
|
options.wanted_tests.remove("")
|
|
|
|
except ValueError:
|
|
|
|
pass
|
|
|
|
|
2015-03-13 17:09:08 +00:00
|
|
|
if options.validate_uris:
|
|
|
|
self.check_testslist = False
|
|
|
|
|
2014-10-24 12:23:52 +00:00
|
|
|
super(GstValidateTestManager, self).set_settings(
|
|
|
|
options, args, reporter)
|
|
|
|
|
2014-11-28 21:42:47 +00:00
|
|
|
def register_defaults(self):
|
|
|
|
"""
|
|
|
|
Registers the defaults:
|
|
|
|
* Scenarios to be used
|
|
|
|
* Encoding formats to be used
|
|
|
|
* Blacklisted tests
|
|
|
|
* Test generators
|
|
|
|
"""
|
|
|
|
self.register_default_scenarios()
|
|
|
|
self.register_default_encoding_formats()
|
|
|
|
self.register_default_blacklist()
|
|
|
|
self.register_default_test_generators()
|
2014-06-18 10:51:02 +00:00
|
|
|
|
2014-11-28 21:42:47 +00:00
|
|
|
def register_default_scenarios(self):
|
|
|
|
"""
|
|
|
|
Registers default test scenarios
|
|
|
|
"""
|
|
|
|
if self.options.long_limit != 0:
|
|
|
|
self.add_scenarios([
|
|
|
|
"play_15s",
|
|
|
|
"reverse_playback",
|
|
|
|
"fast_forward",
|
|
|
|
"seek_forward",
|
|
|
|
"seek_backward",
|
|
|
|
"seek_with_stop",
|
|
|
|
"switch_audio_track",
|
|
|
|
"switch_audio_track_while_paused",
|
|
|
|
"switch_subtitle_track",
|
|
|
|
"switch_subtitle_track_while_paused",
|
|
|
|
"disable_subtitle_track_while_paused",
|
|
|
|
"change_state_intensive",
|
|
|
|
"scrub_forward_seeking"])
|
|
|
|
else:
|
|
|
|
self.add_scenarios([
|
|
|
|
"play_15s",
|
|
|
|
"reverse_playback",
|
|
|
|
"fast_forward",
|
|
|
|
"seek_forward",
|
|
|
|
"seek_backward",
|
|
|
|
"seek_with_stop",
|
|
|
|
"switch_audio_track",
|
|
|
|
"switch_audio_track_while_paused",
|
|
|
|
"switch_subtitle_track",
|
|
|
|
"switch_subtitle_track_while_paused",
|
|
|
|
"disable_subtitle_track_while_paused",
|
|
|
|
"change_state_intensive",
|
|
|
|
"scrub_forward_seeking"])
|
|
|
|
|
|
|
|
def register_default_encoding_formats(self):
|
|
|
|
"""
|
|
|
|
Registers default encoding formats
|
|
|
|
"""
|
|
|
|
self.add_encoding_formats([
|
|
|
|
MediaFormatCombination("ogg", "vorbis", "theora"),
|
|
|
|
MediaFormatCombination("webm", "vorbis", "vp8"),
|
|
|
|
MediaFormatCombination("mp4", "mp3", "h264"),
|
|
|
|
MediaFormatCombination("mkv", "vorbis", "h264"),
|
|
|
|
])
|
|
|
|
|
|
|
|
def register_default_blacklist(self):
|
|
|
|
self.set_default_blacklist([
|
2015-08-16 15:53:28 +00:00
|
|
|
# hls known issues
|
|
|
|
("validate.hls.playback.seek_with_stop.*",
|
|
|
|
"https://bugzilla.gnome.org/show_bug.cgi?id=753689"),
|
2016-03-22 18:00:48 +00:00
|
|
|
("validate.hls.playback.scrub_forward_seeking.*",
|
2016-03-22 16:46:50 +00:00
|
|
|
"https://bugzilla.gnome.org/show_bug.cgi?id=764020"),
|
2015-08-16 15:53:28 +00:00
|
|
|
|
2015-08-15 17:04:14 +00:00
|
|
|
# dash known issues
|
|
|
|
("validate.dash.media_check.*",
|
|
|
|
"Caps are different depending on selected bitrates, etc"),
|
2016-03-22 18:00:48 +00:00
|
|
|
("validate.dash.playback.scrub_forward_seeking.*",
|
|
|
|
"https://bugzilla.gnome.org/show_bug.cgi?id=764020"),
|
2015-08-15 17:04:14 +00:00
|
|
|
|
2014-11-28 21:42:47 +00:00
|
|
|
# Matroska/WEBM known issues:
|
|
|
|
("validate.*.reverse_playback.*webm$",
|
|
|
|
"https://bugzilla.gnome.org/show_bug.cgi?id=679250"),
|
|
|
|
("validate.*.reverse_playback.*mkv$",
|
|
|
|
"https://bugzilla.gnome.org/show_bug.cgi?id=679250"),
|
|
|
|
("validate.http.playback.seek_with_stop.*webm",
|
|
|
|
"matroskademux.gst_matroska_demux_handle_seek_push: Seek end-time not supported in streaming mode"),
|
|
|
|
("validate.http.playback.seek_with_stop.*mkv",
|
|
|
|
"matroskademux.gst_matroska_demux_handle_seek_push: Seek end-time not supported in streaming mode"),
|
|
|
|
|
|
|
|
# MPEG TS known issues:
|
|
|
|
('(?i)validate.*.playback.reverse_playback.*(?:_|.)(?:|m)ts$',
|
|
|
|
"https://bugzilla.gnome.org/show_bug.cgi?id=702595"),
|
|
|
|
|
2016-05-07 00:27:53 +00:00
|
|
|
# Fragmented MP4 disabled tests:
|
|
|
|
('validate.file.playback..*seek.*.fragmented_nonseekable_sink_mp4',
|
|
|
|
"Seeking on fragmented files without indexes isn't implemented"),
|
|
|
|
('validate.file.playback.reverse_playback.fragmented_nonseekable_sink_mp4',
|
|
|
|
"Seeking on fragmented files without indexes isn't implemented"),
|
|
|
|
|
2014-11-28 21:42:47 +00:00
|
|
|
# HTTP known issues:
|
|
|
|
("validate.http.*scrub_forward_seeking.*",
|
|
|
|
"This is not stable enough for now."),
|
|
|
|
("validate.http.playback.change_state_intensive.raw_video_mov",
|
|
|
|
"This is not stable enough for now. (flow return from pad push doesn't match expected value)"),
|
|
|
|
|
|
|
|
# MXF known issues"
|
|
|
|
(".*reverse_playback.*mxf",
|
|
|
|
"Reverse playback is not handled in MXF"),
|
|
|
|
("validate\.file\.transcode.*mxf",
|
|
|
|
"FIXME: Transcoding and mixing tests need to be tested"),
|
|
|
|
|
|
|
|
# Videomixing known issues
|
|
|
|
("validate.file.*.simple.scrub_forward_seeking.synchronized",
|
|
|
|
"https://bugzilla.gnome.org/show_bug.cgi?id=734060"),
|
|
|
|
|
|
|
|
# WMV known issues"
|
|
|
|
(".*reverse_playback.*wmv",
|
|
|
|
"Reverse playback is not handled in wmv"),
|
|
|
|
(".*reverse_playback.*asf",
|
|
|
|
"Reverse playback is not handled in asf"),
|
|
|
|
])
|
|
|
|
|
|
|
|
def register_default_test_generators(self):
|
|
|
|
"""
|
|
|
|
Registers default test generators
|
|
|
|
"""
|
2014-11-28 23:03:04 +00:00
|
|
|
if self._default_generators_registered:
|
|
|
|
return
|
|
|
|
|
2014-11-28 21:42:47 +00:00
|
|
|
self.add_generators([GstValidatePlaybinTestsGenerator(self),
|
|
|
|
GstValidateMediaCheckTestsGenerator(self),
|
|
|
|
GstValidateTranscodingTestsGenerator(self)])
|
2014-11-28 23:03:04 +00:00
|
|
|
self._default_generators_registered = True
|