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

Simplify source-remove handling

Before the change we were constructing lines to be removed based on SSRC
parameters values supplied in the notification. We want the client to simply
remove all lines related to the SSRC being removed as sometimes things get
out of sync. For example when Chrome adds 'default' mslabel or when we'll be
doing lipsync stream merging.
dev1
paweldomas 9 лет назад
Родитель
Сommit
0c43c09e72
1 измененных файлов: 7 добавлений и 7 удалений
  1. 7
    7
      modules/xmpp/JingleSessionPC.js

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

@@ -783,6 +783,7 @@ JingleSessionPC.prototype.removeSource = function (elem) {
783 783
                 lines += 'a=ssrc-group:' + semantics + ' ' + ssrcs.join(' ') + '\r\n';
784 784
             }
785 785
         });
786
+        var ssrcs = [];
786 787
         var tmp = $(content).find('source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]'); // can handle both >source and >description>source
787 788
         tmp.each(function () {
788 789
             var ssrc = $(this).attr('ssrc');
@@ -791,18 +792,17 @@ JingleSessionPC.prototype.removeSource = function (elem) {
791 792
                 logger.error("Got remove stream request for my own ssrc: "+ssrc);
792 793
                 return;
793 794
             }
794
-            $(this).find('>parameter').each(function () {
795
-                lines += 'a=ssrc:' + ssrc + ' ' + $(this).attr('name');
796
-                if ($(this).attr('value') && $(this).attr('value').length)
797
-                    lines += ':' + $(this).attr('value');
798
-                lines += '\r\n';
799
-            });
795
+            ssrcs.push(ssrc);
800 796
         });
801 797
         sdp.media.forEach(function(media, idx) {
802 798
             if (!SDPUtil.find_line(media, 'a=mid:' + name))
803 799
                 return;
804
-            sdp.media[idx] += lines;
805 800
             if (!self.removessrc[idx]) self.removessrc[idx] = '';
801
+            ssrcs.forEach(function(ssrc) {
802
+                var ssrcLines = SDPUtil.find_lines(media, 'a=ssrc:' + ssrc);
803
+                if (ssrcLines.length)
804
+                    self.removessrc[idx] += ssrcLines.join("\r\n")+"\r\n";
805
+            });
806 806
             self.removessrc[idx] += lines;
807 807
         });
808 808
         sdp.raw = sdp.session + sdp.media.join('');

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