Use gtest_parallel for PipeWire tests. This CL will also make PipeWire tests retried 3 times in case of failures. Change-Id: I9c66351f7ee171e29266fe4b8dcd52ca282c8f6d Bug: webrtc:14644 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/282820 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Owners-Override: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Jeremy Leconte <jleconte@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38595}
diff --git a/infra/specs/client.webrtc.json b/infra/specs/client.webrtc.json index 5634073..93615be 100644 --- a/infra/specs/client.webrtc.json +++ b/infra/specs/client.webrtc.json
@@ -3410,6 +3410,27 @@ "test_id_prefix": "ninja://:rtc_unittests/" }, { + "isolate_name": "shared_screencast_stream_test", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "shared_screencast_stream_test", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/" + }, + { "isolate_name": "slow_peer_connection_unittests", "merge": { "args": [], @@ -4709,6 +4730,27 @@ "test_id_prefix": "ninja://:rtc_unittests/" }, { + "isolate_name": "shared_screencast_stream_test", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "shared_screencast_stream_test", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/" + }, + { "isolate_name": "slow_peer_connection_unittests", "merge": { "args": [], @@ -5142,6 +5184,27 @@ "test_id_prefix": "ninja://:rtc_unittests/" }, { + "isolate_name": "shared_screencast_stream_test", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "shared_screencast_stream_test", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/" + }, + { "isolate_name": "slow_peer_connection_unittests", "merge": { "args": [], @@ -6359,32 +6422,6 @@ "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, { - "args": [ - ".", - "--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json" - ], - "isolate_name": "pipewire_shared_screencast_stream_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "pipewire_shared_screencast_stream_test", - "resultdb": { - "result_file": "${ISOLATED_OUTDIR}/gtest_output.json", - "result_format": "gtest_json" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "os": "Ubuntu-18.04" - } - ] - }, - "test_id_prefix": "ninja://modules/desktop_capture:pipewire_shared_screencast_stream_test/" - }, - { "isolate_name": "rtc_media_unittests", "merge": { "args": [], @@ -6470,6 +6507,27 @@ "test_id_prefix": "ninja://:rtc_unittests/" }, { + "isolate_name": "shared_screencast_stream_test", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "shared_screencast_stream_test", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/" + }, + { "isolate_name": "slow_peer_connection_unittests", "merge": { "args": [], @@ -6819,32 +6877,6 @@ "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, { - "args": [ - ".", - "--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json" - ], - "isolate_name": "pipewire_shared_screencast_stream_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "pipewire_shared_screencast_stream_test", - "resultdb": { - "result_file": "${ISOLATED_OUTDIR}/gtest_output.json", - "result_format": "gtest_json" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "os": "Ubuntu-18.04" - } - ] - }, - "test_id_prefix": "ninja://modules/desktop_capture:pipewire_shared_screencast_stream_test/" - }, - { "isolate_name": "rtc_media_unittests", "merge": { "args": [], @@ -6930,6 +6962,27 @@ "test_id_prefix": "ninja://:rtc_unittests/" }, { + "isolate_name": "shared_screencast_stream_test", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "shared_screencast_stream_test", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/" + }, + { "isolate_name": "slow_peer_connection_unittests", "merge": { "args": [],
diff --git a/infra/specs/gn_isolate_map.pyl b/infra/specs/gn_isolate_map.pyl index 598b15f..25ab4f2 100644 --- a/infra/specs/gn_isolate_map.pyl +++ b/infra/specs/gn_isolate_map.pyl
@@ -80,13 +80,10 @@ "label": "//pc:peerconnection_unittests", "type": "console_test_launcher", }, - "pipewire_shared_screencast_stream_test": { - "label": - "//modules/desktop_capture:pipewire_shared_screencast_stream_test", - "type": - "script", - "script": - "//modules/desktop_capture/linux/wayland/test/shared_screencast_stream_test.py", + "shared_screencast_stream_test": { + "label": "//modules/desktop_capture:shared_screencast_stream_test", + "type": "console_test_launcher", + "use_pipewire": True, }, "rtc_media_unittests": { "label": "//media:rtc_media_unittests",
diff --git a/infra/specs/test_suites.pyl b/infra/specs/test_suites.pyl index 6037ba6..88de021 100644 --- a/infra/specs/test_suites.pyl +++ b/infra/specs/test_suites.pyl
@@ -184,10 +184,7 @@ 'webrtc_nonparallel_tests': {}, }, 'linux_desktop_specific_tests': { - 'pipewire_shared_screencast_stream_test': { - 'args': ['.'], - 'mixins': ['resultdb-gtest-json-format'], - }, + 'shared_screencast_stream_test': {}, }, 'more_configs_tests': { 'peerconnection_unittests': {
diff --git a/infra/specs/tryserver.webrtc.json b/infra/specs/tryserver.webrtc.json index 4ed88ea..a5dc5ae 100644 --- a/infra/specs/tryserver.webrtc.json +++ b/infra/specs/tryserver.webrtc.json
@@ -6093,6 +6093,27 @@ "test_id_prefix": "ninja://:rtc_unittests/" }, { + "isolate_name": "shared_screencast_stream_test", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "shared_screencast_stream_test", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/" + }, + { "isolate_name": "slow_peer_connection_unittests", "merge": { "args": [], @@ -6447,32 +6468,6 @@ "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, { - "args": [ - ".", - "--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json" - ], - "isolate_name": "pipewire_shared_screencast_stream_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "pipewire_shared_screencast_stream_test", - "resultdb": { - "result_file": "${ISOLATED_OUTDIR}/gtest_output.json", - "result_format": "gtest_json" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "os": "Ubuntu-18.04" - } - ] - }, - "test_id_prefix": "ninja://modules/desktop_capture:pipewire_shared_screencast_stream_test/" - }, - { "isolate_name": "rtc_media_unittests", "merge": { "args": [], @@ -6558,6 +6553,27 @@ "test_id_prefix": "ninja://:rtc_unittests/" }, { + "isolate_name": "shared_screencast_stream_test", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "shared_screencast_stream_test", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/" + }, + { "isolate_name": "slow_peer_connection_unittests", "merge": { "args": [], @@ -6907,32 +6923,6 @@ "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, { - "args": [ - ".", - "--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json" - ], - "isolate_name": "pipewire_shared_screencast_stream_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "pipewire_shared_screencast_stream_test", - "resultdb": { - "result_file": "${ISOLATED_OUTDIR}/gtest_output.json", - "result_format": "gtest_json" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "os": "Ubuntu-18.04" - } - ] - }, - "test_id_prefix": "ninja://modules/desktop_capture:pipewire_shared_screencast_stream_test/" - }, - { "isolate_name": "rtc_media_unittests", "merge": { "args": [], @@ -7018,6 +7008,27 @@ "test_id_prefix": "ninja://:rtc_unittests/" }, { + "isolate_name": "shared_screencast_stream_test", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "shared_screencast_stream_test", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/" + }, + { "isolate_name": "slow_peer_connection_unittests", "merge": { "args": [], @@ -7825,32 +7836,6 @@ "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, { - "args": [ - ".", - "--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json" - ], - "isolate_name": "pipewire_shared_screencast_stream_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "pipewire_shared_screencast_stream_test", - "resultdb": { - "result_file": "${ISOLATED_OUTDIR}/gtest_output.json", - "result_format": "gtest_json" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "os": "Ubuntu-18.04" - } - ] - }, - "test_id_prefix": "ninja://modules/desktop_capture:pipewire_shared_screencast_stream_test/" - }, - { "isolate_name": "rtc_media_unittests", "merge": { "args": [], @@ -7936,6 +7921,27 @@ "test_id_prefix": "ninja://:rtc_unittests/" }, { + "isolate_name": "shared_screencast_stream_test", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "shared_screencast_stream_test", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/" + }, + { "isolate_name": "slow_peer_connection_unittests", "merge": { "args": [], @@ -8851,6 +8857,27 @@ "test_id_prefix": "ninja://:rtc_unittests/" }, { + "isolate_name": "shared_screencast_stream_test", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "shared_screencast_stream_test", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/" + }, + { "isolate_name": "slow_peer_connection_unittests", "merge": { "args": [], @@ -9284,6 +9311,27 @@ "test_id_prefix": "ninja://:rtc_unittests/" }, { + "isolate_name": "shared_screencast_stream_test", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "shared_screencast_stream_test", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/" + }, + { "isolate_name": "slow_peer_connection_unittests", "merge": { "args": [],
diff --git a/infra/specs/waterfalls.pyl b/infra/specs/waterfalls.pyl index 1df1a0c..1a9257e 100644 --- a/infra/specs/waterfalls.pyl +++ b/infra/specs/waterfalls.pyl
@@ -83,9 +83,7 @@ 'os_type': 'linux', 'mixins': ['linux-bionic', 'x86-64', 'resultdb-json-format'], 'test_suites': { - # TODO(crbug.com/webrtc/14644): Replace desktop_tests by linux_tests - # when the failing pipewire tests are ignored on sanitizers. - 'isolated_scripts': 'desktop_tests', + 'isolated_scripts': 'linux_tests', }, }, 'Linux MSan': { @@ -95,8 +93,6 @@ # TODO(crbug.com/webrtc/14568): Using 'linux_tests' # fails on "MemorySanitizer: use-of-uninitialized-value in # libpipewire-0.3.so." - # TODO(crbug.com/webrtc/14644): Replace desktop_tests by linux_tests - # when the failing pipewire tests are ignored on sanitizers. 'isolated_scripts': 'desktop_tests', }, }, @@ -107,8 +103,6 @@ # TODO(crbug.com/webrtc/14568): Using 'linux_tests' # fails on "ThreadSanitizer: data race on vptr (ctor/dtor vs # virtual call) in shared_screencast_stream_test." - # TODO(crbug.com/webrtc/14644): Replace desktop_tests by linux_tests - # when the failing pipewire tests are ignored on sanitizers. 'isolated_scripts': 'desktop_tests', }, }, @@ -116,18 +110,14 @@ 'os_type': 'linux', 'mixins': ['linux-bionic', 'x86-64', 'resultdb-json-format'], 'test_suites': { - # TODO(crbug.com/webrtc/14644): Replace desktop_tests by linux_tests - # when the failing pipewire tests are ignored on sanitizers. - 'isolated_scripts': 'desktop_tests', + 'isolated_scripts': 'linux_tests', }, }, 'Linux UBSan vptr': { 'os_type': 'linux', 'mixins': ['linux-bionic', 'x86-64', 'resultdb-json-format'], 'test_suites': { - # TODO(crbug.com/webrtc/14644): Replace desktop_tests by linux_tests - # when the failing pipewire tests are ignored on sanitizers. - 'isolated_scripts': 'desktop_tests', + 'isolated_scripts': 'linux_tests', }, }, 'Linux32 Debug': { @@ -509,9 +499,7 @@ 'os_type': 'linux', 'mixins': ['linux-bionic', 'x86-64', 'resultdb-json-format'], 'test_suites': { - # TODO(crbug.com/webrtc/14644): Replace desktop_tests by linux_tests - # when the failing pipewire tests are ignored on sanitizers. - 'isolated_scripts': 'desktop_tests', + 'isolated_scripts': 'linux_tests', }, }, 'linux_compile_arm64_dbg': {}, @@ -549,8 +537,6 @@ # TODO(crbug.com/webrtc/14568): Using 'linux_tests' # fails on "MemorySanitizer: use-of-uninitialized-value in # libpipewire-0.3.so." - # TODO(crbug.com/webrtc/14644): Replace desktop_tests by linux_tests - # when the failing pipewire tests are ignored on sanitizers. 'isolated_scripts': 'desktop_tests', }, }, @@ -568,8 +554,6 @@ # TODO(crbug.com/webrtc/14568): Using 'linux_tests' # fails on "ThreadSanitizer: data race on vptr (ctor/dtor vs # virtual call) in shared_screencast_stream_test." - # TODO(crbug.com/webrtc/14644): Replace desktop_tests by linux_tests - # when the failing pipewire tests are ignored on sanitizers. 'isolated_scripts': 'desktop_tests', }, }, @@ -577,18 +561,14 @@ 'os_type': 'linux', 'mixins': ['linux-bionic', 'x86-64', 'resultdb-json-format'], 'test_suites': { - # TODO(crbug.com/webrtc/14644): Replace desktop_tests by linux_tests - # when the failing pipewire tests are ignored on sanitizers. - 'isolated_scripts': 'desktop_tests', + 'isolated_scripts': 'linux_tests', }, }, 'linux_ubsan_vptr': { 'os_type': 'linux', 'mixins': ['linux-bionic', 'x86-64', 'resultdb-json-format'], 'test_suites': { - # TODO(crbug.com/webrtc/14644): Replace desktop_tests by linux_tests - # when the failing pipewire tests are ignored on sanitizers. - 'isolated_scripts': 'desktop_tests', + 'isolated_scripts': 'linux_tests', }, }, 'linux_x86_dbg': {
diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn index 34a5704..2deb71c 100644 --- a/modules/desktop_capture/BUILD.gn +++ b/modules/desktop_capture/BUILD.gn
@@ -139,20 +139,9 @@ deps += [ ":pipewire_stubs" ] } + data = [ "../../third_party/pipewire" ] public_configs = [ ":pipewire_config" ] } - - group("pipewire_shared_screencast_stream_test") { - testonly = true - - deps = [ ":shared_screencast_stream_test" ] - - data = [ - "../../third_party/pipewire", - "linux/wayland/test/shared_screencast_stream_test.py", - "${root_out_dir}/shared_screencast_stream_test", - ] - } } rtc_library("desktop_capture_unittests") {
diff --git a/modules/desktop_capture/linux/wayland/test/shared_screencast_stream_test.py b/modules/desktop_capture/linux/wayland/test/shared_screencast_stream_test.py deleted file mode 100644 index bf97d0c..0000000 --- a/modules/desktop_capture/linux/wayland/test/shared_screencast_stream_test.py +++ /dev/null
@@ -1,106 +0,0 @@ -#!/usr/bin/env vpython3 -# Copyright (c) 2022 The WebRTC project authors. All Rights Reserved. -# -# Use of this source code is governed by a BSD-style license -# that can be found in the LICENSE file in the root of the source -# tree. An additional intellectual property rights grant can be found -# in the file PATENTS. All contributing project authors may -# be found in the AUTHORS file in the root of the source tree. -""" -This script is the wrapper that runs the "shared_screencast_screen" test. -""" - -import argparse -import json -import os -import subprocess -import sys - -SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) -# Get rid of "modules/desktop_capture/linux/wayland/test" -ROOT_DIR = os.path.normpath( - os.path.join(SCRIPT_DIR, os.pardir, os.pardir, os.pardir, os.pardir, - os.pardir)) - - -def _ParseArgs(): - parser = argparse.ArgumentParser( - description='Run shared_screencast_screen test.') - parser.add_argument('build_dir', - help='Path to the build directory (e.g. out/Release).') - parser.add_argument( - '--isolated-script-test-output', - default=None, - help='Path to output JSON file which Chromium infra requires.') - # Unused args - # We just need to avoid passing these to the test - parser.add_argument( - '--isolated-script-test-perf-output', - default=None, - help='Path to store perf results in histogram proto format.') - - return parser.parse_known_args() - - -def _GetPipeWireDir(): - pipewire_dir = os.path.join(ROOT_DIR, 'third_party', 'pipewire', - 'linux-amd64') - - if not os.path.isdir(pipewire_dir): - pipewire_dir = None - - return pipewire_dir - - -def _ConfigurePipeWirePaths(path): - library_dir = os.path.join(path, 'lib64') - pipewire_binary_dir = os.path.join(path, 'bin') - pipewire_config_prefix = os.path.join(path, 'share', 'pipewire') - pipewire_module_dir = os.path.join(library_dir, 'pipewire-0.3') - spa_plugin_dir = os.path.join(library_dir, 'spa-0.2') - media_session_config_dir = os.path.join(pipewire_config_prefix, - 'media-session.d') - - env_vars = os.environ - env_vars['LD_LIBRARY_PATH'] = library_dir - env_vars['PIPEWIRE_CONFIG_PREFIX'] = pipewire_config_prefix - env_vars['PIPEWIRE_MODULE_DIR'] = pipewire_module_dir - env_vars['SPA_PLUGIN_DIR'] = spa_plugin_dir - env_vars['MEDIA_SESSION_CONFIG_DIR'] = media_session_config_dir - env_vars['PIPEWIRE_RUNTIME_DIR'] = '/tmp' - env_vars['PATH'] = env_vars['PATH'] + ':' + pipewire_binary_dir - - -def main(): - args, extra_args = _ParseArgs() - - pipewire_dir = _GetPipeWireDir() - - if pipewire_dir is None: - return 1 - - _ConfigurePipeWirePaths(pipewire_dir) - - pipewire_process = subprocess.Popen(["pipewire"], stdout=None) - pipewire_media_session_process = subprocess.Popen(["pipewire-media-session"], - stdout=None) - - test_command = os.path.join(args.build_dir, 'shared_screencast_stream_test') - pipewire_test_process = subprocess.run([test_command] + extra_args, - stdout=True, - check=False) - - return_value = pipewire_test_process.returncode - - pipewire_media_session_process.terminate() - pipewire_process.terminate() - - if args.isolated_script_test_output: - with open(args.isolated_script_test_output, 'w') as f: - json.dump({"version": 3}, f) - - return return_value - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/tools_webrtc/configure_pipewire.py b/tools_webrtc/configure_pipewire.py new file mode 100644 index 0000000..79f8acc --- /dev/null +++ b/tools_webrtc/configure_pipewire.py
@@ -0,0 +1,72 @@ +#!/usr/bin/env vpython3 +# Copyright (c) 2022 The WebRTC project authors. All Rights Reserved. +# +# Use of this source code is governed by a BSD-style license +# that can be found in the LICENSE file in the root of the source +# tree. An additional intellectual property rights grant can be found +# in the file PATENTS. All contributing project authors may +# be found in the AUTHORS file in the root of the source tree. +""" +This script is a wrapper that loads "pipewire" library. +""" + +import os +import subprocess +import sys + +_SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) +_SRC_DIR = os.path.dirname(_SCRIPT_DIR) + + +def _GetPipeWireDir(): + pipewire_dir = os.path.join(_SRC_DIR, 'third_party', 'pipewire', + 'linux-amd64') + + if not os.path.isdir(pipewire_dir): + pipewire_dir = None + + return pipewire_dir + + +def _ConfigurePipeWirePaths(path): + library_dir = os.path.join(path, 'lib64') + pipewire_binary_dir = os.path.join(path, 'bin') + pipewire_config_prefix = os.path.join(path, 'share', 'pipewire') + pipewire_module_dir = os.path.join(library_dir, 'pipewire-0.3') + spa_plugin_dir = os.path.join(library_dir, 'spa-0.2') + media_session_config_dir = os.path.join(pipewire_config_prefix, + 'media-session.d') + + env_vars = os.environ + env_vars['LD_LIBRARY_PATH'] = library_dir + env_vars['PIPEWIRE_CONFIG_PREFIX'] = pipewire_config_prefix + env_vars['PIPEWIRE_MODULE_DIR'] = pipewire_module_dir + env_vars['SPA_PLUGIN_DIR'] = spa_plugin_dir + env_vars['MEDIA_SESSION_CONFIG_DIR'] = media_session_config_dir + env_vars['PIPEWIRE_RUNTIME_DIR'] = '/tmp' + env_vars['PATH'] = env_vars['PATH'] + ':' + pipewire_binary_dir + + +def main(): + pipewire_dir = _GetPipeWireDir() + + if pipewire_dir is None: + print('configure-pipewire: Couldn\'t find directory %s' % pipewire_dir) + return 1 + + _ConfigurePipeWirePaths(pipewire_dir) + + pipewire_process = subprocess.Popen(["pipewire"], stdout=None) + pipewire_media_session_process = subprocess.Popen(["pipewire-media-session"], + stdout=None) + + return_value = subprocess.call(sys.argv[1:]) + + pipewire_media_session_process.terminate() + pipewire_process.terminate() + + return return_value + + +if __name__ == '__main__': + sys.exit(main())
diff --git a/tools_webrtc/mb/mb.py b/tools_webrtc/mb/mb.py index 620a0c1..07cb14c 100755 --- a/tools_webrtc/mb/mb.py +++ b/tools_webrtc/mb/mb.py
@@ -102,6 +102,9 @@ vpython_exe, '../../tools_webrtc/ensure_webcam_is_running.py' ] extra_files.append('../../tools_webrtc/ensure_webcam_is_running.py') + if isolate_map[target].get('use_pipewire', False): + cmdline += [vpython_exe, '../../tools_webrtc/configure_pipewire.py'] + extra_files.append('../../tools_webrtc/configure_pipewire.py') # is_linux uses use_ozone and x11 by default. use_x11 = is_linux