Skip to content

Commit

Permalink
Merge pull request #4008 from globaleaks/fix-audio-processing-leak
Browse files Browse the repository at this point in the history
fixed audio processing leak by closing the stream after processing
  • Loading branch information
evilaliv3 committed Feb 28, 2024
2 parents 14dd2b5 + d5caa4c commit 2080d57
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/app/js/controllers/fileupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ controller("AudioUploadCtrl", ["$scope", "flowFactory", "Utils", "mediaProcessor
let mediaRecorder = null;
let flow = null;
let secondsTracker = null;
let context;

$scope.seconds = 0;
$scope.activeButton = null;
Expand Down Expand Up @@ -145,7 +146,7 @@ controller("AudioUploadCtrl", ["$scope", "flowFactory", "Utils", "mediaProcessor

await mediaProcessor.enableNoiseSuppression(stream);

var context = new AudioContext();
context = new AudioContext();
var mediaStreamDestination = new MediaStreamAudioDestinationNode(context);
const source = context.createMediaStreamSource(stream);
const anonymization_filter = new anonymizeSpeaker(context);
Expand Down Expand Up @@ -193,6 +194,9 @@ controller("AudioUploadCtrl", ["$scope", "flowFactory", "Utils", "mediaProcessor
if (mediaRecorder && (mediaRecorder.state === "recording" || mediaRecorder.state === "paused")) {
mediaRecorder.stop();
}
if (context) {
context.close();
}
};

$scope.deleteRecording = function () {
Expand Down

0 comments on commit 2080d57

Please sign in to comment.