Skip to content

Commit e36599f

Browse files
committed
Merge branch 'release/2.6.3' into webrtc-stack-upgrade
2 parents ffa0983 + ddb5475 commit e36599f

File tree

2 files changed

+43
-9
lines changed

2 files changed

+43
-9
lines changed

src/main/webapp/js/media_manager.js

+17-8
Original file line numberDiff line numberDiff line change
@@ -928,11 +928,15 @@ export class MediaManager {
928928
updateLocalAudioStream(stream, onEndedCallback) {
929929
var newAudioTrack = stream.getAudioTracks()[0];
930930

931-
if (this.localStream != null && this.localStream.getAudioTracks()[0] != null) {
931+
if (this.localStream != null && this.localStream.getAudioTracks()[0] != null)
932+
{
932933
var audioTrack = this.localStream.getAudioTracks()[0];
933-
this.localStream.removeTrack(audioTrack);
934-
audioTrack.stop();
935-
this.localStream.addTrack(newAudioTrack);
934+
if (audioTrack != newAudioTrack)
935+
{
936+
this.localStream.removeTrack(audioTrack);
937+
audioTrack.stop();
938+
this.localStream.addTrack(newAudioTrack);
939+
}
936940
} else if (this.localStream != null) {
937941
this.localStream.addTrack(newAudioTrack);
938942
} else {
@@ -972,11 +976,16 @@ export class MediaManager {
972976

973977
var newVideoTrack = stream.getVideoTracks()[0];
974978

975-
if (this.localStream != null && this.localStream.getVideoTracks()[0] != null) {
979+
if (this.localStream != null && this.localStream.getVideoTracks()[0] != null )
980+
{
976981
var videoTrack = this.localStream.getVideoTracks()[0];
977-
this.localStream.removeTrack(videoTrack);
978-
videoTrack.stop();
979-
this.localStream.addTrack(newVideoTrack);
982+
983+
if (videoTrack != newVideoTrack)
984+
{
985+
this.localStream.removeTrack(videoTrack);
986+
videoTrack.stop();
987+
this.localStream.addTrack(newVideoTrack);
988+
}
980989
} else if (this.localStream != null) {
981990
this.localStream.addTrack(newVideoTrack);
982991
} else {

src/test/js/test/webrtc_adaptor.test.js

+26-1
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,36 @@ describe("WebRTCAdaptor", function() {
398398
stream.addTrack(audioTrack);
399399

400400
await adaptor.updateAudioTrack(stream, null, null);
401+
});
402+
403+
it.only("testSoundMeter", function(done) {
404+
405+
406+
var adaptor = new WebRTCAdaptor({
407+
websocketURL: "ws://localhost",
408+
mediaConstraints: {
409+
video: true,
410+
audio: true
411+
},
412+
initializeComponents: false
413+
});
401414

415+
adaptor.initialize().then(() => {
416+
audioLevelCalled = false;
417+
audioLevel = 0;
418+
adaptor.enableAudioLevelForLocalStream((level) => {
419+
console.log(level);
420+
if (level > 0) {
421+
done();
422+
}
423+
});
424+
425+
expect(adaptor.mediaManager.localStreamSoundMeter).to.not.be.null;
426+
})
402427

403428

404429

405-
});
430+
})
406431

407432

408433
});

0 commit comments

Comments
 (0)