Fire OnRenegotiationNeeded when changing transceiver direction
This is specified by the WebRTC specification:
https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction
Bug: webrtc:7600
Change-Id: If45ba0383e5040d250cd3c1c2525ff3b03b1eb4f
Reviewed-on: https://webrtc-review.googlesource.com/55880
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22139}
diff --git a/pc/peerconnection.cc b/pc/peerconnection.cc
index 3b2f71c..211c3d6 100644
--- a/pc/peerconnection.cc
+++ b/pc/peerconnection.cc
@@ -1157,9 +1157,11 @@
auto transceiver = FindFirstTransceiverForAddedTrack(track);
if (transceiver) {
if (transceiver->direction() == RtpTransceiverDirection::kRecvOnly) {
- transceiver->SetDirection(RtpTransceiverDirection::kSendRecv);
+ transceiver->internal()->set_direction(
+ RtpTransceiverDirection::kSendRecv);
} else if (transceiver->direction() == RtpTransceiverDirection::kInactive) {
- transceiver->SetDirection(RtpTransceiverDirection::kSendOnly);
+ transceiver->internal()->set_direction(
+ RtpTransceiverDirection::kSendOnly);
}
transceiver->sender()->SetTrack(track);
transceiver->internal()->sender_internal()->set_stream_ids(stream_labels);
@@ -1172,7 +1174,7 @@
auto receiver = CreateReceiver(media_type, rtc::CreateRandomUuid());
transceiver = CreateAndAddTransceiver(sender, receiver);
transceiver->internal()->set_created_by_addtrack(true);
- transceiver->SetDirection(RtpTransceiverDirection::kSendRecv);
+ transceiver->internal()->set_direction(RtpTransceiverDirection::kSendRecv);
}
return transceiver->sender();
}
@@ -1214,9 +1216,11 @@
}
sender->SetTrack(nullptr);
if (transceiver->direction() == RtpTransceiverDirection::kSendRecv) {
- transceiver->internal()->SetDirection(RtpTransceiverDirection::kRecvOnly);
+ transceiver->internal()->set_direction(
+ RtpTransceiverDirection::kRecvOnly);
} else if (transceiver->direction() == RtpTransceiverDirection::kSendOnly) {
- transceiver->internal()->SetDirection(RtpTransceiverDirection::kInactive);
+ transceiver->internal()->set_direction(
+ RtpTransceiverDirection::kInactive);
}
} else {
bool removed;
@@ -1390,9 +1394,17 @@
auto transceiver = RtpTransceiverProxyWithInternal<RtpTransceiver>::Create(
signaling_thread(), new RtpTransceiver(sender, receiver));
transceivers_.push_back(transceiver);
+ transceiver->internal()->SignalNegotiationNeeded.connect(
+ this, &PeerConnection::OnNegotiationNeeded);
return transceiver;
}
+void PeerConnection::OnNegotiationNeeded() {
+ RTC_DCHECK_RUN_ON(signaling_thread());
+ RTC_DCHECK(!IsClosed());
+ observer_->OnRenegotiationNeeded();
+}
+
rtc::scoped_refptr<DtmfSenderInterface> PeerConnection::CreateDtmfSender(
AudioTrackInterface* track) {
TRACE_EVENT0("webrtc", "PeerConnection::CreateDtmfSender");