Skip to content

Commit

Permalink
RtpParameters: enrich RtpParameters types (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmillan authored Oct 31, 2023
1 parent b856a84 commit f606098
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
20 changes: 18 additions & 2 deletions src/RtpParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export type RtpHeaderExtension =
/*
* The URI of the RTP header extension, as defined in RFC 5285.
*/
uri: string;
uri: RtpHeaderExtensionUri;
/**
* The preferred numeric identifier that goes in the RTP packet. Must be
* unique.
Expand Down Expand Up @@ -271,6 +271,22 @@ export type RtpEncodingParameters =
networkPriority?: 'very-low' | 'low' | 'medium' | 'high';
};

/**
* Supported RTP header extension URIs.
*/
export type RtpHeaderExtensionUri =
'urn:ietf:params:rtp-hdrext:sdes:mid' |
'urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id' |
'urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id' |
'http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07' |
'urn:ietf:params:rtp-hdrext:framemarking' |
'urn:ietf:params:rtp-hdrext:ssrc-audio-level' |
'urn:3gpp:video-orientation' |
'urn:ietf:params:rtp-hdrext:toffset' |
'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01' |
'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time' |
'http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time';

/**
* Defines a RTP header extension within the RTP parameters. The list of RTP
* header extensions supported by mediasoup is defined in the
Expand All @@ -284,7 +300,7 @@ export type RtpHeaderExtensionParameters =
/**
* The URI of the RTP header extension, as defined in RFC 5285.
*/
uri: string;
uri: RtpHeaderExtensionUri;
/**
* The numeric identifier that goes in the RTP packet. Must be unique.
*/
Expand Down
8 changes: 7 additions & 1 deletion src/Transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ export type DtlsParameters =
fingerprints: DtlsFingerprint[];
};

/**
* The hash function algorithm (as defined in the "Hash function Textual Names"
* registry initially specified in RFC 4572 Section 8).
*/
export type FingerprintAlgorithm = 'sha-1'| 'sha-224'| 'sha-256'| 'sha-384'| 'sha-512';

/**
* The hash function algorithm (as defined in the "Hash function Textual Names"
* registry initially specified in RFC 4572 Section 8) and its corresponding
Expand All @@ -106,7 +112,7 @@ export type DtlsParameters =
*/
export type DtlsFingerprint =
{
algorithm: string;
algorithm: FingerprintAlgorithm;
value: string;
};

Expand Down
3 changes: 3 additions & 0 deletions src/tests/fakeParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,16 +294,19 @@ export function generateNativeRtpCapabilities(): mediasoupClient.types.RtpCapabi
},
{
kind : 'video',
// @ts-ignore
uri : 'http://www.webrtc.org/experiments/rtp-hdrext/playout-delay',
preferredId : 6
},
{
kind : 'video',
// @ts-ignore
uri : 'http://www.webrtc.org/experiments/rtp-hdrext/video-content-type',
preferredId : 7
},
{
kind : 'video',
// @ts-ignore
uri : 'http://www.webrtc.org/experiments/rtp-hdrext/video-timing',
preferredId : 8
},
Expand Down

0 comments on commit f606098

Please sign in to comment.