Chromium Code Reviews| Index: talk/app/webrtc/mediastreamsignaling.cc |
| diff --git a/talk/app/webrtc/mediastreamsignaling.cc b/talk/app/webrtc/mediastreamsignaling.cc |
| index 1f5f14fd7b55a3e6641349058f03ed1c38bfdb4a..22ab983dc0aa63a5dfb144dcfa3f858842c9d71f 100644 |
| --- a/talk/app/webrtc/mediastreamsignaling.cc |
| +++ b/talk/app/webrtc/mediastreamsignaling.cc |
| @@ -526,6 +526,8 @@ void MediaStreamSignaling::OnLocalDescriptionChanged( |
| if (audio_content) { |
| if (audio_content->rejected) { |
| RejectRemoteTracks(cricket::MEDIA_TYPE_AUDIO); |
| + } else { |
| + AcceptRemoteTracks(cricket::MEDIA_TYPE_AUDIO); |
| } |
| const cricket::AudioContentDescription* audio_desc = |
| static_cast<const cricket::AudioContentDescription*>( |
| @@ -538,6 +540,8 @@ void MediaStreamSignaling::OnLocalDescriptionChanged( |
| if (video_content) { |
| if (video_content->rejected) { |
| RejectRemoteTracks(cricket::MEDIA_TYPE_VIDEO); |
| + } else { |
| + AcceptRemoteTracks(cricket::MEDIA_TYPE_VIDEO); |
| } |
| const cricket::VideoContentDescription* video_desc = |
| static_cast<const cricket::VideoContentDescription*>( |
| @@ -703,6 +707,27 @@ void MediaStreamSignaling::RejectRemoteTracks(cricket::MediaType media_type) { |
| } |
| } |
| +void MediaStreamSignaling::AcceptRemoteTracks(cricket::MediaType media_type) { |
|
pthatcher1
2015/07/08 20:45:32
Can you avoid duplication by making a helper metho
Taylor Brandstetter
2015/07/08 23:04:03
Sure, that should be fine as long as accepting/rej
|
| + TrackInfos* current_tracks = GetRemoteTracks(media_type); |
| + for (TrackInfos::iterator track_it = current_tracks->begin(); |
| + track_it != current_tracks->end(); ++track_it) { |
| + const TrackInfo& info = *track_it; |
| + MediaStreamInterface* stream = remote_streams_->find(info.stream_label); |
| + if (media_type == cricket::MEDIA_TYPE_AUDIO) { |
| + AudioTrackInterface* track = stream->FindAudioTrack(info.track_id); |
| + if (track) { |
| + track->set_state(webrtc::MediaStreamTrackInterface::kLive); |
| + } |
| + } |
| + if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
| + VideoTrackInterface* track = stream->FindVideoTrack(info.track_id); |
| + if (track) { |
| + track->set_state(webrtc::MediaStreamTrackInterface::kLive); |
| + } |
| + } |
| + } |
| +} |
| + |
| void MediaStreamSignaling::UpdateEndedRemoteMediaStreams() { |
| std::vector<scoped_refptr<MediaStreamInterface> > streams_to_remove; |
| for (size_t i = 0; i < remote_streams_->count(); ++i) { |