Commit 53a0b614 authored by Kelly Guo's avatar Kelly Guo Committed by Kelly Guo

Fixes livestream mixing with sys.argv for command line arguments (#223)

Previously, additional arguments were added to command line for
initializing livestream extensions. These arguments were mistakenly
passed to downstream scripts, causing errors when the arguments are not
recognized. This fix makes sure that the additional arguments are only
passed to the kit app and not downstream apps.

- Bug fix (non-breaking change which fixes an issue)

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [ ] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->
parent ca13a749
...@@ -575,14 +575,14 @@ class AppLauncher: ...@@ -575,14 +575,14 @@ class AppLauncher:
) )
# Process livestream here before launching kit because some of the extensions only work when launched with the kit file # Process livestream here before launching kit because some of the extensions only work when launched with the kit file
self._livestream_args = []
if self._livestream >= 1: if self._livestream >= 1:
livestream_args = []
# Note: Only one livestream extension can be enabled at a time # Note: Only one livestream extension can be enabled at a time
if self._livestream == 1: if self._livestream == 1:
warnings.warn( warnings.warn(
"Native Livestream is deprecated. Please use WebRTC Livestream instead with --livestream 2." "Native Livestream is deprecated. Please use WebRTC Livestream instead with --livestream 2."
) )
livestream_args += [ self._livestream_args += [
'--/app/livestream/proto="ws"', '--/app/livestream/proto="ws"',
"--/app/livestream/allowResize=true", "--/app/livestream/allowResize=true",
"--enable", "--enable",
...@@ -593,14 +593,14 @@ class AppLauncher: ...@@ -593,14 +593,14 @@ class AppLauncher:
"omni.kit.streamsdk.plugins-4.1.1", "omni.kit.streamsdk.plugins-4.1.1",
] ]
elif self._livestream == 2: elif self._livestream == 2:
livestream_args += [ self._livestream_args += [
"--/app/livestream/allowResize=false", "--/app/livestream/allowResize=false",
"--enable", "--enable",
"omni.kit.livestream.webrtc", "omni.kit.livestream.webrtc",
] ]
else: else:
raise ValueError(f"Invalid value for livestream: {self._livestream}. Expected: 1, 2 .") raise ValueError(f"Invalid value for livestream: {self._livestream}. Expected: 1, 2 .")
sys.argv += livestream_args sys.argv += self._livestream_args
# Resolve additional arguments passed to Kit # Resolve additional arguments passed to Kit
self._kit_args = [] self._kit_args = []
...@@ -648,6 +648,8 @@ class AppLauncher: ...@@ -648,6 +648,8 @@ class AppLauncher:
# remove additional OV args from sys.argv # remove additional OV args from sys.argv
if len(self._kit_args) > 0: if len(self._kit_args) > 0:
sys.argv = [arg for arg in sys.argv if arg not in self._kit_args] sys.argv = [arg for arg in sys.argv if arg not in self._kit_args]
if len(self._livestream_args) > 0:
sys.argv = [arg for arg in sys.argv if arg not in self._livestream_args]
def _rendering_enabled(self) -> bool: def _rendering_enabled(self) -> bool:
"""Check if rendering is required by the app.""" """Check if rendering is required by the app."""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment