Review URL: http://webrtc-codereview.appspot.com/115007
git-svn-id: http://webrtc.googlecode.com/svn/trunk@403 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
765c918677
commit
310689e26d
@ -140,12 +140,12 @@ PeerConnectionImpl::PeerConnectionImpl(const std::string& config,
|
||||
media_engine_(media_engine),
|
||||
worker_thread_(worker_thread),
|
||||
device_manager_(device_manager),
|
||||
signaling_thread_(signaling_thread),
|
||||
initialized_(false),
|
||||
service_type_(SERVICE_COUNT),
|
||||
event_callback_(NULL),
|
||||
session_(NULL),
|
||||
incoming_(false) {
|
||||
signaling_thread_.reset(signaling_thread);
|
||||
}
|
||||
|
||||
PeerConnectionImpl::PeerConnectionImpl(const std::string& config,
|
||||
@ -166,6 +166,8 @@ PeerConnectionImpl::PeerConnectionImpl(const std::string& config,
|
||||
|
||||
PeerConnectionImpl::~PeerConnectionImpl() {
|
||||
signaling_thread_->Send(this, MSG_WEBRTC_RELEASE);
|
||||
// Signaling thread must be destroyed by the application.
|
||||
signaling_thread_ = NULL;
|
||||
}
|
||||
|
||||
void PeerConnectionImpl::Release_s() {
|
||||
@ -181,8 +183,11 @@ bool PeerConnectionImpl::Init() {
|
||||
return false;
|
||||
stun_hosts.push_back(stun_addr);
|
||||
|
||||
if (!signaling_thread_.get()) {
|
||||
signaling_thread_.reset(new talk_base::Thread());
|
||||
// TODO(mallinath) - Changes are required to modify the stand alone
|
||||
// constructor to get signaling thread as input. It should not be created
|
||||
// here.
|
||||
if (!signaling_thread_) {
|
||||
signaling_thread_ = new talk_base::Thread();
|
||||
if (!signaling_thread_->SetName("signaling thread", this) ||
|
||||
!signaling_thread_->Start()) {
|
||||
LOG(WARNING) << "Failed to start libjingle signaling thread";
|
||||
@ -290,7 +295,7 @@ WebRtcSession* PeerConnectionImpl::CreateMediaSession(
|
||||
ASSERT(port_allocator_ != NULL);
|
||||
WebRtcSession* session = new WebRtcSession(id, dir,
|
||||
port_allocator_, channel_manager_.get(),
|
||||
signaling_thread_.get());
|
||||
signaling_thread_);
|
||||
|
||||
if (session->Initiate()) {
|
||||
session->SignalRemoveStreamMessage.connect(
|
||||
|
@ -141,7 +141,7 @@ class PeerConnectionImpl : public PeerConnection,
|
||||
cricket::MediaEngine* media_engine_;
|
||||
talk_base::Thread* worker_thread_;
|
||||
cricket::DeviceManager* device_manager_;
|
||||
talk_base::scoped_ptr<talk_base::Thread> signaling_thread_;
|
||||
talk_base::Thread* signaling_thread_;
|
||||
|
||||
bool initialized_;
|
||||
ReadyState ready_state_;
|
||||
|
@ -302,6 +302,7 @@ bool WebRtcSession::RemoveStream(const std::string& stream_id) {
|
||||
}
|
||||
// channel and transport will be deleted in
|
||||
// DestroyVoiceChannel/DestroyVideoChannel
|
||||
streams_.erase(iter);
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
@ -459,6 +460,9 @@ bool WebRtcSession::OnInitiateMessage(
|
||||
}
|
||||
}
|
||||
|
||||
// Provide remote candidates to the transport
|
||||
transport_->OnRemoteCandidates(candidates);
|
||||
|
||||
set_remote_description(offer);
|
||||
SetState(STATE_RECEIVEDINITIATE);
|
||||
|
||||
@ -468,8 +472,6 @@ bool WebRtcSession::OnInitiateMessage(
|
||||
set_local_description(answer.release());
|
||||
SetState(STATE_SENTACCEPT);
|
||||
|
||||
// Provide remote candidates to the transport
|
||||
transport_->OnRemoteCandidates(candidates);
|
||||
|
||||
// AddStream called only once with Video label
|
||||
if (video_content) {
|
||||
@ -485,9 +487,10 @@ bool WebRtcSession::OnRemoteDescription(
|
||||
const std::vector<cricket::Candidate>& candidates) {
|
||||
|
||||
if (state() == STATE_SENTTERMINATE) {
|
||||
ProcessTerminateAccept(desc);
|
||||
return true;
|
||||
LOG(LERROR) << "Invalid state to process the message";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (state() == STATE_SENTACCEPT ||
|
||||
state() == STATE_RECEIVEDACCEPT ||
|
||||
state() == STATE_INPROGRESS) {
|
||||
@ -499,6 +502,9 @@ bool WebRtcSession::OnRemoteDescription(
|
||||
}
|
||||
}
|
||||
|
||||
// Will trigger OnWritableState() if successful.
|
||||
transport_->OnRemoteCandidates(candidates);
|
||||
|
||||
// Session description is always accepted.
|
||||
set_remote_description(desc);
|
||||
SetState(STATE_RECEIVEDACCEPT);
|
||||
@ -514,11 +520,11 @@ bool WebRtcSession::OnRemoteDescription(
|
||||
SignalAddStream(audio_content->name, false);
|
||||
}
|
||||
}
|
||||
// Will trigger OnWritableState() if successful.
|
||||
transport_->OnRemoteCandidates(candidates);
|
||||
return true;
|
||||
}
|
||||
|
||||
<<<<<<< .mine
|
||||
=======
|
||||
void WebRtcSession::ProcessTerminateAccept(cricket::SessionDescription* desc) {
|
||||
const cricket::ContentInfo* video_content = GetFirstVideoContent(desc);
|
||||
if (video_content) {
|
||||
@ -531,6 +537,7 @@ void WebRtcSession::ProcessTerminateAccept(cricket::SessionDescription* desc) {
|
||||
}
|
||||
}
|
||||
|
||||
>>>>>>> .r402
|
||||
bool WebRtcSession::CheckForStreamDeleteMessage(
|
||||
const std::vector<cricket::Candidate>& candidates) {
|
||||
for (size_t i = 0; i < candidates.size(); ++i) {
|
||||
@ -557,7 +564,6 @@ bool WebRtcSession::OnStreamDeleteMessage(
|
||||
}
|
||||
}
|
||||
|
||||
SignalRemoveStreamMessage(this);
|
||||
const cricket::ContentInfo* video_content = GetFirstVideoContent(desc);
|
||||
if (video_content) {
|
||||
SignalRemoveStream(video_content->name, true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user