Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: webrtc/api/peerconnection.cc

Issue 1972793003: Use scoped_refptr for On(Add|Remove)Stream and OnDataChannel. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Adding "deprecated" comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698