Fire OnAddStream with Unified Plan

Bug: webrtc:7600
Change-Id: Ic4e5560fdeb9848c65c59e0f45ca3a2a4a22a2ad
Reviewed-on: https://webrtc-review.googlesource.com/53401
Reviewed-by: Peter Thatcher <pthatcher@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22042}
This commit is contained in:
Steve Anton 2018-02-14 14:28:13 -08:00 committed by Commit Bot
parent 9c98f0c254
commit c49bcd9911
2 changed files with 6 additions and 2 deletions

View File

@ -1007,8 +1007,6 @@ class PeerConnectionObserver {
PeerConnectionInterface::SignalingState new_state) = 0;
// Triggered when media is received on a new stream from remote peer.
// Deprecated: This callback will no longer be fired with Unified Plan
// semantics. Consider switching to OnAddTrack.
virtual void OnAddStream(rtc::scoped_refptr<MediaStreamInterface> stream) {}
// Triggered when a remote peer close a stream.

View File

@ -2158,6 +2158,7 @@ RTCError PeerConnection::ApplyRemoteDescription(
if (IsUnifiedPlan()) {
std::vector<TrackEvent> track_events;
std::vector<rtc::scoped_refptr<MediaStreamInterface>> added_streams;
for (auto transceiver : transceivers_) {
const ContentInfo* content =
FindMediaSectionForTransceiver(transceiver, remote_description());
@ -2183,6 +2184,7 @@ RTCError PeerConnection::ApplyRemoteDescription(
stream = MediaStreamProxy::Create(rtc::Thread::Current(),
MediaStream::Create(sync_label));
remote_streams_->AddStream(stream);
added_streams.push_back(stream);
}
transceiver->internal()->receiver_internal()->SetStreams({stream});
TrackEvent track_event;
@ -2209,9 +2211,13 @@ RTCError PeerConnection::ApplyRemoteDescription(
media_desc->streams()[0].first_ssrc());
}
}
// Once all processing has finished, fire off callbacks.
for (auto event : track_events) {
observer_->OnAddTrack(event.receiver, event.streams);
}
for (auto stream : added_streams) {
observer_->OnAddStream(stream);
}
}
const cricket::ContentInfo* audio_content =