Fix cpplint warning in the previous cl to peerconnection client example.
BUG=3872 TEST=Manual Test + AutoTest R=tommi@webrtc.org Review URL: https://webrtc-codereview.appspot.com/40949004 Cr-Commit-Position: refs/heads/master@{#8525} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8525 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
abbdd520b0
commit
c68e0c9dfe
@ -28,6 +28,7 @@
|
||||
#include "talk/examples/peerconnection/client/conductor.h"
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "talk/app/webrtc/videosourceinterface.h"
|
||||
#include "talk/examples/peerconnection/client/defaults.h"
|
||||
@ -103,7 +104,7 @@ bool Conductor::InitializePeerConnection() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CreatePeerConnection(DTLS_ON)) {
|
||||
if (!CreatePeerConnection(DTLS_ON)) {
|
||||
main_wnd_->MessageBox("Error",
|
||||
"CreatePeerConnection failed", true);
|
||||
DeletePeerConnection();
|
||||
@ -113,14 +114,14 @@ bool Conductor::InitializePeerConnection() {
|
||||
}
|
||||
|
||||
bool Conductor::ReinitializePeerConnectionForLoopback() {
|
||||
loopback_ = true;
|
||||
rtc::scoped_refptr<webrtc::StreamCollectionInterface> streams(
|
||||
peer_connection_->local_streams());
|
||||
peer_connection_ = NULL;
|
||||
loopback_ = true;
|
||||
rtc::scoped_refptr<webrtc::StreamCollectionInterface> streams(
|
||||
peer_connection_->local_streams());
|
||||
peer_connection_ = NULL;
|
||||
if (CreatePeerConnection(DTLS_OFF)) {
|
||||
for (size_t i = 0; i < streams->count(); ++i)
|
||||
peer_connection_->AddStream(streams->at(i));
|
||||
peer_connection_->CreateOffer(this, NULL);
|
||||
for (size_t i = 0; i < streams->count(); ++i)
|
||||
peer_connection_->AddStream(streams->at(i));
|
||||
peer_connection_->CreateOffer(this, NULL);
|
||||
}
|
||||
return peer_connection_.get() != NULL;
|
||||
}
|
||||
@ -129,23 +130,23 @@ bool Conductor::CreatePeerConnection(bool dtls) {
|
||||
ASSERT(peer_connection_factory_.get() != NULL);
|
||||
ASSERT(peer_connection_.get() == NULL);
|
||||
|
||||
webrtc::PeerConnectionInterface::IceServers servers;
|
||||
webrtc::PeerConnectionInterface::IceServer server;
|
||||
server.uri = GetPeerConnectionString();
|
||||
servers.push_back(server);
|
||||
|
||||
webrtc::PeerConnectionInterface::IceServers servers;
|
||||
webrtc::PeerConnectionInterface::IceServer server;
|
||||
server.uri = GetPeerConnectionString();
|
||||
servers.push_back(server);
|
||||
|
||||
webrtc::FakeConstraints constraints;
|
||||
if (dtls) {
|
||||
constraints.AddOptional(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
||||
"true");
|
||||
}
|
||||
|
||||
peer_connection_ =
|
||||
peer_connection_factory_->CreatePeerConnection(servers,
|
||||
&constraints,
|
||||
NULL,
|
||||
NULL,
|
||||
this);
|
||||
constraints.AddOptional(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
||||
"true");
|
||||
}
|
||||
|
||||
peer_connection_ =
|
||||
peer_connection_factory_->CreatePeerConnection(servers,
|
||||
&constraints,
|
||||
NULL,
|
||||
NULL,
|
||||
this);
|
||||
return peer_connection_.get() != NULL;
|
||||
}
|
||||
|
||||
@ -189,12 +190,12 @@ void Conductor::OnRemoveStream(webrtc::MediaStreamInterface* stream) {
|
||||
|
||||
void Conductor::OnIceCandidate(const webrtc::IceCandidateInterface* candidate) {
|
||||
LOG(INFO) << __FUNCTION__ << " " << candidate->sdp_mline_index();
|
||||
// For loopback test. To save some connecting delay.
|
||||
if (loopback_) {
|
||||
if (!peer_connection_->AddIceCandidate(candidate)) {
|
||||
LOG(WARNING) << "Failed to apply the received candidate";
|
||||
}
|
||||
return;
|
||||
// For loopback test. To save some connecting delay.
|
||||
if (loopback_) {
|
||||
if (!peer_connection_->AddIceCandidate(candidate)) {
|
||||
LOG(WARNING) << "Failed to apply the received candidate";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Json::StyledWriter writer;
|
||||
@ -279,15 +280,15 @@ void Conductor::OnMessageFromPeer(int peer_id, const std::string& message) {
|
||||
|
||||
GetStringFromJsonObject(jmessage, kSessionDescriptionTypeName, &type);
|
||||
if (!type.empty()) {
|
||||
if (type == "offer-loopback") {
|
||||
// This is a loopback call.
|
||||
// Recreate the peerconnection with DTLS disabled.
|
||||
if (!ReinitializePeerConnectionForLoopback()) {
|
||||
if (type == "offer-loopback") {
|
||||
// This is a loopback call.
|
||||
// Recreate the peerconnection with DTLS disabled.
|
||||
if (!ReinitializePeerConnectionForLoopback()) {
|
||||
LOG(LS_ERROR) << "Failed to initialize our PeerConnection instance";
|
||||
DeletePeerConnection();
|
||||
client_->SignOut();
|
||||
}
|
||||
return;
|
||||
client_->SignOut();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
std::string sdp;
|
||||
@ -518,21 +519,21 @@ void Conductor::UIThreadCallback(int msg_id, void* data) {
|
||||
}
|
||||
|
||||
void Conductor::OnSuccess(webrtc::SessionDescriptionInterface* desc) {
|
||||
peer_connection_->SetLocalDescription(
|
||||
DummySetSessionDescriptionObserver::Create(), desc);
|
||||
|
||||
peer_connection_->SetLocalDescription(
|
||||
DummySetSessionDescriptionObserver::Create(), desc);
|
||||
|
||||
std::string sdp;
|
||||
desc->ToString(&sdp);
|
||||
|
||||
// For loopback test. To save some connecting delay.
|
||||
if (loopback_) {
|
||||
// Replace message type from "offer" to "answer"
|
||||
webrtc::SessionDescriptionInterface* session_description(
|
||||
webrtc::CreateSessionDescription("answer", sdp));
|
||||
peer_connection_->SetRemoteDescription(
|
||||
DummySetSessionDescriptionObserver::Create(), session_description);
|
||||
return;
|
||||
}
|
||||
desc->ToString(&sdp);
|
||||
|
||||
// For loopback test. To save some connecting delay.
|
||||
if (loopback_) {
|
||||
// Replace message type from "offer" to "answer"
|
||||
webrtc::SessionDescriptionInterface* session_description(
|
||||
webrtc::CreateSessionDescription("answer", sdp));
|
||||
peer_connection_->SetRemoteDescription(
|
||||
DummySetSessionDescriptionObserver::Create(), session_description);
|
||||
return;
|
||||
}
|
||||
|
||||
Json::StyledWriter writer;
|
||||
Json::Value jmessage;
|
||||
|
@ -25,8 +25,8 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef PEERCONNECTION_SAMPLES_CLIENT_CONDUCTOR_H_
|
||||
#define PEERCONNECTION_SAMPLES_CLIENT_CONDUCTOR_H_
|
||||
#ifndef TALK_EXAMPLES_PEERCONNECTION_CLIENT_CONDUCTOR_H_
|
||||
#define TALK_EXAMPLES_PEERCONNECTION_CLIENT_CONDUCTOR_H_
|
||||
#pragma once
|
||||
|
||||
#include <deque>
|
||||
@ -143,4 +143,4 @@ class Conductor
|
||||
std::string server_;
|
||||
};
|
||||
|
||||
#endif // PEERCONNECTION_SAMPLES_CLIENT_CONDUCTOR_H_
|
||||
#endif // TALK_EXAMPLES_PEERCONNECTION_CLIENT_CONDUCTOR_H_
|
||||
|
Loading…
x
Reference in New Issue
Block a user