mirror of
https://github.com/pion/webrtc.git
synced 2025-12-24 11:51:03 +08:00
Use transceiver's codec in getCodecs
Issue: ------ A transceiver's codecs can be modified using `SetCodecPreferences`. When retrieving codecs from the transceiver after changing codec preferences of the transceiver (for example changing the SDPFmtpLine), the filter function was using codec from the media engine. Thus, the change from `SetCodecPreferences` is lost. Fix: ---- - When a match is found (either exact or partial), use the codec from the transceiver instead of media engine. - Based on feedback, add checks to ensure that PayloadType is not set incorrectly (i. e. set with a default of 0). If it is set to 0, use the PayloadType from the media engine, i. e. negotiated value. Testing: -------- - Modify SDPFmtpLine of a codec of a transceiver using `SetCodecPreferences` method of `RTPTransceiver`. - Invoke `GetParamters` of `RTPREceiver` and ensure that `Codecs` has the SDPFmtpLine modification. Before this change the change was not reflected in the returned `Codecs`. - Check that SDP has payload from codec set via SetCodecPreferences
This commit is contained in:
@@ -69,7 +69,10 @@ func (t *RTPTransceiver) getCodecs() []RTPCodecParameters {
|
||||
filteredCodecs := []RTPCodecParameters{}
|
||||
for _, codec := range t.codecs {
|
||||
if c, matchType := codecParametersFuzzySearch(codec, mediaEngineCodecs); matchType != codecMatchNone {
|
||||
filteredCodecs = append(filteredCodecs, c)
|
||||
if codec.PayloadType == 0 {
|
||||
codec.PayloadType = c.PayloadType
|
||||
}
|
||||
filteredCodecs = append(filteredCodecs, codec)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user