Modify the parameter type of PeerConnectionObserver callback OnAddTrack.
Change the second parameter type to a const reference of vector so that
the vector will not be copied.
BUG=none
Review-Url: https://codereview.webrtc.org/2551603003
Cr-Commit-Position: refs/heads/master@{#15396}
diff --git a/webrtc/api/peerconnectioninterface.h b/webrtc/api/peerconnectioninterface.h
index e14b79c..54fae2b 100644
--- a/webrtc/api/peerconnectioninterface.h
+++ b/webrtc/api/peerconnectioninterface.h
@@ -603,7 +603,7 @@
// implement it.
virtual void OnAddTrack(
rtc::scoped_refptr<RtpReceiverInterface> receiver,
- std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams) {}
+ const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams) {}
protected:
// Dtor protected as objects shouldn't be deleted via this interface.
diff --git a/webrtc/api/peerconnectioninterface_unittest.cc b/webrtc/api/peerconnectioninterface_unittest.cc
index 0726c75..d673b41 100644
--- a/webrtc/api/peerconnectioninterface_unittest.cc
+++ b/webrtc/api/peerconnectioninterface_unittest.cc
@@ -562,9 +562,10 @@
callback_triggered_ = true;
}
- void OnAddTrack(rtc::scoped_refptr<webrtc::RtpReceiverInterface> receiver,
- std::vector<rtc::scoped_refptr<webrtc::MediaStreamInterface>>
- streams) override {
+ void OnAddTrack(
+ rtc::scoped_refptr<webrtc::RtpReceiverInterface> receiver,
+ const std::vector<rtc::scoped_refptr<webrtc::MediaStreamInterface>>&
+ streams) override {
EXPECT_TRUE(receiver != nullptr);
num_added_tracks_++;
last_added_track_label_ = receiver->id();