Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/flexfec03-codec-parameters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"github.com/livekit/protocol": patch
"@livekit/protocol": patch
---

Add flexfec-03 codec parameters and mime type helpers
14 changes: 14 additions & 0 deletions codecs/codecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,18 @@ var (
PayloadType: 116,
}

FlexFEC03CodecParameters = webrtc.RTPCodecParameters{
RTPCodecCapability: webrtc.RTPCodecCapability{
MimeType: mime.MimeTypeFlexFEC03.String(),
ClockRate: 90000,
SDPFmtpLine: "repair-window=10000000",
RTCPFeedback: []webrtc.RTCPFeedback{
{Type: webrtc.TypeRTCPFBTransportCC},
},
},
PayloadType: 115,
}

VideoCodecsParameters = []webrtc.RTPCodecParameters{
VP8CodecParameters,
VP9ProfileId0CodecParameters,
Expand Down Expand Up @@ -245,6 +257,8 @@ func ToWebrtcCodecParameters(codec *livekit.Codec) webrtc.RTPCodecParameters {
}
case mime.MimeTypeH265:
params = H265CodecParameters
case mime.MimeTypeFlexFEC03:
params = FlexFEC03CodecParameters
default:
return webrtc.RTPCodecParameters{}
}
Expand Down
18 changes: 18 additions & 0 deletions codecs/mime/mimetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const (
MimeTypeCodecRTX
MimeTypeCodecFlexFEC
MimeTypeCodecULPFEC
MimeTypeCodecFlexFEC03
)

func (m MimeTypeCodec) String() string {
Expand Down Expand Up @@ -76,6 +77,8 @@ func (m MimeTypeCodec) String() string {
return "flexfec"
case MimeTypeCodecULPFEC:
return "ulpfec"
case MimeTypeCodecFlexFEC03:
return "flexfec-03"
}

return "MimeTypeCodecUnknown"
Expand Down Expand Up @@ -111,6 +114,8 @@ func (m MimeTypeCodec) ToMimeType() MimeType {
return MimeTypeFlexFEC
case MimeTypeCodecULPFEC:
return MimeTypeULPFEC
case MimeTypeCodecFlexFEC03:
return MimeTypeFlexFEC03
}

return MimeTypeUnknown
Expand Down Expand Up @@ -144,6 +149,8 @@ func NormalizeMimeTypeCodec(codec string) MimeTypeCodec {
return MimeTypeCodecFlexFEC
case strings.EqualFold(codec, "ulpfec"):
return MimeTypeCodecULPFEC
case strings.EqualFold(codec, "flexfec-03"):
return MimeTypeCodecFlexFEC03
}

return MimeTypeCodecUnknown
Expand Down Expand Up @@ -195,6 +202,7 @@ const (
MimeTypeRTX
MimeTypeFlexFEC
MimeTypeULPFEC
MimeTypeFlexFEC03
)

func (m MimeType) String() string {
Expand Down Expand Up @@ -227,6 +235,8 @@ func (m MimeType) String() string {
return webrtc.MimeTypeFlexFEC
case MimeTypeULPFEC:
return "video/ulpfec"
case MimeTypeFlexFEC03:
return webrtc.MimeTypeFlexFEC03
}

return "MimeTypeUnknown"
Expand Down Expand Up @@ -262,6 +272,8 @@ func (m MimeType) ReporterType() roomobs.MimeType {
return roomobs.MimeTypeVideoFlexfec
case MimeTypeULPFEC:
return roomobs.MimeTypeVideoUlpfec
case MimeTypeFlexFEC03:
return roomobs.MimeTypeVideoFlexfec03
}

return roomobs.MimeTypeUndefined
Expand Down Expand Up @@ -295,6 +307,8 @@ func NormalizeMimeType(mime string) MimeType {
return MimeTypeFlexFEC
case strings.EqualFold(mime, "video/ulpfec"):
return MimeTypeULPFEC
case strings.EqualFold(mime, webrtc.MimeTypeFlexFEC03):
return MimeTypeFlexFEC03
}

return MimeTypeUnknown
Expand Down Expand Up @@ -363,3 +377,7 @@ func IsMimeTypeStringVP9(mime string) bool {
func IsMimeTypeStringH264(mime string) bool {
return NormalizeMimeType(mime) == MimeTypeH264
}

func IsMimeTypeStringFlexFEC03(mime string) bool {
return NormalizeMimeType(mime) == MimeTypeFlexFEC03
}
Loading