Populate SDP cid in track info when available. (#3845)

* Populate SDP cid in track info when available.

- Adding SDP cid to TrackInfo. Browsers like FF uses a different stream
  id for AddTrack and actual SDP offer. So, have to look up using both
  on server side. To make it easier, store both (only if different) in
  TrackInfo.
- Use a codec in TrackInfo for audio also. There is some discussion
  around doing simulcast codec for audio so that something like PSTN can
  use G.711 without any transcoding. So, just keep it consistent between
  audio and video.
- Populate SDP cid when SDP offer is received. It could populate a
  pending track or an already published track if the new offer is for a
  back up codec where the primary codec is already published.
- Passed around parsed offer to more places to avoid parsing multiple
  times.
- Clean up MediaTrack interface a bit and remove unneeded methods.

* WIP

* WIP

* deps

* stream allocator mime aware

* clean up

* populate SDP cid before munging

* interface methods
This commit is contained in:
Raja Subramanian
2025-08-13 10:53:16 +05:30
committed by GitHub
parent eed27885e5
commit fa5f4ef33c
34 changed files with 503 additions and 1051 deletions
+35
View File
@@ -81,6 +81,41 @@ func (m MimeTypeCodec) String() string {
return "MimeTypeCodecUnknown"
}
func (m MimeTypeCodec) ToMimeType() MimeType {
switch m {
case MimeTypeCodecUnknown:
return MimeTypeUnknown
case MimeTypeCodecH264:
return MimeTypeH264
case MimeTypeCodecH265:
return MimeTypeH265
case MimeTypeCodecOpus:
return MimeTypeOpus
case MimeTypeCodecRED:
return MimeTypeRED
case MimeTypeCodecVP8:
return MimeTypeVP8
case MimeTypeCodecVP9:
return MimeTypeVP9
case MimeTypeCodecAV1:
return MimeTypeAV1
case MimeTypeCodecG722:
return MimeTypeG722
case MimeTypeCodecPCMU:
return MimeTypePCMU
case MimeTypeCodecPCMA:
return MimeTypePCMA
case MimeTypeCodecRTX:
return MimeTypeRTX
case MimeTypeCodecFlexFEC:
return MimeTypeFlexFEC
case MimeTypeCodecULPFEC:
return MimeTypeULPFEC
}
return MimeTypeUnknown
}
func NormalizeMimeTypeCodec(codec string) MimeTypeCodec {
switch {
case strings.EqualFold(codec, "h264"):