From 6e217d240a3ff6713000b2c8177b998bbc33ffa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20M=C3=BCnchow?= Date: Mon, 22 Jul 2019 21:37:42 +0200 Subject: [PATCH] [@types/sdp-transform] fix incorrect types (#36891) * added missing arrays, and made some fields in candidates optional. * fixed "Definitions by" --- types/sdp-transform/index.d.ts | 22 +++++++++++----------- types/sdp-transform/sdp-transform-tests.ts | 6 ++++++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/types/sdp-transform/index.d.ts b/types/sdp-transform/index.d.ts index 3219fe9957..8b10216a67 100644 --- a/types/sdp-transform/index.d.ts +++ b/types/sdp-transform/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for sdp-transform 2.4 // Project: https://github.com/clux/sdp-transform#readme -// Definitions by: @loc +// Definitions by: @loc , @muenchow // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // https://tools.ietf.org/html/rfc4566 @@ -81,12 +81,12 @@ export interface SharedAttributes { // a=control control?: string; // a=extmap - ext?: { + ext?: Array<{ value: number; direction?: string; uri: string; config?: string; - }; + }>; // a=setup setup?: string; @@ -134,12 +134,12 @@ export interface SessionAttributes extends SharedAttributes { * https://www.iana.org/assignments/sdp-parameters/sdp-parameters.xhtml#sdp-parameters-9 */ export interface MediaAttributes extends SharedAttributes { - rtp?: { + rtp: Array<{ payload: number; codec: string; rate?: number; encoding?: number; - }; + }>; rtcp?: { port: number; netType?: string; @@ -158,10 +158,10 @@ export interface MediaAttributes extends SharedAttributes { value: number; }; // a=fmtp - fmtp?: { + fmtp: Array<{ payload: number; config: string; - }; + }>; // a=mid mid?: string; // a=msid @@ -185,10 +185,10 @@ export interface MediaAttributes extends SharedAttributes { ip: string; port: number; type: string; - raddr: string; - rport: number; - tcptype: string; - generation: number; + raddr?: string; + rport?: number; + tcptype?: string; + generation?: number; 'network-id'?: number; 'network-cost'?: number; }>; diff --git a/types/sdp-transform/sdp-transform-tests.ts b/types/sdp-transform/sdp-transform-tests.ts index 4b60e84a5a..fce4ecc26d 100644 --- a/types/sdp-transform/sdp-transform-tests.ts +++ b/types/sdp-transform/sdp-transform-tests.ts @@ -7,4 +7,10 @@ import { const session: SessionDescription = parse(''); const mediaType: string = session.media[0].type; session.media[0].type = 'video'; +const extension: string = session.media[0].ext![0].uri; +session.media[0].ext![0].uri = 'urn:ietf:params:rtp-hdrext:ssrc-audio-level'; +const codec: string = session.media[0].rtp[0].codec; +session.media[0].rtp[0].codec = 'opus'; +const config: string = session.media[0].fmtp[0].config; +session.media[0].fmtp[0].config = 'maxplaybackrate=48000;stereo=1;useinbandfec=1'; const sdp: string = write(session);