Index: webrtc/api/peerconnection.cc |
diff --git a/webrtc/api/peerconnection.cc b/webrtc/api/peerconnection.cc |
index 506a21582f7ae0ce6f4dffa34497ac72b4dc14ee..11a5e094e4b26e3931570c3ea23fdac7bd1c4ba5 100644 |
--- a/webrtc/api/peerconnection.cc |
+++ b/webrtc/api/peerconnection.cc |
@@ -1149,7 +1149,11 @@ void PeerConnection::SetRemoteDescription( |
for (size_t i = 0; i < new_streams->count(); ++i) { |
MediaStreamInterface* new_stream = new_streams->at(i); |
stats_->AddStream(new_stream); |
+ // Call both the raw pointer and scoped_refptr versions of the method |
+ // for compatibility. |
observer_->OnAddStream(new_stream); |
+ observer_->OnAddStream( |
+ rtc::scoped_refptr<MediaStreamInterface>(new_stream)); |
} |
UpdateEndedRemoteMediaStreams(); |
@@ -1711,9 +1715,12 @@ void PeerConnection::UpdateEndedRemoteMediaStreams() { |
} |
} |
- for (const auto& stream : streams_to_remove) { |
+ for (auto& stream : streams_to_remove) { |
remote_streams_->RemoveStream(stream); |
- observer_->OnRemoveStream(stream); |
+ // Call both the raw pointer and scoped_refptr versions of the method |
+ // for compatibility. |
+ observer_->OnRemoveStream(stream.get()); |
+ observer_->OnRemoveStream(std::move(stream)); |
} |
} |
@@ -1884,8 +1891,11 @@ void PeerConnection::CreateRemoteRtpDataChannel(const std::string& label, |
return; |
} |
channel->SetReceiveSsrc(remote_ssrc); |
- observer_->OnDataChannel( |
- DataChannelProxy::Create(signaling_thread(), channel)); |
+ auto proxy_channel = DataChannelProxy::Create(signaling_thread(), channel); |
+ // Call both the raw pointer and scoped_refptr versions of the method |
+ // for compatibility. |
+ observer_->OnDataChannel(proxy_channel.get()); |
+ observer_->OnDataChannel(std::move(proxy_channel)); |
} |
rtc::scoped_refptr<DataChannel> PeerConnection::InternalCreateDataChannel( |
@@ -2015,8 +2025,11 @@ void PeerConnection::OnDataChannelOpenMessage( |
return; |
} |
- observer_->OnDataChannel( |
- DataChannelProxy::Create(signaling_thread(), channel)); |
+ auto proxy_channel = DataChannelProxy::Create(signaling_thread(), channel); |
+ // Call both the raw pointer and scoped_refptr versions of the method |
+ // for compatibility. |
+ observer_->OnDataChannel(proxy_channel.get()); |
+ observer_->OnDataChannel(std::move(proxy_channel)); |
} |
RtpSenderInterface* PeerConnection::FindSenderById(const std::string& id) { |