Skip to content

Commit fbb9051

Browse files
author
Sean DuBois
committed
Revert "Fixes MediaEngine: codec apt negotiation"
This reverts commit eeb67e1.
1 parent b6ca48e commit fbb9051

File tree

2 files changed

+3
-47
lines changed

2 files changed

+3
-47
lines changed

mediaengine.go

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ func (m *MediaEngine) collectStats(collector *statsReportCollector) {
334334
}
335335

336336
// Look up a codec and enable if it exists
337-
func (m *MediaEngine) matchRemoteCodec(remoteCodec RTPCodecParameters, typ RTPCodecType, exactMatches, partialMatches []RTPCodecParameters) (codecMatchType, error) {
337+
func (m *MediaEngine) matchRemoteCodec(remoteCodec RTPCodecParameters, typ RTPCodecType) (codecMatchType, error) {
338338
codecs := m.videoCodecs
339339
if typ == RTPCodecTypeAudio {
340340
codecs = m.audioCodecs
@@ -347,24 +347,7 @@ func (m *MediaEngine) matchRemoteCodec(remoteCodec RTPCodecParameters, typ RTPCo
347347
return codecMatchNone, err
348348
}
349349

350-
var aptFound bool
351-
for _, codec := range exactMatches {
352-
if codec.PayloadType == PayloadType(payloadType) {
353-
aptFound = true
354-
break
355-
}
356-
}
357-
358-
if !aptFound {
359-
for _, codec := range partialMatches {
360-
if codec.PayloadType == PayloadType(payloadType) {
361-
aptFound = true
362-
break
363-
}
364-
}
365-
}
366-
367-
if !aptFound {
350+
if _, _, err = m.getCodecByPayload(PayloadType(payloadType)); err != nil {
368351
return codecMatchNone, nil // not an error, we just ignore this codec we don't support
369352
}
370353
}
@@ -433,7 +416,7 @@ func (m *MediaEngine) updateFromRemoteDescription(desc sdp.SessionDescription) e
433416
partialMatches := make([]RTPCodecParameters, 0, len(codecs))
434417

435418
for _, codec := range codecs {
436-
matchType, mErr := m.matchRemoteCodec(codec, typ, exactMatches, partialMatches)
419+
matchType, mErr := m.matchRemoteCodec(codec, typ)
437420
if mErr != nil {
438421
return mErr
439422
}

mediaengine_test.go

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -280,33 +280,6 @@ a=rtpmap:96 VP8/90000
280280
_, _, err := m.getCodecByPayload(96)
281281
assert.NoError(t, err)
282282
})
283-
284-
t.Run("Matches when rtx apt exists", func(t *testing.T) {
285-
const profileLevels = `v=0
286-
o=- 4596489990601351948 2 IN IP4 127.0.0.1
287-
s=-
288-
t=0 0
289-
m=video 60323 UDP/TLS/RTP/SAVPF 96 97
290-
a=rtpmap:96 VP8/90000
291-
a=rtpmap:97 rtx/90000
292-
a=fmtp:97 apt=96
293-
`
294-
m := MediaEngine{}
295-
assert.NoError(t, m.RegisterCodec(RTPCodecParameters{
296-
RTPCodecCapability: RTPCodecCapability{MimeTypeVP8, 90000, 0, "", nil},
297-
PayloadType: 96,
298-
}, RTPCodecTypeVideo))
299-
assert.NoError(t, m.RegisterCodec(RTPCodecParameters{
300-
RTPCodecCapability: RTPCodecCapability{"video/rtx", 90000, 0, "apt=96", nil},
301-
PayloadType: 97,
302-
}, RTPCodecTypeVideo))
303-
assert.NoError(t, m.updateFromRemoteDescription(mustParse(profileLevels)))
304-
305-
assert.True(t, m.negotiatedVideo)
306-
307-
_, _, err := m.getCodecByPayload(97)
308-
assert.NoError(t, err)
309-
})
310283
}
311284

312285
func TestMediaEngineHeaderExtensionDirection(t *testing.T) {

0 commit comments

Comments
 (0)