浏览代码

Merge pull request #344 from jitsi/fix_share_when_muted

Fix crash on screensharing when video muted
dev1
bbaldino 8 年前
父节点
当前提交
d982537ff8
共有 2 个文件被更改,包括 30 次插入32 次删除
  1. 29
    27
      modules/xmpp/JingleSessionPC.js
  2. 1
    5
      modules/xmpp/TraceablePeerConnection.js

+ 29
- 27
modules/xmpp/JingleSessionPC.js 查看文件

35
     this.modifyingLocalStreams = false;
35
     this.modifyingLocalStreams = false;
36
     /**
36
     /**
37
      * Used to keep state about muted/unmuted video streams
37
      * Used to keep state about muted/unmuted video streams
38
-     *  so we can prevent errant source-add/source-removes 
38
+     *  so we can prevent errant source-add/source-removes
39
      *  from happening
39
      *  from happening
40
      */
40
      */
41
     this.modifiedSSRCs = {};
41
     this.modifiedSSRCs = {};
339
             });
339
             });
340
     };
340
     };
341
     this.modificationQueue.push(
341
     this.modificationQueue.push(
342
-        workFunction, 
342
+        workFunction,
343
         (error) => {
343
         (error) => {
344
             if (!error) {
344
             if (!error) {
345
                 success();
345
                 success();
562
 };
562
 };
563
 
563
 
564
 /**
564
 /**
565
- * Parse the information from the xml sourceAddElem and translate it 
565
+ * Parse the information from the xml sourceAddElem and translate it
566
  *  into sdp lines
566
  *  into sdp lines
567
- * @param {jquery xml element} sourceAddElem the source-add 
567
+ * @param {jquery xml element} sourceAddElem the source-add
568
  *  element from jingle
568
  *  element from jingle
569
- * @param {SDP object} currentRemoteSdp the current remote 
569
+ * @param {SDP object} currentRemoteSdp the current remote
570
  *  sdp (as of this new source-add)
570
  *  sdp (as of this new source-add)
571
- * @returns {list} a list of SDP line strings that should 
571
+ * @returns {list} a list of SDP line strings that should
572
  *  be added to the remote SDP
572
  *  be added to the remote SDP
573
  */
573
  */
574
 JingleSessionPC.prototype._parseSsrcInfoFromSourceAdd = function (sourceAddElem, currentRemoteSdp) {
574
 JingleSessionPC.prototype._parseSsrcInfoFromSourceAdd = function (sourceAddElem, currentRemoteSdp) {
726
 
726
 
727
 /**
727
 /**
728
  * Remove the given ssrc lines from the current remote sdp
728
  * Remove the given ssrc lines from the current remote sdp
729
- * @param {list} removeSsrcInfo a list of SDP line strings that 
729
+ * @param {list} removeSsrcInfo a list of SDP line strings that
730
  *  should be removed from the remote SDP
730
  *  should be removed from the remote SDP
731
- * @returns type {SDP Object} the new remote SDP (after removing the lines 
731
+ * @returns type {SDP Object} the new remote SDP (after removing the lines
732
  *  in removeSsrcInfo
732
  *  in removeSsrcInfo
733
  */
733
  */
734
 JingleSessionPC.prototype._processRemoteRemoveSource = function (removeSsrcInfo) {
734
 JingleSessionPC.prototype._processRemoteRemoveSource = function (removeSsrcInfo) {
747
 
747
 
748
 /**
748
 /**
749
  * Add the given ssrc lines to the current remote sdp
749
  * Add the given ssrc lines to the current remote sdp
750
- * @param {list} addSsrcInfo a list of SDP line strings that 
750
+ * @param {list} addSsrcInfo a list of SDP line strings that
751
  *  should be added to the remote SDP
751
  *  should be added to the remote SDP
752
- * @returns type {SDP Object} the new remote SDP (after removing the lines 
752
+ * @returns type {SDP Object} the new remote SDP (after removing the lines
753
  *  in removeSsrcInfo
753
  *  in removeSsrcInfo
754
  */
754
  */
755
 JingleSessionPC.prototype._processRemoteAddSource = function (addSsrcInfo) {
755
 JingleSessionPC.prototype._processRemoteAddSource = function (addSsrcInfo) {
764
 
764
 
765
 /**
765
 /**
766
  * Do a new o/a flow using the existing remote description
766
  * Do a new o/a flow using the existing remote description
767
- * @param {SDP object} optionalRemoteSdp optional remote sdp 
768
- *  to use.  If not provided, the remote sdp from the 
767
+ * @param {SDP object} optionalRemoteSdp optional remote sdp
768
+ *  to use.  If not provided, the remote sdp from the
769
  *  peerconnection will be used
769
  *  peerconnection will be used
770
  * @returns {Promise} promise which resolves when the
770
  * @returns {Promise} promise which resolves when the
771
  *  o/a flow is complete with no arguments or
771
  *  o/a flow is complete with no arguments or
818
                     media_constraints
818
                     media_constraints
819
                 );
819
                 );
820
             },
820
             },
821
-            (error) => { 
822
-                reject("setRemoteDescription failed: " + error); 
821
+            (error) => {
822
+                reject("setRemoteDescription failed: " + error);
823
             }
823
             }
824
         );
824
         );
825
     });
825
     });
832
  *  effectively just removes 'oldStream'
832
  *  effectively just removes 'oldStream'
833
  * @param oldStream the current stream in use to be replaced
833
  * @param oldStream the current stream in use to be replaced
834
  * @param newStream the new stream to use
834
  * @param newStream the new stream to use
835
- * @returns {Promise} which resolves once the replacement is complete 
835
+ * @returns {Promise} which resolves once the replacement is complete
836
  *  with no arguments or rejects with an error {string}
836
  *  with no arguments or rejects with an error {string}
837
  */
837
  */
838
 JingleSessionPC.prototype.replaceStream = function (oldStream, newStream) {
838
 JingleSessionPC.prototype.replaceStream = function (oldStream, newStream) {
866
 
866
 
867
 /**
867
 /**
868
  * Just add the stream to the peerconnection
868
  * Just add the stream to the peerconnection
869
- * @param stream either the low-level webrtc MediaStream or 
869
+ * @param stream either the low-level webrtc MediaStream or
870
  *  a Jitsi mediastream
870
  *  a Jitsi mediastream
871
  * NOTE: must be called within a work function being executed
871
  * NOTE: must be called within a work function being executed
872
  *  by the modification queue.
872
  *  by the modification queue.
879
 };
879
 };
880
 
880
 
881
 /**
881
 /**
882
- * Parse the information from the xml sourceRemoveElem and translate it 
882
+ * Parse the information from the xml sourceRemoveElem and translate it
883
  *  into sdp lines
883
  *  into sdp lines
884
- * @param {jquery xml element} sourceRemoveElem the source-remove 
884
+ * @param {jquery xml element} sourceRemoveElem the source-remove
885
  *  element from jingle
885
  *  element from jingle
886
- * @param {SDP object} currentRemoteSdp the current remote 
886
+ * @param {SDP object} currentRemoteSdp the current remote
887
  *  sdp (as of this new source-remove)
887
  *  sdp (as of this new source-remove)
888
- * @returns {list} a list of SDP line strings that should 
888
+ * @returns {list} a list of SDP line strings that should
889
  *  be removed from the remote SDP
889
  *  be removed from the remote SDP
890
  */
890
  */
891
 JingleSessionPC.prototype._parseSsrcInfoFromSourceRemove = function (sourceRemoveElem, currentRemoteSdp) {
891
 JingleSessionPC.prototype._parseSsrcInfoFromSourceRemove = function (sourceRemoveElem, currentRemoteSdp) {
938
  * Used for streams added before the call start.
938
  * Used for streams added before the call start.
939
  * NOTE(brian): there is a decent amount of overlap here with replaceStream that
939
  * NOTE(brian): there is a decent amount of overlap here with replaceStream that
940
  *  could be re-used...however we can't leverage that currently because the
940
  *  could be re-used...however we can't leverage that currently because the
941
- *  extra work we do here must be in the work function context and if we 
941
+ *  extra work we do here must be in the work function context and if we
942
  *  then called replaceStream we'd be adding another task on the queue
942
  *  then called replaceStream we'd be adding another task on the queue
943
  *  from within a task which would then deadlock.  The 'replaceStream' core
943
  *  from within a task which would then deadlock.  The 'replaceStream' core
944
  *  logic should be moved into a helper function that could be called within
944
  *  logic should be moved into a helper function that could be called within
946
  */
946
  */
947
 JingleSessionPC.prototype.addStream = function (stream, callback, errorCallback,
947
 JingleSessionPC.prototype.addStream = function (stream, callback, errorCallback,
948
     ssrcInfo, dontModifySources) {
948
     ssrcInfo, dontModifySources) {
949
-    
949
+
950
     let workFunction = (finishedCallback) => {
950
     let workFunction = (finishedCallback) => {
951
         if (!this.peerconnection) {
951
         if (!this.peerconnection) {
952
             finishedCallback("Error: tried adding stream with no active peer connection");
952
             finishedCallback("Error: tried adding stream with no active peer connection");
1043
  * NOTE: must be called within a work function being executed
1043
  * NOTE: must be called within a work function being executed
1044
  *  by the modification queue.
1044
  *  by the modification queue.
1045
  */
1045
  */
1046
-JingleSessionPC.prototype.removeStreamFromPeerConnection = function (stream, stopStream) {
1047
-    let actualStream = stream && stream.getOriginalStream ? stream.getOriginalStream() : stream;
1046
+JingleSessionPC.prototype.removeStreamFromPeerConnection = function (stream) {
1047
+    let actualStream
1048
+        = stream && stream.getOriginalStream
1049
+            ? stream.getOriginalStream() : stream;
1048
     if (!this.peerconnection) {
1050
     if (!this.peerconnection) {
1049
         return;
1051
         return;
1050
     }
1052
     }
1051
     if (RTCBrowserType.getBrowserType() ===
1053
     if (RTCBrowserType.getBrowserType() ===
1052
             RTCBrowserType.RTC_BROWSER_FIREFOX) {
1054
             RTCBrowserType.RTC_BROWSER_FIREFOX) {
1053
         this._handleFirefoxRemoveStream(actualStream);
1055
         this._handleFirefoxRemoveStream(actualStream);
1054
-    } else if (stream) {
1055
-        this.peerconnection.removeStream(actualStream, stopStream);
1056
+    } else if (actualStream) {
1057
+        this.peerconnection.removeStream(actualStream);
1056
     }
1058
     }
1057
 };
1059
 };
1058
 
1060
 
1075
                 RTCBrowserType.RTC_BROWSER_FIREFOX) {
1077
                 RTCBrowserType.RTC_BROWSER_FIREFOX) {
1076
             this._handleFirefoxRemoveStream(stream);
1078
             this._handleFirefoxRemoveStream(stream);
1077
         } else if (stream) {
1079
         } else if (stream) {
1078
-            this.removeStreamFromPeerConnection(stream, false);
1080
+            this.removeStreamFromPeerConnection(stream);
1079
         }
1081
         }
1080
         let oldSdp = new SDP(this.peerconnection.localDescription.sdp);
1082
         let oldSdp = new SDP(this.peerconnection.localDescription.sdp);
1081
         this._renegotiate()
1083
         this._renegotiate()

+ 1
- 5
modules/xmpp/TraceablePeerConnection.js 查看文件

2
 
2
 
3
 import { getLogger } from "jitsi-meet-logger";
3
 import { getLogger } from "jitsi-meet-logger";
4
 const logger = getLogger(__filename);
4
 const logger = getLogger(__filename);
5
-import RTC from '../RTC/RTC';
6
 import SdpConsistency from "./SdpConsistency.js";
5
 import SdpConsistency from "./SdpConsistency.js";
7
 var RTCBrowserType = require("../RTC/RTCBrowserType.js");
6
 var RTCBrowserType = require("../RTC/RTCBrowserType.js");
8
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
7
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
322
     }
321
     }
323
 };
322
 };
324
 
323
 
325
-TraceablePeerConnection.prototype.removeStream = function (stream, stopStreams) {
324
+TraceablePeerConnection.prototype.removeStream = function (stream) {
326
     this.trace('removeStream', stream.id);
325
     this.trace('removeStream', stream.id);
327
-    if (stopStreams) {
328
-        RTC.stopMediaStream(stream);
329
-    }
330
     // FF doesn't support this yet.
326
     // FF doesn't support this yet.
331
     if (this.peerconnection.removeStream) {
327
     if (this.peerconnection.removeStream) {
332
         this.peerconnection.removeStream(stream);
328
         this.peerconnection.removeStream(stream);

正在加载...
取消
保存