Close precreated tracks if we never add them

As the log line says, this should never happen, but if it does we
still shouldn't leak tracks.
This commit is contained in:
David Baker
2023-11-10 11:18:20 +00:00
parent daf6e677d6
commit e4e721818a

View File

@@ -87,6 +87,9 @@ async function doConnect(
logger.warn( logger.warn(
"Publishing pre-created audio track but participant already appears to have an microphone track: this shouldn't happen!", "Publishing pre-created audio track but participant already appears to have an microphone track: this shouldn't happen!",
); );
for (const t of audioTracks) {
t.stop();
}
return; return;
} }
logger.info("Publishing pre-created mic track"); logger.info("Publishing pre-created mic track");