浏览代码

e2ee: decode static black frame for decryption errors (#1098)

similar to #1095 use a black keyframe instead of displaying a potentially
unencrypted stream. This was again captured with a modified version of
the webrtc sample, additional logging and a resolution of 320x180
dev1
Philipp Hancke 5 年前
父节点
当前提交
101fecbb24
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 12 次插入2 次删除
  1. 12
    2
      modules/e2ee/E2EEContext.js

+ 12
- 2
modules/e2ee/E2EEContext.js 查看文件

335
 
335
 
336
                     newUint8.set([ 0xd8, 0xff, 0xfe ]); // opus silence frame.
336
                     newUint8.set([ 0xd8, 0xff, 0xfe ]); // opus silence frame.
337
                     encodedFrame.data = newData;
337
                     encodedFrame.data = newData;
338
+                } else { // video, replace with a 320x180px black frame
339
+                    const newData = new ArrayBuffer(60);
340
+                    const newUint8 = new Uint8Array(newData);
341
+
342
+                    newUint8.set([
343
+                        0xb0, 0x05, 0x00, 0x9d, 0x01, 0x2a, 0xa0, 0x00, 0x5a, 0x00, 0x39, 0x03, 0x00, 0x00, 0x1c, 0x22,
344
+                        0x16, 0x16, 0x22, 0x66, 0x12, 0x20, 0x04, 0x90, 0x40, 0x00, 0xc5, 0x01, 0xe0, 0x7c, 0x4d, 0x2f,
345
+                        0xfa, 0xdd, 0x4d, 0xa5, 0x7f, 0x89, 0xa5, 0xff, 0x5b, 0xa9, 0xb4, 0xaf, 0xf1, 0x34, 0xbf, 0xeb,
346
+                        0x75, 0x36, 0x95, 0xfe, 0x26, 0x96, 0x60, 0xfe, 0xff, 0xba, 0xff, 0x40
347
+                    ]);
348
+                    encodedFrame.data = newData;
338
                 }
349
                 }
339
 
350
 
340
-                // Just feed the (potentially encrypted) frame in case of error.
341
-                // Worst case it is garbage.
351
+                // TODO: notify the application about error status.
342
                 controller.enqueue(encodedFrame);
352
                 controller.enqueue(encodedFrame);
343
             });
353
             });
344
         }
354
         }

正在加载...
取消
保存