瀏覽代碼

Modify error handling for missing video m-lines and local description (#632)

* ref(sdp): lower logs about missing local video to warning

* ref(sdp): earlier error handling for missing description and mlines

* ref(sdp): rename maybeMungeLocalSdp to be more specific
dev1
virtuacoplenny 8 年之前
父節點
當前提交
6a5d1dd822

+ 3
- 2
modules/RTC/LocalSdpMunger.js 查看文件

@@ -55,7 +55,7 @@ export default class LocalSdpMunger {
55 55
         const videoMLine = transformer.selectMedia('video');
56 56
 
57 57
         if (!videoMLine) {
58
-            logger.error(
58
+            logger.debug(
59 59
                 `${this.tpc} unable to hack local video track SDP`
60 60
                     + '- no "video" media');
61 61
 
@@ -167,8 +167,9 @@ export default class LocalSdpMunger {
167 167
      *
168 168
      * @param {object} desc the WebRTC SDP object instance for the local
169 169
      * description.
170
+     * @returns {RTCSessionDescription}
170 171
      */
171
-    maybeMungeLocalSdp(desc) {
172
+    maybeAddMutedLocalVideoTracksToSDP(desc) {
172 173
         if (!desc || !(desc instanceof RTCSessionDescription)) {
173 174
             throw new Error('Incorrect type, expected RTCSessionDescription');
174 175
         }

+ 9
- 3
modules/RTC/TraceablePeerConnection.js 查看文件

@@ -1173,10 +1173,16 @@ const getters = {
1173 1173
     localDescription() {
1174 1174
         let desc = this.peerconnection.localDescription;
1175 1175
 
1176
+        if (!desc) {
1177
+            logger.debug('getLocalDescription no localDescription found');
1178
+
1179
+            return {};
1180
+        }
1181
+
1176 1182
         this.trace('getLocalDescription::preTransform', dumpSDP(desc));
1177 1183
 
1178 1184
         // if we're running on FF, transform to Plan B first.
1179
-        if (desc && RTCBrowserType.usesUnifiedPlan()) {
1185
+        if (RTCBrowserType.usesUnifiedPlan()) {
1180 1186
             desc = this.interop.toPlanB(desc);
1181 1187
             this.trace('getLocalDescription::postTransform (Plan B)',
1182 1188
                 dumpSDP(desc));
@@ -1187,7 +1193,7 @@ const getters = {
1187 1193
         }
1188 1194
 
1189 1195
         if (RTCBrowserType.doesVideoMuteByStreamRemove()) {
1190
-            desc = this.localSdpMunger.maybeMungeLocalSdp(desc);
1196
+            desc = this.localSdpMunger.maybeAddMutedLocalVideoTracksToSDP(desc);
1191 1197
             logger.debug(
1192 1198
                 'getLocalDescription::postTransform (munge local SDP)', desc);
1193 1199
         }
@@ -1202,7 +1208,7 @@ const getters = {
1202 1208
         // happening (check setLocalDescription impl).
1203 1209
         desc = enforceSendRecv(desc);
1204 1210
 
1205
-        return desc || {};
1211
+        return desc;
1206 1212
     },
1207 1213
     remoteDescription() {
1208 1214
         let desc = this.peerconnection.remoteDescription;

+ 2
- 2
modules/xmpp/RtxModifier.js 查看文件

@@ -116,7 +116,7 @@ export default class RtxModifier {
116 116
         const videoMLine = sdpTransformer.selectMedia('video');
117 117
 
118 118
         if (!videoMLine) {
119
-            logger.error(`No 'video' media found in the sdp: ${sdpStr}`);
119
+            logger.debug(`No 'video' media found in the sdp: ${sdpStr}`);
120 120
 
121 121
             return sdpStr;
122 122
         }
@@ -205,7 +205,7 @@ export default class RtxModifier {
205 205
         const videoMLine = sdpTransformer.selectMedia('video');
206 206
 
207 207
         if (!videoMLine) {
208
-            logger.error(`No 'video' media found in the sdp: ${sdpStr}`);
208
+            logger.debug(`No 'video' media found in the sdp: ${sdpStr}`);
209 209
 
210 210
             return sdpStr;
211 211
         }

+ 2
- 2
modules/xmpp/SDPUtil.js 查看文件

@@ -573,7 +573,7 @@ const SDPUtil = {
573 573
     preferVideoCodec(videoMLine, codecName) {
574 574
         let payloadType = null;
575 575
 
576
-        if (!codecName) {
576
+        if (!videoMLine || !codecName) {
577 577
             return;
578 578
         }
579 579
 
@@ -613,7 +613,7 @@ const SDPUtil = {
613 613
      * @param {string} codecName the name of the codec which will be stripped.
614 614
      */
615 615
     stripVideoCodec(videoMLine, codecName) {
616
-        if (!codecName) {
616
+        if (!videoMLine || !codecName) {
617 617
             return;
618 618
         }
619 619
 

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

@@ -76,7 +76,7 @@ export default class SdpConsistency {
76 76
         const videoMLine = sdpTransformer.selectMedia('video');
77 77
 
78 78
         if (!videoMLine) {
79
-            logger.error(
79
+            logger.debug(
80 80
                 `${this.logPrefix} no 'video' media found in the sdp: `
81 81
                     + `${sdpStr}`);
82 82
 

Loading…
取消
儲存