Skip to content

Commit

Permalink
feat: explicitly model ssrc and ssrc groups in avmediadescription (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaldino committed Oct 20, 2022
1 parent 89cce93 commit 061b693
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions src/model/av-media-description.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
Setup,
SetupLine,
SimulcastLine,
SsrcGroupLine,
SsrcLine,
} from '../lines';
import { CodecInfo } from './codec-info';
import { MediaDescription } from './media-description';
Expand All @@ -36,6 +38,10 @@ export class AvMediaDescription extends MediaDescription {

rtcpMux = false;

ssrcs: Array<SsrcLine> = [];

ssrcGroups: Array<SsrcGroupLine> = [];

/**
* Create a MediaInfo instance from a MediaLine.
*
Expand Down Expand Up @@ -94,6 +100,9 @@ export class AvMediaDescription extends MediaDescription {
}
this.codecs.forEach((codec) => lines.push(...codec.toLines()));

lines.push(...this.ssrcs);
lines.push(...this.ssrcGroups);

lines.push(...this.otherLines);

return lines;
Expand Down Expand Up @@ -138,6 +147,14 @@ export class AvMediaDescription extends MediaDescription {
codec.addLine(line);
return true;
}
if (line instanceof SsrcLine) {
this.ssrcs.push(line);
return true;
}
if (line instanceof SsrcGroupLine) {
this.ssrcGroups.push(line);
return true;
}
this.otherLines.push(line);
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/sdp-corpus/ordering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ a=rtpmap:110 telephone-event/48000\r
a=rtpmap:112 telephone-event/32000\r
a=rtpmap:113 telephone-event/16000\r
a=rtpmap:126 telephone-event/8000\r
a=rtcp:9 IN IP4 0.0.0.0\r
a=msid:- a8a17466-0c31-4198-bbd1-20fb6ca2fac6\r
a=ssrc:4013544331 cname:OfAxmTLksFb12Jj3\r
a=ssrc:4013544331 msid:- a8a17466-0c31-4198-bbd1-20fb6ca2fac6\r
a=ssrc:4013544331 mslabel:-\r
a=ssrc:4013544331 label:a8a17466-0c31-4198-bbd1-20fb6ca2fac6\r
a=rtcp:9 IN IP4 0.0.0.0\r
a=msid:- a8a17466-0c31-4198-bbd1-20fb6ca2fac6\r
`;

0 comments on commit 061b693

Please sign in to comment.