@@ -334,7 +334,7 @@ func (m *MediaEngine) collectStats(collector *statsReportCollector) {
334
334
}
335
335
336
336
// 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 ) {
338
338
codecs := m .videoCodecs
339
339
if typ == RTPCodecTypeAudio {
340
340
codecs = m .audioCodecs
@@ -347,24 +347,7 @@ func (m *MediaEngine) matchRemoteCodec(remoteCodec RTPCodecParameters, typ RTPCo
347
347
return codecMatchNone , err
348
348
}
349
349
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 {
368
351
return codecMatchNone , nil // not an error, we just ignore this codec we don't support
369
352
}
370
353
}
@@ -433,7 +416,7 @@ func (m *MediaEngine) updateFromRemoteDescription(desc sdp.SessionDescription) e
433
416
partialMatches := make ([]RTPCodecParameters , 0 , len (codecs ))
434
417
435
418
for _ , codec := range codecs {
436
- matchType , mErr := m .matchRemoteCodec (codec , typ , exactMatches , partialMatches )
419
+ matchType , mErr := m .matchRemoteCodec (codec , typ )
437
420
if mErr != nil {
438
421
return mErr
439
422
}
0 commit comments