2016-11-04 21:04:37 +00:00
|
|
|
#!/usr/bin/env python3
|
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.
|
2016-09-09 15:09:45 +00:00
|
|
|
import argparse
|
2014-01-08 08:49:38 +00:00
|
|
|
import os
|
2014-12-05 11:16:36 +00:00
|
|
|
import copy
|
|
|
|
import sys
|
2014-02-13 14:31:58 +00:00
|
|
|
import time
|
2016-11-04 21:04:37 +00:00
|
|
|
import urllib.parse
|
2016-12-22 13:07:58 +00:00
|
|
|
import shlex
|
2014-12-05 11:16:36 +00:00
|
|
|
import socket
|
2014-01-09 08:14:27 +00:00
|
|
|
import subprocess
|
2016-11-04 21:04:37 +00:00
|
|
|
import configparser
|
2018-11-25 14:36:06 +00:00
|
|
|
import json
|
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, \
|
2014-12-05 11:16:36 +00:00
|
|
|
GST_SECOND, Result, Protocols, mkdir, printc, Colors, get_data_file, \
|
2019-06-23 16:48:06 +00:00
|
|
|
kill_subprocess, format_config_template, get_fakesink_for_media_type
|
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
|
2016-09-09 15:09:45 +00:00
|
|
|
parser = argparse.ArgumentParser(add_help=False)
|
|
|
|
parser.add_argument("--validate-tools-path", dest="validate_tools_path",
|
2014-12-05 11:16:36 +00:00
|
|
|
default="",
|
|
|
|
help="defines the paths to look for GstValidate tools.")
|
2016-09-09 15:09:45 +00:00
|
|
|
options, args = parser.parse_known_args()
|
|
|
|
|
2018-05-03 09:27:31 +00:00
|
|
|
GstValidateBaseTestManager.update_commands(options.validate_tools_path)
|
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
|
|
|
|
2014-01-30 15:59:21 +00:00
|
|
|
|
2019-08-05 23:04:54 +00:00
|
|
|
def expand_vars_in_list_recurse(l, data):
|
|
|
|
for i, v in enumerate(l):
|
|
|
|
if isinstance(v, dict):
|
|
|
|
l[i] = expand_vars_in_dict_recurse(v, data)
|
|
|
|
elif isinstance(v, str):
|
|
|
|
l[i] = v % data
|
|
|
|
elif isinstance(v, list):
|
|
|
|
l[i] = expand_vars_in_list_recurse(v, data)
|
|
|
|
|
|
|
|
return l
|
|
|
|
|
|
|
|
|
|
|
|
def expand_vars_in_dict_recurse(dico, data):
|
|
|
|
for key, value in dico.items():
|
|
|
|
if isinstance(value, dict):
|
|
|
|
dico[key] = expand_vars_in_dict_recurse(value, data)
|
|
|
|
elif isinstance(value, str):
|
|
|
|
dico[key] = value % data
|
|
|
|
elif isinstance(value, list):
|
|
|
|
dico[key] = expand_vars_in_list_recurse(value, data)
|
|
|
|
|
|
|
|
return dico
|
|
|
|
|
|
|
|
|
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()
|
2017-12-03 11:23:51 +00:00
|
|
|
timeout = DEFAULT_TIMEOUT
|
2014-06-18 10:51:02 +00:00
|
|
|
|
2017-07-13 20:43:32 +00:00
|
|
|
classname = "%s.media_check.%s" % (protocol,
|
|
|
|
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-12-05 11:16:36 +00:00
|
|
|
protocol = mediainfo.media_descriptor.get_protocol()
|
|
|
|
if protocol == Protocols.RTSP:
|
|
|
|
continue
|
|
|
|
|
2014-06-26 10:42:38 +00:00
|
|
|
for comb in self.test_manager.get_encoding_formats():
|
2017-07-13 20:43:32 +00:00
|
|
|
classname = "%s.transcode.to_%s.%s" % (mediainfo.media_descriptor.get_protocol(),
|
|
|
|
str(comb).replace(
|
|
|
|
' ', '_'),
|
|
|
|
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):
|
2014-12-05 11:16:36 +00:00
|
|
|
|
2014-12-13 15:01:49 +00:00
|
|
|
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)
|
|
|
|
|
2017-05-31 18:06:04 +00:00
|
|
|
def is_live(self):
|
|
|
|
return self._infos.get('is-live', False)
|
|
|
|
|
2014-12-13 15:01:49 +00:00
|
|
|
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,
|
2018-10-28 17:27:22 +00:00
|
|
|
pipelines_descriptions=None, valid_scenarios=None):
|
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
|
|
|
|
"""
|
2018-10-28 17:27:22 +00:00
|
|
|
valid_scenarios = valid_scenarios or []
|
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
|
2019-01-26 12:19:35 +00:00
|
|
|
self._pipelines_descriptions = []
|
|
|
|
for description in pipelines_descriptions or []:
|
|
|
|
if not isinstance(description, dict):
|
|
|
|
desc_dict = {"name": description[0],
|
|
|
|
"pipeline": description[1]}
|
|
|
|
if len(description) >= 3:
|
|
|
|
desc_dict["extra_data"] = description[2]
|
|
|
|
self._pipelines_descriptions.append(desc_dict)
|
|
|
|
else:
|
|
|
|
self._pipelines_descriptions.append(description)
|
2014-06-18 15:26:05 +00:00
|
|
|
self._valid_scenarios = valid_scenarios
|
|
|
|
|
2018-11-25 14:36:06 +00:00
|
|
|
@classmethod
|
2018-10-28 17:27:22 +00:00
|
|
|
def from_json(cls, test_manager, json_file, extra_data=None):
|
|
|
|
"""
|
|
|
|
:param json_file: Path to a JSON file containing pipeline tests.
|
|
|
|
:param extra_data: Variables available for interpolation in validate
|
|
|
|
configs and scenario actions.
|
|
|
|
"""
|
|
|
|
if extra_data is None:
|
|
|
|
extra_data = {}
|
2018-11-25 14:36:06 +00:00
|
|
|
with open(json_file, 'r') as f:
|
|
|
|
descriptions = json.load(f)
|
|
|
|
|
|
|
|
name = os.path.basename(json_file).replace('.json', '')
|
|
|
|
pipelines_descriptions = []
|
|
|
|
for test_name, defs in descriptions.items():
|
2019-08-05 23:04:54 +00:00
|
|
|
tests_definition = {'name': test_name, 'pipeline': defs.pop('pipeline')}
|
2018-10-28 17:27:22 +00:00
|
|
|
test_private_dir = os.path.join(test_manager.options.privatedir,
|
|
|
|
name, test_name)
|
|
|
|
|
|
|
|
config_file = None
|
|
|
|
if 'config' in defs:
|
|
|
|
os.makedirs(test_private_dir, exist_ok=True)
|
|
|
|
config_file = os.path.join(test_private_dir,
|
|
|
|
test_name + '.config')
|
|
|
|
with open(config_file, 'w') as f:
|
2019-03-10 20:07:08 +00:00
|
|
|
f.write(format_config_template(extra_data,
|
2019-08-05 23:04:54 +00:00
|
|
|
'\n'.join(defs.pop('config')) + '\n', test_name))
|
2018-10-28 17:27:22 +00:00
|
|
|
|
2018-11-25 14:36:06 +00:00
|
|
|
scenarios = []
|
2019-08-05 23:04:54 +00:00
|
|
|
for scenario in defs.pop('scenarios', []):
|
2019-01-26 12:19:35 +00:00
|
|
|
if isinstance(scenario, str):
|
2018-10-28 17:27:22 +00:00
|
|
|
# Path to a scenario file
|
2019-01-26 12:19:35 +00:00
|
|
|
scenarios.append(scenario)
|
|
|
|
else:
|
2018-10-28 17:27:22 +00:00
|
|
|
# Dictionary defining a new scenario in-line
|
2019-01-26 12:19:35 +00:00
|
|
|
scenario_name = scenario_file = scenario['name']
|
|
|
|
actions = scenario.get('actions')
|
|
|
|
if actions:
|
2018-10-28 17:27:22 +00:00
|
|
|
os.makedirs(test_private_dir, exist_ok=True)
|
2019-01-26 12:19:35 +00:00
|
|
|
scenario_file = os.path.join(
|
2018-10-28 17:27:22 +00:00
|
|
|
test_private_dir, scenario_name + '.scenario')
|
2019-01-26 12:19:35 +00:00
|
|
|
with open(scenario_file, 'w') as f:
|
2018-10-28 17:27:22 +00:00
|
|
|
f.write('\n'.join(action % extra_data for action in actions) + '\n')
|
2019-01-26 12:19:35 +00:00
|
|
|
scenarios.append(scenario_file)
|
2019-08-05 23:04:54 +00:00
|
|
|
|
|
|
|
local_extra_data = extra_data.copy()
|
|
|
|
local_extra_data.update(defs)
|
|
|
|
envvars = defs.pop('extra_env_vars', {})
|
|
|
|
local_extra_data.update({
|
|
|
|
'scenarios': scenarios,
|
|
|
|
'config_file': config_file,
|
|
|
|
'plays-reverse': True,
|
|
|
|
'extra_env_vars': envvars,
|
|
|
|
})
|
|
|
|
|
|
|
|
expand_vars_in_dict_recurse(local_extra_data, extra_data)
|
|
|
|
tests_definition['extra_data'] = local_extra_data
|
2019-01-26 12:19:35 +00:00
|
|
|
tests_definition['pipeline_data'] = {"config_path": os.path.dirname(json_file)}
|
2019-08-05 23:04:54 +00:00
|
|
|
tests_definition['pipeline_data'].update(local_extra_data)
|
2019-01-26 12:19:35 +00:00
|
|
|
pipelines_descriptions.append(tests_definition)
|
2018-11-25 14:36:06 +00:00
|
|
|
|
|
|
|
return GstValidatePipelineTestsGenerator(name, test_manager, pipelines_descriptions=pipelines_descriptions)
|
|
|
|
|
2014-06-18 15:26:05 +00:00
|
|
|
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":
|
2017-07-13 20:43:32 +00:00
|
|
|
return "%s%s.%s" % (protocol_str, name, scenario.name)
|
2014-01-30 15:59:21 +00:00
|
|
|
|
2017-07-13 20:43:32 +00:00
|
|
|
return ("%s.%s.%s" % (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:
|
2019-01-26 12:19:35 +00:00
|
|
|
pipeline = description['pipeline']
|
|
|
|
extra_data = description.get('extra_data', {})
|
|
|
|
pipeline_data = description.get('pipeline_data', {})
|
2014-12-12 13:36:16 +00:00
|
|
|
|
2018-10-28 17:27:22 +00:00
|
|
|
if 'scenarios' in extra_data:
|
|
|
|
# A pipeline description can override the default scenario set.
|
|
|
|
# The pipeline description may specify an empty list of
|
|
|
|
# scenarios, in which case one test will be generated with no
|
|
|
|
# scenario.
|
|
|
|
scenarios_to_iterate = extra_data['scenarios'] or [None]
|
|
|
|
else:
|
|
|
|
scenarios_to_iterate = scenarios
|
|
|
|
|
|
|
|
for scenario in scenarios_to_iterate:
|
2014-12-13 15:01:49 +00:00
|
|
|
if isinstance(scenario, str):
|
2019-07-10 20:52:45 +00:00
|
|
|
tmpscenario = self.test_manager.scenarios_manager.get_scenario(
|
2014-12-05 11:16:36 +00:00
|
|
|
scenario)
|
2019-07-10 20:52:45 +00:00
|
|
|
if tmpscenario is None:
|
|
|
|
raise RuntimeError("Could not find scenario file: %s" % scenario)
|
|
|
|
scenario = tmpscenario
|
2014-12-13 15:01:49 +00:00
|
|
|
|
2019-01-26 12:19:35 +00:00
|
|
|
mediainfo = FakeMediaDescriptor(extra_data, pipeline)
|
2014-12-13 15:01:49 +00:00
|
|
|
if not mediainfo.is_compatible(scenario):
|
|
|
|
continue
|
|
|
|
|
2014-12-12 13:36:16 +00:00
|
|
|
if self.test_manager.options.mute:
|
2018-10-28 17:27:22 +00:00
|
|
|
needs_clock = scenario.needs_clock_sync() \
|
|
|
|
if scenario else False
|
2019-06-23 16:48:06 +00:00
|
|
|
audiosink = get_fakesink_for_media_type("audio", needs_clock)
|
|
|
|
videosink = get_fakesink_for_media_type("video", needs_clock)
|
2014-12-12 13:36:16 +00:00
|
|
|
else:
|
|
|
|
audiosink = 'autoaudiosink'
|
|
|
|
videosink = 'autovideosink'
|
|
|
|
|
2019-01-26 12:19:35 +00:00
|
|
|
pipeline_data.update({'videosink': videosink, 'audiosink': audiosink})
|
|
|
|
pipeline_desc = pipeline % pipeline_data
|
2014-12-12 13:36:16 +00:00
|
|
|
|
2014-12-05 11:16:36 +00:00
|
|
|
fname = self.get_fname(
|
2019-01-26 12:19:35 +00:00
|
|
|
scenario, protocol=mediainfo.get_protocol(), name=description["name"])
|
2014-12-12 13:36:16 +00:00
|
|
|
|
2019-03-18 19:52:11 +00:00
|
|
|
expected_issues = extra_data.get("expected-issues")
|
2019-01-26 12:19:35 +00:00
|
|
|
extra_env_vars = extra_data.get("extra_env_vars")
|
2018-10-28 17:27:22 +00:00
|
|
|
test = GstValidateLaunchTest(fname,
|
|
|
|
self.test_manager.options,
|
|
|
|
self.test_manager.reporter,
|
|
|
|
pipeline_desc,
|
|
|
|
scenario=scenario,
|
|
|
|
media_descriptor=mediainfo,
|
2019-03-18 19:52:11 +00:00
|
|
|
expected_issues=expected_issues,
|
2018-10-28 17:27:22 +00:00
|
|
|
extra_env_variables=extra_env_vars)
|
|
|
|
if extra_data.get('config_file'):
|
|
|
|
test.add_validate_config(extra_data['config_file'])
|
|
|
|
self.add_test(test)
|
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):
|
2015-11-02 13:42:53 +00:00
|
|
|
if os.getenv("USE_PLAYBIN3") is None:
|
|
|
|
GstValidatePipelineTestsGenerator.__init__(
|
|
|
|
self, "playback", test_manager, "playbin")
|
|
|
|
else:
|
|
|
|
GstValidatePipelineTestsGenerator.__init__(
|
|
|
|
self, "playback", test_manager, "playbin3")
|
2014-01-30 14:40:21 +00:00
|
|
|
|
2014-12-05 11:16:36 +00:00
|
|
|
def _set_sinks(self, minfo, pipe_str, scenario):
|
|
|
|
if self.test_manager.options.mute:
|
2018-08-02 01:05:32 +00:00
|
|
|
needs_clock = scenario.needs_clock_sync() or minfo.media_descriptor.need_clock_sync()
|
2014-12-05 11:16:36 +00:00
|
|
|
|
2019-06-23 16:48:06 +00:00
|
|
|
afakesink = get_fakesink_for_media_type("audio", needs_clock)
|
|
|
|
vfakesink = get_fakesink_for_media_type("video", needs_clock)
|
2018-08-02 01:05:32 +00:00
|
|
|
pipe_str += " audio-sink='%s' video-sink='%s'" % (
|
2014-12-05 11:16:36 +00:00
|
|
|
afakesink, vfakesink)
|
|
|
|
|
|
|
|
return pipe_str
|
|
|
|
|
|
|
|
def _get_name(self, scenario, protocol, minfo):
|
|
|
|
return "%s.%s" % (self.get_fname(scenario,
|
|
|
|
protocol),
|
|
|
|
os.path.basename(minfo.media_descriptor.get_clean_name()))
|
|
|
|
|
2014-06-18 15:26:05 +00:00
|
|
|
def populate_tests(self, uri_minfo_special_scenarios, scenarios):
|
2018-05-03 09:27:31 +00:00
|
|
|
test_rtsp = GstValidateBaseTestManager.RTSP_SERVER_COMMAND
|
2014-12-05 11:16:36 +00:00
|
|
|
if not test_rtsp:
|
|
|
|
printc("\n\nRTSP server not available, you should make sure"
|
2018-05-03 09:27:31 +00:00
|
|
|
" that %s is available in your $PATH." % GstValidateBaseTestManager.RTSP_SERVER_COMMAND,
|
2014-12-05 11:16:36 +00:00
|
|
|
Colors.FAIL)
|
|
|
|
elif self.test_manager.options.disable_rtsp:
|
|
|
|
printc("\n\nRTSP tests are disabled")
|
|
|
|
test_rtsp = False
|
|
|
|
|
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-12-05 11:16:36 +00:00
|
|
|
if protocol == Protocols.RTSP:
|
|
|
|
self.debug("SKIPPING %s as it is a RTSP stream" % uri)
|
|
|
|
continue
|
|
|
|
|
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-12-05 11:16:36 +00:00
|
|
|
cpipe = self._set_sinks(minfo, cpipe, scenario)
|
|
|
|
fname = self._get_name(scenario, protocol, minfo)
|
2014-07-23 12:43:29 +00:00
|
|
|
|
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-12-05 11:16:36 +00:00
|
|
|
if test_rtsp and protocol == Protocols.FILE and not minfo.media_descriptor.is_image():
|
2017-06-22 19:26:08 +00:00
|
|
|
rtspminfo = NamedDic({"path": minfo.media_descriptor.get_path(),
|
|
|
|
"media_descriptor": GstValidateRTSPMediaDesciptor(minfo.media_descriptor.get_path())})
|
2014-12-05 11:16:36 +00:00
|
|
|
if not rtspminfo.media_descriptor.is_compatible(scenario):
|
|
|
|
continue
|
|
|
|
|
|
|
|
cpipe = self._set_sinks(rtspminfo, "%s uri=rtsp://127.0.0.1:<RTSPPORTNUMBER>/test"
|
|
|
|
% self._pipeline_template, scenario)
|
|
|
|
fname = self._get_name(scenario, Protocols.RTSP, rtspminfo)
|
|
|
|
|
|
|
|
self.add_test(GstValidateRTSPTest(
|
|
|
|
fname, self.test_manager.options, self.test_manager.reporter,
|
|
|
|
cpipe, uri, scenario=scenario,
|
|
|
|
media_descriptor=rtspminfo.media_descriptor))
|
|
|
|
|
2017-07-03 20:36:32 +00:00
|
|
|
fname = self._get_name(scenario, Protocols.RTSP + '2', rtspminfo)
|
|
|
|
self.add_test(GstValidateRTSPTest(
|
|
|
|
fname, self.test_manager.options, self.test_manager.reporter,
|
|
|
|
cpipe, uri, scenario=scenario,
|
|
|
|
media_descriptor=rtspminfo.media_descriptor,
|
|
|
|
rtsp2=True))
|
|
|
|
|
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="",
|
2018-10-28 17:27:22 +00:00
|
|
|
num_sources=3, mixed_srcs=None, valid_scenarios=None):
|
|
|
|
mixed_srcs = mixed_srcs or {}
|
|
|
|
valid_scenarios = valid_scenarios or []
|
|
|
|
|
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]
|
2015-11-02 13:42:53 +00:00
|
|
|
if os.getenv("USE_PLAYBIN3") is None:
|
|
|
|
srcs.append(
|
|
|
|
"uridecodebin uri=%s ! %s" % (uri, self.converter))
|
|
|
|
else:
|
|
|
|
srcs.append(
|
|
|
|
"uridecodebin3 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)
|
|
|
|
|
2016-11-04 21:04:37 +00:00
|
|
|
for name, srcs in self.mixed_srcs.items():
|
2014-06-26 11:01:13 +00:00
|
|
|
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:
|
2019-06-23 16:48:06 +00:00
|
|
|
pipe_arguments["sink"] = get_fakesink_for_media_type(self.media_type,
|
|
|
|
scenario.needs_clock_sync())
|
2014-12-13 22:23:11 +00:00
|
|
|
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,
|
2019-03-18 19:52:11 +00:00
|
|
|
extra_env_variables=None, expected_issues=None):
|
2015-08-15 14:40:11 +00:00
|
|
|
|
|
|
|
extra_env_variables = extra_env_variables or {}
|
|
|
|
|
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(
|
2018-05-03 09:27:31 +00:00
|
|
|
GstValidateLaunchTest, self).__init__(GstValidateBaseTestManager.COMMAND,
|
|
|
|
classname,
|
2014-10-24 12:23:52 +00:00
|
|
|
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,
|
2016-09-02 20:37:24 +00:00
|
|
|
extra_env_variables=extra_env_variables,
|
2019-03-18 19:52:11 +00:00
|
|
|
expected_issues=expected_issues)
|
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)
|
2016-12-22 13:07:58 +00:00
|
|
|
self.add_arguments(*shlex.split(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(
|
2016-12-22 13:07:58 +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,
|
2016-09-02 20:37:24 +00:00
|
|
|
extra_env_variables=None,
|
2019-03-18 19:52:11 +00:00
|
|
|
expected_issues=None):
|
2015-08-15 14:40:11 +00:00
|
|
|
extra_env_variables = extra_env_variables or {}
|
|
|
|
|
2014-10-24 12:23:52 +00:00
|
|
|
super(
|
2018-05-03 09:27:31 +00:00
|
|
|
GstValidateMediaCheckTest, self).__init__(GstValidateBaseTestManager.MEDIA_CHECK_COMMAND, classname,
|
2014-10-24 12:23:52 +00:00
|
|
|
options, reporter,
|
2015-05-13 13:29:43 +00:00
|
|
|
timeout=timeout,
|
2015-08-15 14:23:02 +00:00
|
|
|
media_descriptor=media_descriptor,
|
2016-09-02 20:37:24 +00:00
|
|
|
extra_env_variables=extra_env_variables,
|
2019-03-18 19:52:11 +00:00
|
|
|
expected_issues=expected_issues)
|
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-12-05 11:16:36 +00:00
|
|
|
self.add_arguments(self._uri, "--expected-results",
|
|
|
|
self._media_info_path)
|
2014-01-13 10:13:02 +00:00
|
|
|
|
2018-05-25 13:35:10 +00:00
|
|
|
if self.media_descriptor.skip_parsers():
|
|
|
|
self.add_arguments("--skip-parsers")
|
|
|
|
|
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,
|
2016-09-02 20:37:24 +00:00
|
|
|
extra_env_variables=None,
|
2019-03-18 19:52:11 +00:00
|
|
|
expected_issues=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 {}
|
|
|
|
|
2016-11-04 21:04:37 +00:00
|
|
|
file_dur = int(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-10-24 12:23:52 +00:00
|
|
|
super(
|
2018-05-03 09:27:31 +00:00
|
|
|
GstValidateTranscodingTest, self).__init__(GstValidateBaseTestManager.TRANSCODING_COMMAND,
|
2014-10-24 12:23:52 +00:00
|
|
|
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,
|
2016-09-02 20:37:24 +00:00
|
|
|
extra_env_variables=None,
|
2019-03-18 19:52:11 +00:00
|
|
|
expected_issues=expected_issues)
|
2015-08-15 14:40:11 +00:00
|
|
|
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
|
|
|
|
|
2018-04-21 02:57:32 +00:00
|
|
|
def run_external_checks(self):
|
|
|
|
if self.media_descriptor.get_num_tracks("video") == 1 and \
|
|
|
|
self.options.validate_enable_iqa_tests:
|
|
|
|
self.run_iqa_test(self.uri)
|
|
|
|
|
2014-01-09 08:14:27 +00:00
|
|
|
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))
|
2016-11-04 21:04:37 +00:00
|
|
|
mkdir(os.path.dirname(urllib.parse.urlsplit(self.dest_file).path))
|
|
|
|
if urllib.parse.urlparse(self.dest_file).scheme == "":
|
2014-01-09 08:14:27 +00:00
|
|
|
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()
|
2016-12-22 13:07:58 +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:
|
2019-03-17 00:37:16 +00:00
|
|
|
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/132""")
|
2014-02-14 15:07:51 +00:00
|
|
|
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-12-05 11:16:36 +00:00
|
|
|
class GstValidateBaseRTSPTest:
|
|
|
|
""" Interface for RTSP tests, requires implementing Test"""
|
|
|
|
__used_ports = set()
|
|
|
|
|
|
|
|
def __init__(self, local_uri):
|
|
|
|
self._local_uri = local_uri
|
|
|
|
self.rtsp_server = None
|
|
|
|
self._unsetport_pipeline_desc = None
|
|
|
|
self.optional = True
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def __get_open_port(cls):
|
|
|
|
while True:
|
|
|
|
# hackish trick from
|
|
|
|
# http://stackoverflow.com/questions/2838244/get-open-tcp-port-in-python?answertab=votes#tab-top
|
|
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
|
|
s.bind(("", 0))
|
|
|
|
port = s.getsockname()[1]
|
|
|
|
if port not in cls.__used_ports:
|
|
|
|
cls.__used_ports.add(port)
|
|
|
|
s.close()
|
|
|
|
return port
|
|
|
|
|
|
|
|
s.close()
|
|
|
|
|
|
|
|
def launch_server(self):
|
|
|
|
if self.options.redirect_logs == 'stdout':
|
|
|
|
self.rtspserver_logs = sys.stdout
|
|
|
|
elif self.options.redirect_logs == 'stderr':
|
|
|
|
self.rtspserver_logs = sys.stderr
|
|
|
|
|
|
|
|
self.server_port = self.__get_open_port()
|
2018-05-03 09:27:31 +00:00
|
|
|
command = [GstValidateBaseTestManager.RTSP_SERVER_COMMAND, self._local_uri, '--port', str(self.server_port)]
|
2014-12-05 11:16:36 +00:00
|
|
|
|
|
|
|
if self.options.validate_gdb_server:
|
|
|
|
command = self.use_gdb(command)
|
|
|
|
self.rtspserver_logs = sys.stdout
|
|
|
|
elif self.options.redirect_logs:
|
|
|
|
self.rtspserver_logs = sys.stdout
|
|
|
|
else:
|
|
|
|
self.rtspserver_logs = open(self.logfile + '_rtspserver.log', 'w+')
|
2019-04-05 13:40:45 +00:00
|
|
|
self.extra_logfiles.add(self.rtspserver_logs.name)
|
2014-12-05 11:16:36 +00:00
|
|
|
|
|
|
|
server_env = os.environ.copy()
|
|
|
|
|
|
|
|
self.rtsp_server = subprocess.Popen(command,
|
|
|
|
stderr=self.rtspserver_logs,
|
|
|
|
stdout=self.rtspserver_logs,
|
|
|
|
env=server_env)
|
|
|
|
while True:
|
|
|
|
s = socket.socket()
|
|
|
|
try:
|
|
|
|
s.connect((("127.0.0.1", self.server_port)))
|
|
|
|
break
|
|
|
|
except ConnectionRefusedError:
|
2017-12-03 10:05:40 +00:00
|
|
|
time.sleep(0.1)
|
2014-12-05 11:16:36 +00:00
|
|
|
continue
|
|
|
|
finally:
|
|
|
|
s.close()
|
|
|
|
|
|
|
|
if not self._unsetport_pipeline_desc:
|
|
|
|
self._unsetport_pipeline_desc = self.pipeline_desc
|
|
|
|
|
|
|
|
self.pipeline_desc = self._unsetport_pipeline_desc.replace(
|
|
|
|
"<RTSPPORTNUMBER>", str(self.server_port))
|
|
|
|
|
2017-06-20 14:43:09 +00:00
|
|
|
return ' '.join(command)
|
2014-12-05 11:16:36 +00:00
|
|
|
|
|
|
|
def close_logfile(self):
|
|
|
|
super().close_logfile()
|
|
|
|
if not self.options.redirect_logs:
|
|
|
|
self.rtspserver_logs.close()
|
|
|
|
|
|
|
|
def process_update(self):
|
|
|
|
res = super().process_update()
|
|
|
|
if res:
|
|
|
|
kill_subprocess(self, self.rtsp_server, DEFAULT_TIMEOUT)
|
|
|
|
self.__used_ports.remove(self.server_port)
|
|
|
|
|
|
|
|
return res
|
|
|
|
|
|
|
|
|
|
|
|
class GstValidateRTSPTest(GstValidateBaseRTSPTest, GstValidateLaunchTest):
|
|
|
|
|
|
|
|
def __init__(self, classname, options, reporter, pipeline_desc,
|
|
|
|
local_uri, timeout=DEFAULT_TIMEOUT, scenario=None,
|
2017-07-03 20:36:32 +00:00
|
|
|
media_descriptor=None, rtsp2=False):
|
2014-12-05 11:16:36 +00:00
|
|
|
GstValidateLaunchTest.__init__(self, classname, options, reporter,
|
|
|
|
pipeline_desc, timeout, scenario,
|
|
|
|
media_descriptor)
|
|
|
|
GstValidateBaseRTSPTest.__init__(self, local_uri)
|
2017-07-03 20:36:32 +00:00
|
|
|
self.rtsp2 = rtsp2
|
|
|
|
|
|
|
|
def get_subproc_env(self):
|
|
|
|
env = super().get_subproc_env()
|
2019-02-02 00:23:16 +00:00
|
|
|
path = env.get('GST_VALIDATE_SCENARIOS_PATH', '')
|
|
|
|
override_dir = get_data_file(os.path.join('data', 'scenarios'), 'rtsp_overrides')
|
|
|
|
env['GST_VALIDATE_SCENARIOS_PATH'] = '%s:%s' % (override_dir, path)
|
2017-07-03 20:36:32 +00:00
|
|
|
if self.rtsp2:
|
|
|
|
env['GST_VALIDATE_SCENARIO'] = env.get('GST_VALIDATE_SCENARIO', '') + ':' + 'force_rtsp2'
|
|
|
|
|
|
|
|
return env
|
2014-12-05 11:16:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
class GstValidateRTSPMediaDesciptor(GstValidateMediaDescriptor):
|
|
|
|
|
|
|
|
def __init__(self, xml_path):
|
|
|
|
GstValidateMediaDescriptor.__init__(self, xml_path)
|
|
|
|
|
|
|
|
def get_uri(self):
|
|
|
|
return "rtsp://127.0.0.1:8554/test"
|
|
|
|
|
|
|
|
def get_protocol(self):
|
|
|
|
return Protocols.RTSP
|
|
|
|
|
2017-05-10 11:12:18 +00:00
|
|
|
def prerrols(self):
|
|
|
|
return False
|
|
|
|
|
2014-12-05 11:16:36 +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):
|
2016-09-09 15:09:45 +00:00
|
|
|
for command, name in [
|
2018-12-14 10:17:41 +00:00
|
|
|
(GstValidateBaseTestManager.TRANSCODING_COMMAND, "gst-validate-transcoding-1.0"),
|
|
|
|
(GstValidateBaseTestManager.COMMAND, "gst-validate-1.0"),
|
2018-05-03 09:27:31 +00:00
|
|
|
(GstValidateBaseTestManager.MEDIA_CHECK_COMMAND, "gst-validate-media-check-1.0")]:
|
2016-09-09 15:09:45 +00:00
|
|
|
if not command:
|
2018-12-14 11:00:18 +00:00
|
|
|
self.error("command not found: %s" % name)
|
2016-09-09 15:09:45 +00:00
|
|
|
return False
|
|
|
|
|
|
|
|
return True
|
2014-01-09 14:17:53 +00:00
|
|
|
|
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")
|
2016-09-09 15:09:45 +00:00
|
|
|
group.add_argument("--validate-tools-path", dest="validate_tools_path",
|
|
|
|
action="append", help="defines the paths to look for GstValidate tools.")
|
2014-12-05 11:16:36 +00:00
|
|
|
group.add_argument("--validate-gdb-server", dest="validate_gdb_server",
|
|
|
|
help="Run the server in GDB.")
|
|
|
|
group.add_argument("--validate-disable-rtsp", dest="disable_rtsp",
|
|
|
|
help="Disable RTSP tests.")
|
2018-04-21 02:57:32 +00:00
|
|
|
group.add_argument("--validate-enable-iqa-tests", dest="validate_enable_iqa_tests",
|
|
|
|
help="Enable Image Quality Assessment validation tests.",
|
|
|
|
default=False, action='store_true')
|
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:
|
2018-04-20 01:13:29 +00:00
|
|
|
for line in f.readlines():
|
|
|
|
line = line.strip()
|
|
|
|
if line.startswith('# PENDING:'):
|
|
|
|
tmp = line.split(' ')
|
2015-04-27 12:04:05 +00:00
|
|
|
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)
|
|
|
|
|
2018-11-28 13:14:35 +00:00
|
|
|
if not self.tests and not uris and not self.options.wanted_tests:
|
2019-04-05 13:40:04 +00:00
|
|
|
self.info("No valid uris present in the path. Check if media files and info files exist")
|
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()
|
|
|
|
|
2016-07-04 14:16:25 +00:00
|
|
|
# Adjust local http uri
|
|
|
|
if self.options.http_server_port != 8079 and \
|
|
|
|
uri.startswith("http://127.0.0.1:8079/"):
|
|
|
|
uri = uri.replace("http://127.0.0.1:8079/",
|
|
|
|
"http://127.0.0.1:%r/" % self.options.http_server_port, 1)
|
2016-11-04 21:04:37 +00:00
|
|
|
media_descriptor.set_protocol(urllib.parse.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))
|
2016-11-04 21:04:37 +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):
|
2018-05-23 15:57:23 +00:00
|
|
|
for ext in (GstValidateMediaDescriptor.MEDIA_INFO_EXT,
|
|
|
|
GstValidateMediaDescriptor.PUSH_MEDIA_INFO_EXT):
|
|
|
|
try:
|
|
|
|
is_push = False
|
|
|
|
media_info = "%s.%s" % (fpath, ext)
|
|
|
|
if ext == GstValidateMediaDescriptor.PUSH_MEDIA_INFO_EXT:
|
|
|
|
if not os.path.exists(media_info):
|
|
|
|
continue
|
|
|
|
is_push = True
|
|
|
|
uri = "push" + uri
|
|
|
|
args = GstValidateBaseTestManager.MEDIA_CHECK_COMMAND.split(" ")
|
|
|
|
|
|
|
|
args.append(uri)
|
|
|
|
if os.path.isfile(media_info) and not self.options.update_media_info:
|
|
|
|
self._add_media(media_info, uri)
|
|
|
|
continue
|
|
|
|
elif fpath.endswith(GstValidateMediaDescriptor.STREAM_INFO_EXT):
|
|
|
|
self._add_media(fpath)
|
|
|
|
continue
|
|
|
|
elif not self.options.generate_info and not self.options.update_media_info and not self.options.validate_uris:
|
|
|
|
continue
|
|
|
|
elif self.options.update_media_info and not os.path.isfile(media_info):
|
|
|
|
self.info(
|
|
|
|
"%s not present. Use --generate-media-info", media_info)
|
|
|
|
continue
|
|
|
|
elif os.path.islink(media_info):
|
|
|
|
self.info(
|
|
|
|
"%s is a symlink, not updating and hopefully the actual file gets updated!", media_info)
|
|
|
|
continue
|
2014-06-26 10:42:38 +00:00
|
|
|
|
2018-05-23 15:57:23 +00:00
|
|
|
include_frames = 0
|
|
|
|
if self.options.update_media_info:
|
|
|
|
include_frames = 2
|
|
|
|
elif self.options.generate_info_full:
|
|
|
|
include_frames = 1
|
2014-01-08 08:49:38 +00:00
|
|
|
|
2018-05-23 15:57:23 +00:00
|
|
|
media_descriptor = GstValidateMediaDescriptor.new_from_uri(
|
|
|
|
uri, True, include_frames, is_push)
|
|
|
|
if media_descriptor:
|
|
|
|
self._add_media(media_descriptor, uri)
|
|
|
|
else:
|
|
|
|
self.warning("Could not get any descriptor for %s" % uri)
|
|
|
|
|
|
|
|
except subprocess.CalledProcessError as e:
|
|
|
|
if self.options.generate_info:
|
|
|
|
printc("Result: Failed", Colors.FAIL)
|
|
|
|
else:
|
|
|
|
self.error("Exception: %s", e)
|
|
|
|
return False
|
|
|
|
return True
|
2014-01-08 08:49:38 +00:00
|
|
|
|
|
|
|
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):
|
2015-08-11 07:41:20 +00:00
|
|
|
path = os.path.abspath(path)
|
2015-07-22 06:20:54 +00:00
|
|
|
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()
|
2019-08-19 10:25:45 +00:00
|
|
|
uri_requires_http_server = False
|
|
|
|
if uri:
|
|
|
|
expanded_uri = uri % {
|
|
|
|
'http-server-port': self.options.http_server_port}
|
|
|
|
uri_requires_http_server = expanded_uri.find(
|
|
|
|
"127.0.0.1:%s" % self.options.http_server_port) != -1
|
|
|
|
if protocol in [Protocols.HTTP, Protocols.HLS, Protocols.DASH] or uri_requires_http_server:
|
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
|
|
|
|
"""
|
2019-03-17 00:37:37 +00:00
|
|
|
printc("-> Registering default 'validate' tests... ", end='')
|
2014-11-28 21:42:47 +00:00
|
|
|
self.register_default_scenarios()
|
|
|
|
self.register_default_encoding_formats()
|
|
|
|
self.register_default_blacklist()
|
|
|
|
self.register_default_test_generators()
|
2019-03-17 00:37:37 +00:00
|
|
|
printc("OK", Colors.OKGREEN)
|
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([
|
2018-04-20 01:13:29 +00:00
|
|
|
# testbin known issues
|
|
|
|
("testbin.media_check.*",
|
|
|
|
"Not supported by GstDiscoverer."),
|
|
|
|
|
2015-08-15 17:04:14 +00:00
|
|
|
# dash known issues
|
2017-07-13 20:43:32 +00:00
|
|
|
("dash.media_check.*",
|
2015-08-15 17:04:14 +00:00
|
|
|
"Caps are different depending on selected bitrates, etc"),
|
|
|
|
|
2014-11-28 21:42:47 +00:00
|
|
|
# Matroska/WEBM known issues:
|
2017-07-13 20:43:32 +00:00
|
|
|
("*.reverse_playback.*webm$",
|
2019-03-17 00:37:16 +00:00
|
|
|
"https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/65"),
|
2017-07-13 20:43:32 +00:00
|
|
|
("*.reverse_playback.*mkv$",
|
2019-03-17 00:37:16 +00:00
|
|
|
"https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/65"),
|
2017-07-13 20:43:32 +00:00
|
|
|
("http.playback.seek_with_stop.*webm",
|
2014-11-28 21:42:47 +00:00
|
|
|
"matroskademux.gst_matroska_demux_handle_seek_push: Seek end-time not supported in streaming mode"),
|
2017-07-13 20:43:32 +00:00
|
|
|
("http.playback.seek_with_stop.*mkv",
|
2014-11-28 21:42:47 +00:00
|
|
|
"matroskademux.gst_matroska_demux_handle_seek_push: Seek end-time not supported in streaming mode"),
|
|
|
|
|
|
|
|
# MPEG TS known issues:
|
2017-07-13 20:43:32 +00:00
|
|
|
('(?i)*playback.reverse_playback.*(?:_|.)(?:|m)ts$',
|
2019-03-17 00:37:16 +00:00
|
|
|
"https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/97"),
|
2014-11-28 21:42:47 +00:00
|
|
|
|
2016-05-07 00:27:53 +00:00
|
|
|
# Fragmented MP4 disabled tests:
|
2017-07-13 20:43:32 +00:00
|
|
|
('*.playback..*seek.*.fragmented_nonseekable_sink_mp4',
|
2016-05-07 00:27:53 +00:00
|
|
|
"Seeking on fragmented files without indexes isn't implemented"),
|
2017-07-13 20:43:32 +00:00
|
|
|
('*.playback.reverse_playback.fragmented_nonseekable_sink_mp4',
|
2016-05-07 00:27:53 +00:00
|
|
|
"Seeking on fragmented files without indexes isn't implemented"),
|
|
|
|
|
2014-11-28 21:42:47 +00:00
|
|
|
# HTTP known issues:
|
2017-07-13 20:43:32 +00:00
|
|
|
("http.*scrub_forward_seeking.*",
|
2014-11-28 21:42:47 +00:00
|
|
|
"This is not stable enough for now."),
|
2017-07-13 20:43:32 +00:00
|
|
|
("http.playback.change_state_intensive.raw_video_mov",
|
2014-11-28 21:42:47 +00:00
|
|
|
"This is not stable enough for now. (flow return from pad push doesn't match expected value)"),
|
|
|
|
|
|
|
|
# MXF known issues"
|
2017-07-13 20:43:32 +00:00
|
|
|
("*reverse_playback.*mxf",
|
2014-11-28 21:42:47 +00:00
|
|
|
"Reverse playback is not handled in MXF"),
|
2017-07-13 20:43:32 +00:00
|
|
|
("file\.transcode.*mxf",
|
2014-11-28 21:42:47 +00:00
|
|
|
"FIXME: Transcoding and mixing tests need to be tested"),
|
|
|
|
|
|
|
|
# WMV known issues"
|
2017-07-13 20:43:32 +00:00
|
|
|
("*reverse_playback.*wmv",
|
2014-11-28 21:42:47 +00:00
|
|
|
"Reverse playback is not handled in wmv"),
|
|
|
|
(".*reverse_playback.*asf",
|
|
|
|
"Reverse playback is not handled in asf"),
|
2016-08-13 13:39:18 +00:00
|
|
|
|
|
|
|
# ogg known issues
|
2017-07-13 20:43:32 +00:00
|
|
|
("http.playback.seek.*vorbis_theora_1_ogg",
|
2019-03-17 00:37:16 +00:00
|
|
|
"https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/281"),
|
2014-12-05 11:16:36 +00:00
|
|
|
# RTSP known issues
|
2017-07-03 20:36:32 +00:00
|
|
|
('rtsp.*playback.reverse.*',
|
2019-03-17 00:37:16 +00:00
|
|
|
'https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/32'),
|
2017-07-03 20:36:32 +00:00
|
|
|
('rtsp.*playback.seek_with_stop.*',
|
2019-03-17 00:37:16 +00:00
|
|
|
'https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/386'),
|
2017-07-03 20:36:32 +00:00
|
|
|
('rtsp.*playback.fast_*',
|
2019-08-01 19:04:12 +00:00
|
|
|
'rtpbasedepayload does not handle rate != 1.0 correctly'),
|
2014-11-28 21:42:47 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
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
|