Case-insensitive media subtype check

Updates mediaengine according to [1] and [2].

[1] https://tools.ietf.org/html/rfc4855#section-3
[2] https://tools.ietf.org/html/rfc4288#section-4.2
This commit is contained in:
Luke S
2020-01-21 14:36:10 -05:00
committed by Sean DuBois
parent d265906d6f
commit 20f2d1899e
3 changed files with 8 additions and 6 deletions

View File

@@ -135,6 +135,7 @@ Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contribu
* [Lukas Herman](https://github.com/lherman-cs) * [Lukas Herman](https://github.com/lherman-cs)
* [Konstantin Chugalinskiy](https://github.com/kchugalinskiy) * [Konstantin Chugalinskiy](https://github.com/kchugalinskiy)
* [Bao Nguyen](https://github.com/sysbot) * [Bao Nguyen](https://github.com/sysbot)
* [Luke S](https://github.com/encounter)
### License ### License
MIT License - see [LICENSE](LICENSE) for full text MIT License - see [LICENSE](LICENSE) for full text

View File

@@ -77,7 +77,8 @@ func (m *MediaEngine) PopulateFromSDP(sd SessionDescription) error {
var codec *RTPCodec var codec *RTPCodec
clockRate := payloadCodec.ClockRate clockRate := payloadCodec.ClockRate
parameters := payloadCodec.Fmtp parameters := payloadCodec.Fmtp
switch payloadCodec.Name { codecName := strings.ToUpper(payloadCodec.Name)
switch codecName {
case PCMU: case PCMU:
codec = NewRTPPCMUCodec(payloadType, clockRate) codec = NewRTPPCMUCodec(payloadType, clockRate)
case PCMA: case PCMA:
@@ -143,7 +144,7 @@ const (
PCMU = "PCMU" PCMU = "PCMU"
PCMA = "PCMA" PCMA = "PCMA"
G722 = "G722" G722 = "G722"
Opus = "opus" Opus = "OPUS"
VP8 = "VP8" VP8 = "VP8"
VP9 = "VP9" VP9 = "VP9"
H264 = "H264" H264 = "H264"

View File

@@ -87,8 +87,8 @@ a=sctpmap:5000 webrtc-datachannel 1024
m.RegisterDefaultCodecs() m.RegisterDefaultCodecs()
assert.NoError(t, m.PopulateFromSDP(SessionDescription{SDP: sdpValue})) assert.NoError(t, m.PopulateFromSDP(SessionDescription{SDP: sdpValue}))
assertCodecWithPayloadType("opus", 111) assertCodecWithPayloadType(Opus, 111)
assertCodecWithPayloadType("VP8", 105) assertCodecWithPayloadType(VP8, 105)
assertCodecWithPayloadType("H264", 115) assertCodecWithPayloadType(H264, 115)
assertCodecWithPayloadType("VP9", 135) assertCodecWithPayloadType(VP9, 135)
} }