Просмотр исходного кода

Fixes removeTrack from previous commit

dev1
hristoterezov 9 лет назад
Родитель
Сommit
24a9158838
1 измененных файлов: 17 добавлений и 9 удалений
  1. 17
    9
      modules/xmpp/JingleSessionPC.js

+ 17
- 9
modules/xmpp/JingleSessionPC.js Просмотреть файл

@@ -916,6 +916,7 @@ JingleSessionPC.prototype._modifySources = function (successCallback, queueCallb
916 916
  * stream.
917 917
  * @param dontModifySources {boolean} if true _modifySources won't be called.
918 918
  * Used for streams added before the call start.
919
+ * @throws error if modifySourcesQueue is paused.
919 920
  */
920 921
 JingleSessionPC.prototype.addStream = function (stream, callback, ssrcInfo,
921 922
     dontModifySources) {
@@ -984,6 +985,7 @@ JingleSessionPC.prototype.generateNewStreamSSRCInfo = function () {
984 985
  * @param success_callback callback executed after successful stream addition.
985 986
  * @param ssrcInfo object with information about the SSRCs associated with the
986 987
  * stream.
988
+ * @throws error if modifySourcesQueue is paused.
987 989
  */
988 990
 JingleSessionPC.prototype.removeStream = function (stream, callback, ssrcInfo) {
989 991
     // Conference is not active
@@ -1004,13 +1006,6 @@ JingleSessionPC.prototype.removeStream = function (stream, callback, ssrcInfo) {
1004 1006
         return;
1005 1007
     }
1006 1008
 
1007
-    if(this.modifySourcesQueue.paused) {
1008
-        // if this.modifySourcesQueue.paused, modifySources won't be called and
1009
-        // the SDPs won't be updated. Basically removeStream will fail. That's
1010
-        // why we are throwing the error to inform the callers of the method.
1011
-        throw new Error("modifySourcesQueue paused");
1012
-        return;
1013
-    }
1014 1009
     if (RTCBrowserType.getBrowserType() ===
1015 1010
             RTCBrowserType.RTC_BROWSER_FIREFOX) {
1016 1011
         if(!stream) {//There is nothing to be changed
@@ -1025,8 +1020,7 @@ JingleSessionPC.prototype.removeStream = function (stream, callback, ssrcInfo) {
1025 1020
         var track = null;
1026 1021
         if(stream.getAudioTracks() && stream.getAudioTracks().length) {
1027 1022
             track = stream.getAudioTracks()[0];
1028
-        } else if(stream.getVideoTracks() && stream.getVideoTracks().length)
1029
-        {
1023
+        } else if(stream.getVideoTracks() && stream.getVideoTracks().length) {
1030 1024
             track = stream.getVideoTracks()[0];
1031 1025
         }
1032 1026
 
@@ -1036,6 +1030,14 @@ JingleSessionPC.prototype.removeStream = function (stream, callback, ssrcInfo) {
1036 1030
             return;
1037 1031
         }
1038 1032
 
1033
+        if(this.modifySourcesQueue.paused) {
1034
+            // if this.modifySourcesQueue.paused, modifySources won't be called and
1035
+            // the SDPs won't be updated. Basically removeStream will fail. That's
1036
+            // why we are throwing the error to inform the callers of the method.
1037
+            throw new Error("modifySourcesQueue paused");
1038
+            return;
1039
+        }
1040
+
1039 1041
         // Find the right sender (for audio or video)
1040 1042
         this.peerconnection.peerconnection.getSenders().some(function (s) {
1041 1043
             if (s.track === track) {
@@ -1049,6 +1051,12 @@ JingleSessionPC.prototype.removeStream = function (stream, callback, ssrcInfo) {
1049 1051
         } else {
1050 1052
             logger.log("Cannot remove tracks: no RTPSender.");
1051 1053
         }
1054
+    } else if(this.modifySourcesQueue.paused) {
1055
+        // if this.modifySourcesQueue.paused, modifySources won't be called and
1056
+        // the SDPs won't be updated. Basically removeStream will fail. That's
1057
+        // why we are throwing the error to inform the callers of the method.
1058
+        throw new Error("modifySourcesQueue paused");
1059
+        return;
1052 1060
     } else if(stream)
1053 1061
         this.peerconnection.removeStream(stream, false, ssrcInfo);
1054 1062
     // else

Загрузка…
Отмена
Сохранить