Disallow incompatible transceiver directions

This effectively reverts part of
https://github.com/pion/webrtc/pull/2412.

The answer was incorrect under the following conditions
- Answer side added a track, it created a new transceicer with Sendrecv
  direction.
- When the remote offer comes in later, SetRemoteDescription tries to
  find an existing tranceiver by type and direction. It ends up picking
  what was added above even if the remote side is using `sendonly`.
- That results in answer marking the section as `sendrecv` which is
  incompatible with the offer.
This commit is contained in:
boks1971
2025-08-22 00:17:54 +05:30
committed by Raja Subramanian
parent 2299a71701
commit 469ca2cf1b
2 changed files with 2 additions and 2 deletions

View File

@@ -1209,7 +1209,7 @@ func TestPeerConnection_TransceiverDirection(t *testing.T) {
"offer sendonly answer sendrecv",
RTPTransceiverDirectionSendonly,
RTPTransceiverDirectionSendrecv,
[]RTPTransceiverDirection{RTPTransceiverDirectionSendrecv},
[]RTPTransceiverDirection{RTPTransceiverDirectionSendrecv, RTPTransceiverDirectionRecvonly},
},
{
"offer recvonly answer sendrecv",

View File

@@ -277,7 +277,7 @@ func satisfyTypeAndDirection(
RTPTransceiverDirectionSendonly,
}
case RTPTransceiverDirectionSendonly:
return []RTPTransceiverDirection{RTPTransceiverDirectionRecvonly, RTPTransceiverDirectionSendrecv}
return []RTPTransceiverDirection{RTPTransceiverDirectionRecvonly}
case RTPTransceiverDirectionRecvonly:
return []RTPTransceiverDirection{RTPTransceiverDirectionSendonly, RTPTransceiverDirectionSendrecv}
default: