Skip to content

Commit 0dbc78d

Browse files
author
Steven Vancoillie
committed
fix: correct wrong SDP types
1 parent 89bc369 commit 0dbc78d

File tree

1 file changed

+23
-32
lines changed

1 file changed

+23
-32
lines changed

lib/utils/protocols/sdp.ts

+23-32
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
1-
import { Session } from 'inspector'
21
import { MessageType, SdpMessage } from '../../components/message'
32
import { NtpSeconds, seconds } from './ntp'
43

4+
interface ConnectionField {
5+
// c=<nettype> <addrtype> <connection-address>
6+
networkType: 'IN'
7+
addressType: 'IP4' | 'IP6'
8+
connectionAddress: string
9+
}
10+
11+
interface BandwidthField {
12+
readonly type: string
13+
readonly value: number
14+
}
15+
16+
// RTSP extensions: https://tools.ietf.org/html/rfc7826 (22.15)
17+
// exists on both session and media level
18+
interface RtspExtensions {
19+
readonly range?: string
20+
readonly control?: string
21+
readonly mtag?: string
22+
}
23+
524
/**
625
* The session description protocol (SDP).
726
*
@@ -36,7 +55,7 @@ import { NtpSeconds, seconds } from './ntp'
3655
* Names of the fields below are annotated above with
3756
* the names used in Appendix A: SDP Grammar of RFC 2327.
3857
*/
39-
export interface SessionDescription {
58+
export interface SessionDescription extends RtspExtensions {
4059
// v=0
4160
readonly version: 0
4261
// o=<username> <sess-id> <sess-version> <nettype> <addrtype> <unicast-address>
@@ -58,10 +77,6 @@ export interface SessionDescription {
5877
// One or more time descriptions
5978
readonly time: TimeDescription
6079
readonly repeatTimes?: RepeatTimeDescription
61-
// RTSP attributes
62-
readonly range?: string
63-
readonly control?: string
64-
readonly mtag?: string
6580
// Zero or more media descriptions
6681
readonly media: MediaDescription[]
6782
}
@@ -76,26 +91,6 @@ interface OriginField {
7691
address: string
7792
}
7893

79-
interface ConnectionField {
80-
// c=<nettype> <addrtype> <connection-address>
81-
networkType: 'IN'
82-
addressType: 'IP4' | 'IP6'
83-
connectionAddress: string
84-
}
85-
86-
interface BandwidthField {
87-
readonly type: string
88-
readonly value: number
89-
}
90-
91-
// RTSP extensions: https://tools.ietf.org/html/rfc7826 (22.15)
92-
// exists on both session and media level
93-
interface RtspExtensions {
94-
readonly range?: string
95-
readonly control?: string
96-
readonly mtag?: string
97-
}
98-
9994
/**
10095
* Time description
10196
*
@@ -130,7 +125,7 @@ export interface RepeatTimeDescription {
130125
* can be multiple fmt values with corresponding rtpmap
131126
* attributes)
132127
*/
133-
export interface MediaDescription {
128+
export interface MediaDescription extends RtspExtensions {
134129
// m=<media> <port> <proto> <fmt> ...
135130
// m=<media> <port>/<number of ports> <proto> <fmt> ...
136131
readonly type: 'audio' | 'video' | 'application' | 'data' | 'control'
@@ -143,10 +138,6 @@ export interface MediaDescription {
143138
* Any remaining attributes
144139
* a=...
145140
*/
146-
// RTSP attributes
147-
readonly range?: string
148-
readonly control?: string
149-
readonly mtag?: string
150141
// a=rtpmap:<payload type> <encoding name>/<clock rate> [/<encoding parameters>]
151142
readonly rtpmap?: {
152143
readonly clockrate: number
@@ -214,7 +205,7 @@ export interface AACMedia extends AudioMedia {
214205
}
215206

216207
export interface Sdp {
217-
readonly session: Session
208+
readonly session: SessionDescription
218209
readonly media: MediaDescription[]
219210
}
220211

0 commit comments

Comments
 (0)