瀏覽代碼

feat(ts) add hand-crafted types for red

dev1
Jorge Oliveira 2 年之前
父節點
當前提交
6af2df42c9
共有 1 個文件被更改,包括 41 次插入0 次删除
  1. 41
    0
      types/hand-crafted/modules/red/red.d.ts

+ 41
- 0
types/hand-crafted/modules/red/red.d.ts 查看文件

@@ -0,0 +1,41 @@
1
+// https://github.com/Microsoft/TypeScript/blob/main/src/lib/webworker.generated.d.ts
2
+interface RTCEncodedAudioFrameMetadata {
3
+    contributingSources?: number[];
4
+    synchronizationSource?: number;
5
+}
6
+interface RTCEncodedAudioFrame {
7
+    data: ArrayBuffer;
8
+    readonly timestamp: number;
9
+    getMetadata(): RTCEncodedAudioFrameMetadata;
10
+}
11
+/**
12
+ * An encoder for RFC 2198 redundancy using WebRTC Insertable Streams.
13
+ */
14
+export class RFC2198Encoder {
15
+    /**
16
+     * @param {Number} targetRedundancy the desired amount of redundancy.
17
+     */
18
+    constructor(targetRedundancy?: number);
19
+    targetRedundancy: number;
20
+    frameBuffer: any[];
21
+    payloadType: number;
22
+    /**
23
+     * Set the desired level of redudancy. 4 means "four redundant frames plus current frame.
24
+     * It is possible to reduce this to 0 to minimize the overhead to one byte.
25
+     * @param {Number} targetRedundancy the desired amount of redundancy.
26
+     */
27
+    setRedundancy(targetRedundancy: number): void;
28
+    /**
29
+     * Set the "inner opus payload type". This is typically our RED payload type that we tell
30
+     * the other side as our opus payload type. Can be queried from the sender using getParameters()
31
+     * after setting the answer.
32
+     * @param {Number} payloadType the payload type to use for opus.
33
+     */
34
+    setPayloadType(payloadType: number): void;
35
+    /**
36
+     * This is the actual transform to add redundancy to a raw opus frame.
37
+     * @param {RTCEncodedAudioFrame} encodedFrame - Encoded audio frame.
38
+     * @param {TransformStreamDefaultController} controller - TransportStreamController.
39
+     */
40
+    addRedundancy(encodedFrame: RTCEncodedAudioFrame, controller: TransformStreamDefaultController): void;
41
+}

Loading…
取消
儲存