You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2020/06/13 07:36:19 UTC

[openmeetings] branch master updated: [OPENMEETINGS-2395] video clean-up is improved

This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git


The following commit(s) were added to refs/heads/master by this push:
     new cb5abf3  [OPENMEETINGS-2395] video clean-up is improved
cb5abf3 is described below

commit cb5abf3253559247bb9c3e88157dd210bb6e5383
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Sat Jun 13 14:36:03 2020 +0700

    [OPENMEETINGS-2395] video clean-up is improved
---
 .../org/apache/openmeetings/web/room/raw-video.js  | 33 +++++++++++++---------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-video.js b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-video.js
index 129928d..e5f6988 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-video.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-video.js
@@ -71,6 +71,9 @@ var Video = (function() {
 			}
 			navigator.mediaDevices.getUserMedia(cnts)
 				.then(function(stream) {
+					if (msg.instanceUid !== v.data('instance-uid')) {
+						return;
+					}
 					let _stream = stream;
 					const data = {};
 					if (stream.getAudioTracks().length !== 0) {
@@ -151,10 +154,10 @@ var Video = (function() {
 		data.rtcPeer = new kurentoUtils.WebRtcPeer.WebRtcPeerSendonly(
 			VideoUtil.addIceServers(options, msg)
 			, function (error) {
+				if (true === this.cleaned) {
+					return;
+				}
 				if (error) {
-					if (true === this.cleaned) {
-						return;
-					}
 					return OmUtil.error(error);
 				}
 				if (data.analyser) {
@@ -162,10 +165,10 @@ var Video = (function() {
 					level.meter(data.analyser, lm, _micActivity, OmUtil.error);
 				}
 				this.generateOffer(function(error, offerSdp) {
+					if (true === this.cleaned) {
+						return;
+					}
 					if (error) {
-						if (true === this.cleaned) {
-							return;
-						}
 						return OmUtil.error('Sender sdp offer error ' + error);
 					}
 					OmUtil.log('Invoking Sender SDP offer callback function');
@@ -201,17 +204,17 @@ var Video = (function() {
 		data.rtcPeer = new kurentoUtils.WebRtcPeer.WebRtcPeerRecvonly(
 			options
 			, function(error) {
+				if (true === this.cleaned) {
+					return;
+				}
 				if (error) {
-					if (true === this.cleaned) {
-						return;
-					}
 					return OmUtil.error(error);
 				}
 				this.generateOffer(function(error, offerSdp) {
+					if (true === this.cleaned) {
+						return;
+					}
 					if (error) {
-						if (true === this.cleaned) {
-							return;
-						}
 						return OmUtil.error('Receiver sdp offer error ' + error);
 					}
 					OmUtil.log('Invoking Receiver SDP offer callback function');
@@ -238,7 +241,7 @@ var Video = (function() {
 			t.removeClass('mic-on');
 		}
 	}
-	function _initContainer(_id, name, opts) {
+	function _initContainer(_id, name, opts, instanceUid) {
 		let contSel = '#user' + sd.cuid;
 		const _hasVideo = VideoUtil.hasVideo(sd)
 		size = {width: _hasVideo ? sd.width : 120, height: _hasVideo ? sd.height : 90};
@@ -258,6 +261,7 @@ var Video = (function() {
 				.attr('title', name)
 				.attr('data-client-uid', sd.cuid)
 				.attr('data-client-type', sd.type)
+				.attr('data-instance-uid', instanceUid)
 				.data(self));
 		v = $('#' + _id);
 		vc = v.find('.video');
@@ -322,6 +326,7 @@ var Video = (function() {
 	}
 	function _init(msg) {
 		sd = msg.stream;
+		msg.instanceUid = uuidv4();
 		if (!vol) {
 			vol = Volume();
 		}
@@ -335,7 +340,7 @@ var Video = (function() {
 			, _h = sd.height
 			, opts = Room.getOptions();
 		sd.self = sd.cuid === opts.uid;
-		const contSel = _initContainer(_id, name, opts);
+		const contSel = _initContainer(_id, name, opts, msg.instanceUid);
 		footer = v.find('.footer');
 		if (!opts.showMicStatus) {
 			footer.hide();