Added a callback function OnAddTrack to PeerConnectionObserver

Added the callback in native c++ API.
The callback function is called when a track is added and a new RtpReceiver is created.
The application can tell when tracks are added to the streams by listening to this callback.

BUG=webrtc:6112

Review-Url: https://codereview.webrtc.org/2505173002
Cr-Commit-Position: refs/heads/master@{#15142}
This commit is contained in:
zhihuang
2016-11-17 12:06:24 -08:00
committed by Commit bot
parent 5b93db2a53
commit 81c3a03004
3 changed files with 75 additions and 14 deletions

View File

@ -598,6 +598,13 @@ class PeerConnectionObserver {
// Called when the ICE connection receiving status changes.
virtual void OnIceConnectionReceivingChange(bool receiving) {}
// Called when a track is added to streams.
// TODO(zhihuang) Make this a pure virtual method when all its subclasses
// implement it.
virtual void OnAddTrack(
rtc::scoped_refptr<RtpReceiverInterface> receiver,
std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams) {}
protected:
// Dtor protected as objects shouldn't be deleted via this interface.
~PeerConnectionObserver() {}