diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2023-03-18 03:17:02 +0100 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2023-03-22 14:08:00 +0100 |
commit | cfd4cb03ec964e461d665c05c75cb3f5363d4a3b (patch) | |
tree | 62a833ea879f69f0a64e6edbe1f0d0dedc33e974 /recording | |
parent | 0b5e7eea0c3a88e73361b701296d06892980b769 (diff) |
Provide explicit name for the audio sink
Rather than providing some values and then composing the final name from
them now the sink name is explicitly provided.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'recording')
-rw-r--r-- | recording/src/nextcloud/talk/recording/Service.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/recording/src/nextcloud/talk/recording/Service.py b/recording/src/nextcloud/talk/recording/Service.py index 8489c9044..94d1088e6 100644 --- a/recording/src/nextcloud/talk/recording/Service.py +++ b/recording/src/nextcloud/talk/recording/Service.py @@ -76,7 +76,7 @@ def getRecorderArgs(status, displayId, audioSinkIndex, width, height, extensionl return ffmpegArgs + [outputFileName] -def newAudioSink(sanitizedBackend, token): +def newAudioSink(baseSinkName): """ Start new audio sink for the audio output of the browser. @@ -87,16 +87,15 @@ def newAudioSink(sanitizedBackend, token): The sink is created by loading a null sink module. This module needs to be unloaded once the sink is no longer needed to remove it. - :param sanitizedBackend: the backend of the call; it is expected to have - been sanitized and to contain only alpha-numeric characters. - :param token: the token of the call. + :param baseSinkName: the base name for the sink; it is expected to have been + sanitized and to contain only alpha-numeric characters. :return: a tuple with the module index and the sink index, both as ints. """ - # A random value is appended to the backend and token to "ensure" that there - # will be no name clashes if a previous sink for that backend and module was - # not unloaded yet. - sinkName = f"{sanitizedBackend}-{token}-{token_urlsafe(32)}" + # A random value is appended to the base sink name to "ensure" that there + # will be no name clashes if a previous sink with that base name was not + # unloaded yet. + sinkName = f"{baseSinkName}-{token_urlsafe(32)}" # Module names can be, at most, 127 characters, so the name is truncated if # needed. @@ -220,7 +219,7 @@ class Service: raise Exception("Display started after recording was stopped") # Start new audio sink for the audio output of the browser. - self._audioModuleIndex, audioSinkIndex = newAudioSink(sanitizedBackend, self.token) + self._audioModuleIndex, audioSinkIndex = newAudioSink(f"{sanitizedBackend}-{self.token}") audioSinkIndex = str(audioSinkIndex) if self._stopped.is_set(): |