Quellcode durchsuchen

Merge pull request #344 from jitsi/fix_share_when_muted

Fix crash on screensharing when video muted
dev1
bbaldino vor 8 Jahren
Ursprung
Commit
d982537ff8
2 geänderte Dateien mit 30 neuen und 32 gelöschten Zeilen
  1. 29
    27
      modules/xmpp/JingleSessionPC.js
  2. 1
    5
      modules/xmpp/TraceablePeerConnection.js

+ 29
- 27
modules/xmpp/JingleSessionPC.js Datei anzeigen

@@ -35,7 +35,7 @@ function JingleSessionPC(me, sid, peerjid, connection,
35 35
     this.modifyingLocalStreams = false;
36 36
     /**
37 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 39
      *  from happening
40 40
      */
41 41
     this.modifiedSSRCs = {};
@@ -339,7 +339,7 @@ JingleSessionPC.prototype.setOfferCycle = function (jingleOfferIq,
339 339
             });
340 340
     };
341 341
     this.modificationQueue.push(
342
-        workFunction, 
342
+        workFunction,
343 343
         (error) => {
344 344
             if (!error) {
345 345
                 success();
@@ -562,13 +562,13 @@ JingleSessionPC.prototype.onTerminated = function (reasonCondition,
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 566
  *  into sdp lines
567
- * @param {jquery xml element} sourceAddElem the source-add 
567
+ * @param {jquery xml element} sourceAddElem the source-add
568 568
  *  element from jingle
569
- * @param {SDP object} currentRemoteSdp the current remote 
569
+ * @param {SDP object} currentRemoteSdp the current remote
570 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 572
  *  be added to the remote SDP
573 573
  */
574 574
 JingleSessionPC.prototype._parseSsrcInfoFromSourceAdd = function (sourceAddElem, currentRemoteSdp) {
@@ -726,9 +726,9 @@ JingleSessionPC.prototype._processNewJingleOfferIq = function(offerIq) {
726 726
 
727 727
 /**
728 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 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 732
  *  in removeSsrcInfo
733 733
  */
734 734
 JingleSessionPC.prototype._processRemoteRemoveSource = function (removeSsrcInfo) {
@@ -747,9 +747,9 @@ JingleSessionPC.prototype._processRemoteRemoveSource = function (removeSsrcInfo)
747 747
 
748 748
 /**
749 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 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 753
  *  in removeSsrcInfo
754 754
  */
755 755
 JingleSessionPC.prototype._processRemoteAddSource = function (addSsrcInfo) {
@@ -764,8 +764,8 @@ JingleSessionPC.prototype._processRemoteAddSource = function (addSsrcInfo) {
764 764
 
765 765
 /**
766 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 769
  *  peerconnection will be used
770 770
  * @returns {Promise} promise which resolves when the
771 771
  *  o/a flow is complete with no arguments or
@@ -818,8 +818,8 @@ JingleSessionPC.prototype._renegotiate = function(optionalRemoteSdp) {
818 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,7 +832,7 @@ JingleSessionPC.prototype._renegotiate = function(optionalRemoteSdp) {
832 832
  *  effectively just removes 'oldStream'
833 833
  * @param oldStream the current stream in use to be replaced
834 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 836
  *  with no arguments or rejects with an error {string}
837 837
  */
838 838
 JingleSessionPC.prototype.replaceStream = function (oldStream, newStream) {
@@ -866,7 +866,7 @@ JingleSessionPC.prototype.replaceStream = function (oldStream, newStream) {
866 866
 
867 867
 /**
868 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 870
  *  a Jitsi mediastream
871 871
  * NOTE: must be called within a work function being executed
872 872
  *  by the modification queue.
@@ -879,13 +879,13 @@ JingleSessionPC.prototype.addStreamToPeerConnection = function (stream, ssrcInfo
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 883
  *  into sdp lines
884
- * @param {jquery xml element} sourceRemoveElem the source-remove 
884
+ * @param {jquery xml element} sourceRemoveElem the source-remove
885 885
  *  element from jingle
886
- * @param {SDP object} currentRemoteSdp the current remote 
886
+ * @param {SDP object} currentRemoteSdp the current remote
887 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 889
  *  be removed from the remote SDP
890 890
  */
891 891
 JingleSessionPC.prototype._parseSsrcInfoFromSourceRemove = function (sourceRemoveElem, currentRemoteSdp) {
@@ -938,7 +938,7 @@ JingleSessionPC.prototype._parseSsrcInfoFromSourceRemove = function (sourceRemov
938 938
  * Used for streams added before the call start.
939 939
  * NOTE(brian): there is a decent amount of overlap here with replaceStream that
940 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 942
  *  then called replaceStream we'd be adding another task on the queue
943 943
  *  from within a task which would then deadlock.  The 'replaceStream' core
944 944
  *  logic should be moved into a helper function that could be called within
@@ -946,7 +946,7 @@ JingleSessionPC.prototype._parseSsrcInfoFromSourceRemove = function (sourceRemov
946 946
  */
947 947
 JingleSessionPC.prototype.addStream = function (stream, callback, errorCallback,
948 948
     ssrcInfo, dontModifySources) {
949
-    
949
+
950 950
     let workFunction = (finishedCallback) => {
951 951
         if (!this.peerconnection) {
952 952
             finishedCallback("Error: tried adding stream with no active peer connection");
@@ -1043,16 +1043,18 @@ JingleSessionPC.prototype._handleFirefoxRemoveStream = function (stream) {
1043 1043
  * NOTE: must be called within a work function being executed
1044 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 1050
     if (!this.peerconnection) {
1049 1051
         return;
1050 1052
     }
1051 1053
     if (RTCBrowserType.getBrowserType() ===
1052 1054
             RTCBrowserType.RTC_BROWSER_FIREFOX) {
1053 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,7 +1077,7 @@ JingleSessionPC.prototype.removeStream = function (stream, callback, errorCallba
1075 1077
                 RTCBrowserType.RTC_BROWSER_FIREFOX) {
1076 1078
             this._handleFirefoxRemoveStream(stream);
1077 1079
         } else if (stream) {
1078
-            this.removeStreamFromPeerConnection(stream, false);
1080
+            this.removeStreamFromPeerConnection(stream);
1079 1081
         }
1080 1082
         let oldSdp = new SDP(this.peerconnection.localDescription.sdp);
1081 1083
         this._renegotiate()

+ 1
- 5
modules/xmpp/TraceablePeerConnection.js Datei anzeigen

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

Laden…
Abbrechen
Speichern