From dec6aa57f3b7e402cfefc1322ee49cddfcf28562 Mon Sep 17 00:00:00 2001 From: "mallinath@webrtc.org" Date: Tue, 23 Aug 2011 22:17:03 +0000 Subject: [PATCH] This CL will remove sending any signal after calling Close and RemoveStream. I am thinking to remove Close method at all, since application can directly delete the object if it wants to end the call with all active streams. Will send that change later in a different CL. Review URL: http://webrtc-codereview.appspot.com/119004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@429 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../source/talk/app/webrtc/webrtcsession.cc | 47 ++----------------- .../source/talk/app/webrtc/webrtcsession.h | 2 +- 2 files changed, 5 insertions(+), 44 deletions(-) diff --git a/third_party_mods/libjingle/source/talk/app/webrtc/webrtcsession.cc b/third_party_mods/libjingle/source/talk/app/webrtc/webrtcsession.cc index 37f8d0ff4b..dd751df55d 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc/webrtcsession.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc/webrtcsession.cc @@ -288,7 +288,6 @@ bool WebRtcSession::RemoveStream(const std::string& stream_id) { for (iter = streams_.begin(); iter != streams_.end(); ++iter) { StreamInfo* sinfo = (*iter); if (sinfo->stream_id.compare(stream_id) == 0) { - DisableLocalCandidate(sinfo->transport->name()); if (!sinfo->video) { cricket::VoiceChannel* channel = static_cast ( sinfo->channel); @@ -314,15 +313,6 @@ bool WebRtcSession::RemoveStream(const std::string& stream_id) { return ret; } -void WebRtcSession::DisableLocalCandidate(const std::string& name) { - for (size_t i = 0; i < local_candidates_.size(); ++i) { - if (local_candidates_[i].name().compare(name) == 0) { - talk_base::SocketAddress address(local_candidates_[i].address().ip(), 0); - local_candidates_[i].set_address(address); - } - } -} - void WebRtcSession::EnableAllStreams() { StreamMap::const_iterator i; for (i = streams_.begin(); i != streams_.end(); ++i) { @@ -349,9 +339,6 @@ void WebRtcSession::RemoveAllStreams() { i != streams_to_remove.end(); ++i) { RemoveStream(*i); } - - SetState(STATE_SENTTERMINATE); - SignalRemoveStreamMessage(this); } bool WebRtcSession::HasStream(const std::string& stream_id) const { @@ -459,7 +446,6 @@ bool WebRtcSession::OnInitiateMessage( return false; } } - // Provide remote candidates to the transport transport_->OnRemoteCandidates(candidates); @@ -472,7 +458,6 @@ bool WebRtcSession::OnInitiateMessage( set_local_description(answer.release()); SetState(STATE_SENTACCEPT); - // AddStream called only once with Video label if (video_content) { SignalAddStream(video_content->name, true); @@ -485,29 +470,17 @@ bool WebRtcSession::OnInitiateMessage( bool WebRtcSession::OnRemoteDescription( cricket::SessionDescription* desc, const std::vector& candidates) { - - if (state() == STATE_SENTTERMINATE) { - LOG(LERROR) << "Invalid state to process the message"; - return false; - } - if (state() == STATE_SENTACCEPT || state() == STATE_RECEIVEDACCEPT || state() == STATE_INPROGRESS) { - if (CheckForStreamDeleteMessage(candidates)) { - return OnStreamDeleteMessage(desc, candidates); - } else { - transport_->OnRemoteCandidates(candidates); - return true; - } + transport_->OnRemoteCandidates(candidates); + return true; } - - // Will trigger OnWritableState() if successful. - transport_->OnRemoteCandidates(candidates); - // Session description is always accepted. set_remote_description(desc); SetState(STATE_RECEIVEDACCEPT); + // Will trigger OnWritableState() if successful. + transport_->OnRemoteCandidates(candidates); if (!incoming()) { // Trigger OnAddStream callback at the initiator @@ -523,16 +496,6 @@ bool WebRtcSession::OnRemoteDescription( return true; } -bool WebRtcSession::CheckForStreamDeleteMessage( - const std::vector& candidates) { - for (size_t i = 0; i < candidates.size(); ++i) { - if (candidates[i].address().port() == 0) { - return true; - } - } - return false; -} - bool WebRtcSession::OnStreamDeleteMessage( const cricket::SessionDescription* desc, const std::vector& candidates) { @@ -583,13 +546,11 @@ void WebRtcSession::RemoveStreamOnRequest( stream_info->channel); channel->Enable(false); channel_manager_->DestroyVoiceChannel(channel); - DisableLocalCandidate(stream_info->transport->name()); } else { cricket::VideoChannel* channel = static_cast ( stream_info->channel); channel->Enable(false); channel_manager_->DestroyVideoChannel(channel); - DisableLocalCandidate(stream_info->transport->name()); } streams_.erase(siter); break; diff --git a/third_party_mods/libjingle/source/talk/app/webrtc/webrtcsession.h b/third_party_mods/libjingle/source/talk/app/webrtc/webrtcsession.h index a551955a8e..33f6ae5372 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc/webrtcsession.h +++ b/third_party_mods/libjingle/source/talk/app/webrtc/webrtcsession.h @@ -28,6 +28,7 @@ #ifndef TALK_APP_WEBRTC_WEBRTCSESSION_H_ #define TALK_APP_WEBRTC_WEBRTCSESSION_H_ +#include #include #include @@ -199,7 +200,6 @@ class WebRtcSession : public cricket::BaseSession { typedef std::map TransportChannelMap; bool SetVideoCapture(bool capture); - void DisableLocalCandidate(const std::string& name); bool OnStreamDeleteMessage(const cricket::SessionDescription* desc, const std::vector& candidates); void RemoveStreamOnRequest(const cricket::Candidate& candidate);