Chromium Code Reviews| Index: talk/app/webrtc/peerconnection.cc |
| diff --git a/talk/app/webrtc/peerconnection.cc b/talk/app/webrtc/peerconnection.cc |
| index 0d519b280b9f77485e4e648cf1697274bbd448fa..801b69b6147540b6c41cc86b68dfb35301902958 100644 |
| --- a/talk/app/webrtc/peerconnection.cc |
| +++ b/talk/app/webrtc/peerconnection.cc |
| @@ -949,6 +949,15 @@ void PeerConnection::SetLocalDescription( |
| const cricket::ContentInfo* audio_content = |
| GetFirstAudioContent(desc->description()); |
| if (audio_content) { |
| + if (audio_content->rejected) { |
| + audio_rejected_ = true; |
| + } else if (audio_rejected_) { |
|
pthatcher1
2015/11/11 00:45:02
Can we get the equivalent of audio_rejected_ by lo
Taylor Brandstetter
2015/11/11 01:33:29
It gets more complex if we go that route. We have
|
| + // If going from rejected to unrejected, need to reconfigure senders and |
| + // receivers. |
| + audio_rejected_ = false; |
| + ReconfigureSenders(cricket::MEDIA_TYPE_AUDIO); |
| + ReconfigureReceivers(cricket::MEDIA_TYPE_AUDIO); |
|
pthatcher1
2015/11/11 00:45:02
Should we have a ReconfigureSenderAndReceivers met
Taylor Brandstetter
2015/11/11 01:33:29
Done.
|
| + } |
| const cricket::AudioContentDescription* audio_desc = |
| static_cast<const cricket::AudioContentDescription*>( |
| audio_content->description); |
| @@ -958,6 +967,15 @@ void PeerConnection::SetLocalDescription( |
| const cricket::ContentInfo* video_content = |
| GetFirstVideoContent(desc->description()); |
| if (video_content) { |
| + if (video_content->rejected) { |
| + video_rejected_ = true; |
| + } else if (video_rejected_) { |
| + // If going from rejected to unrejected, need to reconfigure senders and |
| + // receivers. |
| + video_rejected_ = false; |
| + ReconfigureSenders(cricket::MEDIA_TYPE_VIDEO); |
| + ReconfigureReceivers(cricket::MEDIA_TYPE_VIDEO); |
| + } |
| const cricket::VideoContentDescription* video_desc = |
| static_cast<const cricket::VideoContentDescription*>( |
| video_content->description); |
| @@ -1023,6 +1041,15 @@ void PeerConnection::SetRemoteDescription( |
| // and MediaStreams. |
| const cricket::ContentInfo* audio_content = GetFirstAudioContent(remote_desc); |
| if (audio_content) { |
| + if (audio_content->rejected) { |
| + audio_rejected_ = true; |
| + } else if (audio_rejected_) { |
| + // If going from rejected to unrejected, need to reconfigure senders and |
| + // receivers. |
| + audio_rejected_ = false; |
| + ReconfigureSenders(cricket::MEDIA_TYPE_AUDIO); |
| + ReconfigureReceivers(cricket::MEDIA_TYPE_AUDIO); |
| + } |
| const cricket::AudioContentDescription* desc = |
| static_cast<const cricket::AudioContentDescription*>( |
| audio_content->description); |
| @@ -1036,6 +1063,15 @@ void PeerConnection::SetRemoteDescription( |
| // and MediaStreams. |
| const cricket::ContentInfo* video_content = GetFirstVideoContent(remote_desc); |
| if (video_content) { |
| + if (video_content->rejected) { |
| + video_rejected_ = true; |
| + } else if (video_rejected_) { |
| + // If going from rejected to unrejected, need to reconfigure senders and |
| + // receivers. |
| + video_rejected_ = false; |
| + ReconfigureSenders(cricket::MEDIA_TYPE_VIDEO); |
| + ReconfigureReceivers(cricket::MEDIA_TYPE_VIDEO); |
| + } |
| const cricket::VideoContentDescription* desc = |
| static_cast<const cricket::VideoContentDescription*>( |
| video_content->description); |
| @@ -1934,6 +1970,22 @@ PeerConnection::FindReceiverForTrack(MediaStreamTrackInterface* track) { |
| }); |
| } |
| +void PeerConnection::ReconfigureSenders(cricket::MediaType media_type) { |
| + for (const auto& sender : senders_) { |
| + if (sender->media_type() == media_type) { |
| + sender->Reconfigure(); |
| + } |
| + } |
| +} |
| + |
| +void PeerConnection::ReconfigureReceivers(cricket::MediaType media_type) { |
| + for (const auto& receiver : receivers_) { |
| + if (receiver->media_type() == media_type) { |
| + receiver->Reconfigure(); |
| + } |
| + } |
| +} |
| + |
| PeerConnection::TrackInfos* PeerConnection::GetRemoteTracks( |
| cricket::MediaType media_type) { |
| RTC_DCHECK(media_type == cricket::MEDIA_TYPE_AUDIO || |