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
This commit is contained in:
parent
a386fc0a8b
commit
dec6aa57f3
third_party_mods/libjingle/source/talk/app/webrtc
@ -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<cricket::VoiceChannel*> (
|
||||
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<cricket::Candidate>& 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<cricket::Candidate>& 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<cricket::Candidate>& 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<cricket::VideoChannel*> (
|
||||
stream_info->channel);
|
||||
channel->Enable(false);
|
||||
channel_manager_->DestroyVideoChannel(channel);
|
||||
DisableLocalCandidate(stream_info->transport->name());
|
||||
}
|
||||
streams_.erase(siter);
|
||||
break;
|
||||
|
@ -28,6 +28,7 @@
|
||||
#ifndef TALK_APP_WEBRTC_WEBRTCSESSION_H_
|
||||
#define TALK_APP_WEBRTC_WEBRTCSESSION_H_
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -199,7 +200,6 @@ class WebRtcSession : public cricket::BaseSession {
|
||||
typedef std::map<std::string, cricket::TransportChannel*> TransportChannelMap;
|
||||
|
||||
bool SetVideoCapture(bool capture);
|
||||
void DisableLocalCandidate(const std::string& name);
|
||||
bool OnStreamDeleteMessage(const cricket::SessionDescription* desc,
|
||||
const std::vector<cricket::Candidate>& candidates);
|
||||
void RemoveStreamOnRequest(const cricket::Candidate& candidate);
|
||||
|
Loading…
x
Reference in New Issue
Block a user