summaryrefslogtreecommitdiffstats
path: root/remoting/protocol
diff options
context:
space:
mode:
authorgarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-08 23:34:23 +0000
committergarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-08 23:34:23 +0000
commitc3ddba29664d91b8910489150171496b28355bbb (patch)
tree7b0273861652a98310037d074041d40dfbd6fbca /remoting/protocol
parent5000ade63130b45452cb1d0d67d1f92e77c3436f (diff)
downloadchromium_src-c3ddba29664d91b8910489150171496b28355bbb.zip
chromium_src-c3ddba29664d91b8910489150171496b28355bbb.tar.gz
chromium_src-c3ddba29664d91b8910489150171496b28355bbb.tar.bz2
Chromoting: Rename ChromotocolConfig -> SessionConfig
BUG=none TEST=build chrome, chromoting Review URL: http://codereview.chromium.org/4446005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65451 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/protocol')
-rw-r--r--remoting/protocol/fake_session.cc13
-rw-r--r--remoting/protocol/fake_session.h12
-rw-r--r--remoting/protocol/jingle_connection_to_host.cc4
-rw-r--r--remoting/protocol/jingle_session.cc10
-rw-r--r--remoting/protocol/jingle_session.h12
-rw-r--r--remoting/protocol/jingle_session_manager.cc22
-rw-r--r--remoting/protocol/jingle_session_manager.h12
-rw-r--r--remoting/protocol/jingle_session_unittest.cc8
-rw-r--r--remoting/protocol/protocol_test_client.cc6
-rw-r--r--remoting/protocol/session.h10
-rw-r--r--remoting/protocol/session_config.cc (renamed from remoting/protocol/chromotocol_config.cc)82
-rw-r--r--remoting/protocol/session_config.h (renamed from remoting/protocol/chromotocol_config.h)55
-rw-r--r--remoting/protocol/session_manager.h10
-rw-r--r--remoting/protocol/video_reader.cc4
-rw-r--r--remoting/protocol/video_reader.h12
-rw-r--r--remoting/protocol/video_writer.cc4
-rw-r--r--remoting/protocol/video_writer.h12
17 files changed, 137 insertions, 151 deletions
diff --git a/remoting/protocol/fake_session.cc b/remoting/protocol/fake_session.cc
index 492f4d8..4b3ff51 100644
--- a/remoting/protocol/fake_session.cc
+++ b/remoting/protocol/fake_session.cc
@@ -9,7 +9,6 @@
#include "net/base/net_errors.h"
namespace remoting {
-
namespace protocol {
const char kTestJid[] = "host1@gmail.com/chromoting123";
@@ -72,8 +71,8 @@ bool FakeSocket::SetSendBufferSize(int32 size) {
}
FakeSession::FakeSession()
- : candidate_config_(CandidateChromotocolConfig::CreateDefault()),
- config_(ChromotocolConfig::CreateDefault()),
+ : candidate_config_(CandidateSessionConfig::CreateDefault()),
+ config_(SessionConfig::CreateDefault()),
message_loop_(NULL),
jid_(kTestJid) {
}
@@ -113,17 +112,16 @@ MessageLoop* FakeSession::message_loop() {
return message_loop_;
}
-const CandidateChromotocolConfig*
-FakeSession::candidate_config() {
+const CandidateSessionConfig* FakeSession::candidate_config() {
return candidate_config_.get();
}
-const ChromotocolConfig* FakeSession::config() {
+const SessionConfig* FakeSession::config() {
CHECK(config_.get());
return config_.get();
}
-void FakeSession::set_config(const ChromotocolConfig* config) {
+void FakeSession::set_config(const SessionConfig* config) {
config_.reset(config);
}
@@ -134,5 +132,4 @@ void FakeSession::Close(Task* closed_task) {
}
} // namespace protocol
-
} // namespace remoting
diff --git a/remoting/protocol/fake_session.h b/remoting/protocol/fake_session.h
index d325351..9b216fe 100644
--- a/remoting/protocol/fake_session.h
+++ b/remoting/protocol/fake_session.h
@@ -12,7 +12,6 @@
#include "remoting/protocol/session.h"
namespace remoting {
-
namespace protocol {
extern const char kTestJid[];
@@ -79,16 +78,16 @@ class FakeSession : public Session {
virtual const std::string& jid();
virtual MessageLoop* message_loop();
- virtual const CandidateChromotocolConfig* candidate_config();
- virtual const ChromotocolConfig* config();
- virtual void set_config(const ChromotocolConfig* config);
+ virtual const CandidateSessionConfig* candidate_config();
+ virtual const SessionConfig* config();
+ virtual void set_config(const SessionConfig* config);
virtual void Close(Task* closed_task);
public:
scoped_ptr<StateChangeCallback> callback_;
- scoped_ptr<const CandidateChromotocolConfig> candidate_config_;
- scoped_ptr<const ChromotocolConfig> config_;
+ scoped_ptr<const CandidateSessionConfig> candidate_config_;
+ scoped_ptr<const SessionConfig> config_;
MessageLoop* message_loop_;
FakeSocket control_channel_;
FakeSocket event_channel_;
@@ -100,7 +99,6 @@ class FakeSession : public Session {
};
} // namespace protocol
-
} // namespace remoting
#endif // REMOTING_PROTOCOL_FAKE_SESSION_H_
diff --git a/remoting/protocol/jingle_connection_to_host.cc b/remoting/protocol/jingle_connection_to_host.cc
index ec73780..e31d351 100644
--- a/remoting/protocol/jingle_connection_to_host.cc
+++ b/remoting/protocol/jingle_connection_to_host.cc
@@ -82,8 +82,8 @@ void JingleConnectionToHost::InitSession() {
NewCallback(this, &JingleConnectionToHost::OnNewSession));
session_manager_ = session_manager;
- CandidateChromotocolConfig* candidate_config =
- CandidateChromotocolConfig::CreateDefault();
+ CandidateSessionConfig* candidate_config =
+ CandidateSessionConfig::CreateDefault();
// TODO(sergeyu): Set resolution in the |candidate_config| to the desired
// resolution.
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc
index 4ed6b4f..9988f30 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -114,25 +114,25 @@ MessageLoop* JingleSession::message_loop() {
return jingle_session_manager_->message_loop();
}
-const CandidateChromotocolConfig*
+const CandidateSessionConfig*
JingleSession::candidate_config() {
DCHECK(candidate_config_.get());
return candidate_config_.get();
}
void JingleSession::set_candidate_config(
- const CandidateChromotocolConfig* candidate_config) {
+ const CandidateSessionConfig* candidate_config) {
DCHECK(!candidate_config_.get());
DCHECK(candidate_config);
candidate_config_.reset(candidate_config);
}
-const ChromotocolConfig* JingleSession::config() {
+const SessionConfig* JingleSession::config() {
DCHECK(config_.get());
return config_.get();
}
-void JingleSession::set_config(const ChromotocolConfig* config) {
+void JingleSession::set_config(const SessionConfig* config) {
DCHECK(!config_.get());
DCHECK(config);
config_.reset(config);
@@ -281,7 +281,7 @@ void JingleSession::OnAccept() {
const protocol::ContentDescription* content_description =
static_cast<const protocol::ContentDescription*>(content->description);
- ChromotocolConfig* config = content_description->config()->GetFinalConfig();
+ SessionConfig* config = content_description->config()->GetFinalConfig();
// Terminate the session if the config we received is invalid.
if (!config || !candidate_config()->IsSupported(config)) {
diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h
index dcebbd1..32654fc 100644
--- a/remoting/protocol/jingle_session.h
+++ b/remoting/protocol/jingle_session.h
@@ -51,10 +51,10 @@ class JingleSession : public protocol::Session,
virtual const std::string& jid();
virtual MessageLoop* message_loop();
- virtual const CandidateChromotocolConfig* candidate_config();
- virtual const ChromotocolConfig* config();
+ virtual const CandidateSessionConfig* candidate_config();
+ virtual const SessionConfig* config();
- virtual void set_config(const ChromotocolConfig* config);
+ virtual void set_config(const SessionConfig* config);
virtual void Close(Task* closed_task);
@@ -65,7 +65,7 @@ class JingleSession : public protocol::Session,
friend class JingleSessionManager;
// Called by JingleSessionManager.
- void set_candidate_config(const CandidateChromotocolConfig* candidate_config);
+ void set_candidate_config(const CandidateSessionConfig* candidate_config);
void Init(cricket::Session* cricket_session);
bool HasSession(cricket::Session* cricket_session);
cricket::Session* ReleaseSession();
@@ -95,8 +95,8 @@ class JingleSession : public protocol::Session,
// The corresponding libjingle session.
cricket::Session* cricket_session_;
- scoped_ptr<const CandidateChromotocolConfig> candidate_config_;
- scoped_ptr<const ChromotocolConfig> config_;
+ scoped_ptr<const CandidateSessionConfig> candidate_config_;
+ scoped_ptr<const SessionConfig> config_;
cricket::PseudoTcpChannel* control_channel_;
scoped_ptr<StreamSocketAdapter> control_channel_adapter_;
diff --git a/remoting/protocol/jingle_session_manager.cc b/remoting/protocol/jingle_session_manager.cc
index 8784f83..e5e17bf 100644
--- a/remoting/protocol/jingle_session_manager.cc
+++ b/remoting/protocol/jingle_session_manager.cc
@@ -18,7 +18,6 @@ using buzz::QName;
using buzz::XmlElement;
namespace remoting {
-
namespace protocol {
namespace {
@@ -151,8 +150,8 @@ bool ParseChannelConfig(const XmlElement* element, bool codec_required,
} // namespace
ContentDescription::ContentDescription(
- const CandidateChromotocolConfig* config)
- : candidate_config_(config) {
+ const CandidateSessionConfig* candidate_config)
+ : candidate_config_(candidate_config) {
}
ContentDescription::~ContentDescription() { }
@@ -220,12 +219,12 @@ void JingleSessionManager::set_allow_local_ips(bool allow_local_ips) {
scoped_refptr<protocol::Session> JingleSessionManager::Connect(
const std::string& jid,
- CandidateChromotocolConfig* chromotocol_config,
+ CandidateSessionConfig* candidate_config,
protocol::Session::StateChangeCallback* state_change_callback) {
// Can be called from any thread.
scoped_refptr<JingleSession> jingle_session(
new JingleSession(this));
- jingle_session->set_candidate_config(chromotocol_config);
+ jingle_session->set_candidate_config(candidate_config);
message_loop()->PostTask(
FROM_HERE, NewRunnableMethod(this, &JingleSessionManager::DoConnect,
jingle_session, jid,
@@ -320,8 +319,8 @@ void JingleSessionManager::AcceptConnection(
case protocol::SessionManager::ACCEPT: {
// Connection must be configured by the callback.
DCHECK(jingle_session->config());
- CandidateChromotocolConfig* candidate_config =
- CandidateChromotocolConfig::CreateFrom(jingle_session->config());
+ CandidateSessionConfig* candidate_config =
+ CandidateSessionConfig::CreateFrom(jingle_session->config());
cricket_session->Accept(CreateSessionDescription(candidate_config));
break;
}
@@ -349,8 +348,8 @@ bool JingleSessionManager::ParseContent(
const cricket::ContentDescription** content,
cricket::ParseError* error) {
if (element->Name() == QName(kChromotingXmlNamespace, kDescriptionTag)) {
- scoped_ptr<CandidateChromotocolConfig> config(
- CandidateChromotocolConfig::CreateEmpty());
+ scoped_ptr<CandidateSessionConfig> config(
+ CandidateSessionConfig::CreateEmpty());
const XmlElement* child = NULL;
// <control> tags.
@@ -432,7 +431,7 @@ bool JingleSessionManager::WriteContent(
XmlElement* root = new XmlElement(
QName(kChromotingXmlNamespace, kDescriptionTag), true);
- const CandidateChromotocolConfig* config = desc->config();
+ const CandidateSessionConfig* config = desc->config();
std::vector<ChannelConfig>::const_iterator it;
for (it = config->control_configs().begin();
@@ -465,7 +464,7 @@ bool JingleSessionManager::WriteContent(
}
SessionDescription* JingleSessionManager::CreateSessionDescription(
- const CandidateChromotocolConfig* config) {
+ const CandidateSessionConfig* config) {
SessionDescription* desc = new SessionDescription();
desc->AddContent(JingleSession::kChromotingContentName,
kChromotingXmlNamespace,
@@ -474,5 +473,4 @@ SessionDescription* JingleSessionManager::CreateSessionDescription(
}
} // namespace protocol
-
} // namespace remoting
diff --git a/remoting/protocol/jingle_session_manager.h b/remoting/protocol/jingle_session_manager.h
index 7241002..f6ad45ab 100644
--- a/remoting/protocol/jingle_session_manager.h
+++ b/remoting/protocol/jingle_session_manager.h
@@ -29,20 +29,20 @@ class JingleThread;
namespace protocol {
// ContentDescription used for chromoting sessions. It simply wraps
-// CandidateChromotocolConfig. CandidateChromotocolConfig doesn't inherit
+// CandidateSessionConfig. CandidateSessionConfig doesn't inherit
// from ContentDescription to avoid dependency on libjingle in
// Chromotocol Session interface.
class ContentDescription : public cricket::ContentDescription {
public:
- explicit ContentDescription(const CandidateChromotocolConfig* config);
+ explicit ContentDescription(const CandidateSessionConfig* config);
~ContentDescription();
- const CandidateChromotocolConfig* config() const {
+ const CandidateSessionConfig* config() const {
return candidate_config_.get();
}
private:
- scoped_ptr<const CandidateChromotocolConfig> candidate_config_;
+ scoped_ptr<const CandidateSessionConfig> candidate_config_;
};
// This class implements SessionClient for Chromoting sessions. It acts as a
@@ -64,7 +64,7 @@ class JingleSessionManager
// ChromotocolServer interface.
virtual scoped_refptr<protocol::Session> Connect(
const std::string& jid,
- CandidateChromotocolConfig* chromotocol_config,
+ CandidateSessionConfig* candidate_config,
protocol::Session::StateChangeCallback* state_change_callback);
virtual void Close(Task* closed_task);
@@ -93,7 +93,7 @@ class JingleSessionManager
// Creates outgoing session description for an incoming session.
cricket::SessionDescription* CreateSessionDescription(
- const CandidateChromotocolConfig* config);
+ const CandidateSessionConfig* candidate_config);
// cricket::SessionClient interface.
virtual void OnSessionCreate(cricket::Session* cricket_session,
diff --git a/remoting/protocol/jingle_session_unittest.cc b/remoting/protocol/jingle_session_unittest.cc
index eb02831..20463ed 100644
--- a/remoting/protocol/jingle_session_unittest.cc
+++ b/remoting/protocol/jingle_session_unittest.cc
@@ -35,7 +35,6 @@ class JingleSessionTest;
DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::protocol::JingleSessionTest);
namespace remoting {
-
namespace protocol {
namespace {
@@ -69,7 +68,7 @@ class JingleSessionTest : public testing::Test {
NewCallback(&host_connection_callback_,
&MockSessionCallback::OnStateChange));
- session->set_config(ChromotocolConfig::CreateDefault());
+ session->set_config(SessionConfig::CreateDefault());
}
protected:
@@ -167,7 +166,7 @@ class JingleSessionTest : public testing::Test {
client_session_ = client_server_->Connect(
SessionManagerPair::kHostJid,
- CandidateChromotocolConfig::CreateDefault(),
+ CandidateSessionConfig::CreateDefault(),
NewCallback(&client_connection_callback_,
&MockSessionCallback::OnStateChange));
@@ -538,7 +537,7 @@ TEST_F(JingleSessionTest, RejectConnection) {
client_session_ = client_server_->Connect(
SessionManagerPair::kHostJid,
- CandidateChromotocolConfig::CreateDefault(),
+ CandidateSessionConfig::CreateDefault(),
NewCallback(&client_connection_callback_,
&MockSessionCallback::OnStateChange));
@@ -615,5 +614,4 @@ TEST_F(JingleSessionTest, TestVideoRtpChannel) {
}
} // namespace protocol
-
} // namespace remoting
diff --git a/remoting/protocol/protocol_test_client.cc b/remoting/protocol/protocol_test_client.cc
index 3ea145a..aa40195 100644
--- a/remoting/protocol/protocol_test_client.cc
+++ b/remoting/protocol/protocol_test_client.cc
@@ -29,7 +29,6 @@ extern "C" {
using remoting::kChromotingTokenServiceName;
namespace remoting {
-
namespace protocol {
namespace {
@@ -286,7 +285,7 @@ void ProtocolTestClient::OnStateChange(
ProtocolTestConnection* connection =
new ProtocolTestConnection(this, client_->message_loop());
connection->Init(session_manager_->Connect(
- host_jid_, CandidateChromotocolConfig::CreateDefault(),
+ host_jid_, CandidateSessionConfig::CreateDefault(),
NewCallback(connection,
&ProtocolTestConnection::OnStateChange)));
connections_.push_back(make_scoped_refptr(connection));
@@ -301,7 +300,7 @@ void ProtocolTestClient::OnNewSession(
SessionManager::IncomingSessionResponse* response) {
std::cerr << "Accepting connection from " << session->jid() << std::endl;
- session->set_config(ChromotocolConfig::CreateDefault());
+ session->set_config(SessionConfig::CreateDefault());
*response = SessionManager::ACCEPT;
ProtocolTestConnection* test_connection =
@@ -331,7 +330,6 @@ void ProtocolTestClient::DestroyConnection(
}
} // namespace protocol
-
} // namespace remoting
using remoting::protocol::ProtocolTestClient;
diff --git a/remoting/protocol/session.h b/remoting/protocol/session.h
index 0b63d17..fd100e0 100644
--- a/remoting/protocol/session.h
+++ b/remoting/protocol/session.h
@@ -8,7 +8,7 @@
#include <string>
#include "base/callback.h"
-#include "remoting/protocol/chromotocol_config.h"
+#include "remoting/protocol/session_config.h"
class MessageLoop;
class Task;
@@ -18,7 +18,6 @@ class Socket;
} // namespace net
namespace remoting {
-
namespace protocol {
// Generic interface for Chromotocol connection used by both client and host.
@@ -64,17 +63,17 @@ class Session : public base::RefCountedThreadSafe<Session> {
// Configuration of the protocol that was sent or received in the
// session-initiate jingle message. Returned pointer is valid until
// connection is closed.
- virtual const CandidateChromotocolConfig* candidate_config() = 0;
+ virtual const CandidateSessionConfig* candidate_config() = 0;
// Protocol configuration. Can be called only after session has been accepted.
// Returned pointer is valid until connection is closed.
- virtual const ChromotocolConfig* config() = 0;
+ virtual const SessionConfig* config() = 0;
// Set protocol configuration for an incoming session. Must be called
// on the host before the connection is accepted, from
// ChromotocolServer::IncomingConnectionCallback. Ownership of |config| is
// given to the connection.
- virtual void set_config(const ChromotocolConfig* config) = 0;
+ virtual void set_config(const SessionConfig* config) = 0;
// Closes connection. Callbacks are guaranteed not to be called after
// |closed_task| is executed.
@@ -91,7 +90,6 @@ class Session : public base::RefCountedThreadSafe<Session> {
};
} // namespace protocol
-
} // namespace remoting
#endif // REMOTING_PROTOCOL_SESSION_H_
diff --git a/remoting/protocol/chromotocol_config.cc b/remoting/protocol/session_config.cc
index 943fdbb..608510b 100644
--- a/remoting/protocol/chromotocol_config.cc
+++ b/remoting/protocol/session_config.cc
@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "remoting/protocol/chromotocol_config.h"
+#include "remoting/protocol/session_config.h"
#include <algorithm>
namespace remoting {
+namespace protocol {
const int kDefaultStreamVersion = 1;
@@ -49,83 +50,83 @@ bool ScreenResolution::IsValid() const {
return width > 0 && height > 0;
}
-ChromotocolConfig::ChromotocolConfig() { }
+SessionConfig::SessionConfig() { }
-ChromotocolConfig::ChromotocolConfig(const ChromotocolConfig& config)
+SessionConfig::SessionConfig(const SessionConfig& config)
: control_config_(config.control_config_),
event_config_(config.event_config_),
video_config_(config.video_config_),
initial_resolution_(config.initial_resolution_) {
}
-ChromotocolConfig::~ChromotocolConfig() { }
+SessionConfig::~SessionConfig() { }
-void ChromotocolConfig::SetControlConfig(const ChannelConfig& control_config) {
+void SessionConfig::SetControlConfig(const ChannelConfig& control_config) {
control_config_ = control_config;
}
-void ChromotocolConfig::SetEventConfig(const ChannelConfig& event_config) {
+void SessionConfig::SetEventConfig(const ChannelConfig& event_config) {
event_config_ = event_config;
}
-void ChromotocolConfig::SetVideoConfig(const ChannelConfig& video_config) {
+void SessionConfig::SetVideoConfig(const ChannelConfig& video_config) {
video_config_ = video_config;
}
-void ChromotocolConfig::SetInitialResolution(const ScreenResolution& resolution) {
+void SessionConfig::SetInitialResolution(const ScreenResolution& resolution) {
initial_resolution_ = resolution;
}
-ChromotocolConfig* ChromotocolConfig::Clone() const {
- return new ChromotocolConfig(*this);
+SessionConfig* SessionConfig::Clone() const {
+ return new SessionConfig(*this);
}
// static
-ChromotocolConfig* ChromotocolConfig::CreateDefault() {
- ChromotocolConfig* result = new ChromotocolConfig();
+SessionConfig* SessionConfig::CreateDefault() {
+ SessionConfig* result = new SessionConfig();
result->SetControlConfig(ChannelConfig(ChannelConfig::TRANSPORT_STREAM,
kDefaultStreamVersion,
ChannelConfig::CODEC_UNDEFINED));
result->SetEventConfig(ChannelConfig(ChannelConfig::TRANSPORT_STREAM,
- kDefaultStreamVersion,
- ChannelConfig::CODEC_UNDEFINED));
+ kDefaultStreamVersion,
+ ChannelConfig::CODEC_UNDEFINED));
result->SetVideoConfig(ChannelConfig(ChannelConfig::TRANSPORT_STREAM,
kDefaultStreamVersion,
ChannelConfig::CODEC_ZIP));
return result;
}
-CandidateChromotocolConfig::CandidateChromotocolConfig() { }
+CandidateSessionConfig::CandidateSessionConfig() { }
-CandidateChromotocolConfig::CandidateChromotocolConfig(
- const CandidateChromotocolConfig& config)
+CandidateSessionConfig::CandidateSessionConfig(
+ const CandidateSessionConfig& config)
: control_configs_(config.control_configs_),
event_configs_(config.event_configs_),
video_configs_(config.video_configs_),
initial_resolution_(config.initial_resolution_) {
}
-CandidateChromotocolConfig::~CandidateChromotocolConfig() { }
+CandidateSessionConfig::~CandidateSessionConfig() { }
-void CandidateChromotocolConfig::AddControlConfig(
+void CandidateSessionConfig::AddControlConfig(
const ChannelConfig& control_config) {
control_configs_.push_back(control_config);
}
-void CandidateChromotocolConfig::AddEventConfig(
+void CandidateSessionConfig::AddEventConfig(
const ChannelConfig& event_config) {
event_configs_.push_back(event_config);
}
-void CandidateChromotocolConfig::AddVideoConfig(
+void CandidateSessionConfig::AddVideoConfig(
const ChannelConfig& video_config) {
video_configs_.push_back(video_config);
}
-void CandidateChromotocolConfig::SetInitialResolution(
+void CandidateSessionConfig::SetInitialResolution(
const ScreenResolution& resolution) {
initial_resolution_ = resolution;
}
-ChromotocolConfig* CandidateChromotocolConfig::Select(
- const CandidateChromotocolConfig* client_config,
+SessionConfig* CandidateSessionConfig::Select(
+ const CandidateSessionConfig* client_config,
bool force_host_resolution) {
ChannelConfig control_config;
ChannelConfig event_config;
@@ -139,7 +140,7 @@ ChromotocolConfig* CandidateChromotocolConfig::Select(
return NULL;
}
- ChromotocolConfig* result = ChromotocolConfig::CreateDefault();
+ SessionConfig* result = SessionConfig::CreateDefault();
result->SetControlConfig(control_config);
result->SetEventConfig(event_config);
result->SetVideoConfig(video_config);
@@ -153,8 +154,8 @@ ChromotocolConfig* CandidateChromotocolConfig::Select(
return result;
}
-bool CandidateChromotocolConfig::IsSupported(
- const ChromotocolConfig* config) const {
+bool CandidateSessionConfig::IsSupported(
+ const SessionConfig* config) const {
return
IsChannelConfigSupported(control_configs_, config->control_config()) &&
IsChannelConfigSupported(event_configs_, config->event_config()) &&
@@ -162,14 +163,14 @@ bool CandidateChromotocolConfig::IsSupported(
config->initial_resolution().IsValid();
}
-ChromotocolConfig* CandidateChromotocolConfig::GetFinalConfig() const {
+SessionConfig* CandidateSessionConfig::GetFinalConfig() const {
if (control_configs_.size() != 1 ||
event_configs_.size() != 1 ||
video_configs_.size() != 1) {
return NULL;
}
- ChromotocolConfig* result = ChromotocolConfig::CreateDefault();
+ SessionConfig* result = SessionConfig::CreateDefault();
result->SetControlConfig(control_configs_.front());
result->SetEventConfig(event_configs_.front());
result->SetVideoConfig(video_configs_.front());
@@ -178,7 +179,7 @@ ChromotocolConfig* CandidateChromotocolConfig::GetFinalConfig() const {
}
// static
-bool CandidateChromotocolConfig::SelectCommonChannelConfig(
+bool CandidateSessionConfig::SelectCommonChannelConfig(
const std::vector<ChannelConfig>& host_configs,
const std::vector<ChannelConfig>& client_configs,
ChannelConfig* config) {
@@ -195,25 +196,25 @@ bool CandidateChromotocolConfig::SelectCommonChannelConfig(
}
// static
-bool CandidateChromotocolConfig::IsChannelConfigSupported(
+bool CandidateSessionConfig::IsChannelConfigSupported(
const std::vector<ChannelConfig>& vector,
const ChannelConfig& value) {
return std::find(vector.begin(), vector.end(), value) != vector.end();
}
-CandidateChromotocolConfig* CandidateChromotocolConfig::Clone() const {
- return new CandidateChromotocolConfig(*this);
+CandidateSessionConfig* CandidateSessionConfig::Clone() const {
+ return new CandidateSessionConfig(*this);
}
// static
-CandidateChromotocolConfig* CandidateChromotocolConfig::CreateEmpty() {
- return new CandidateChromotocolConfig();
+CandidateSessionConfig* CandidateSessionConfig::CreateEmpty() {
+ return new CandidateSessionConfig();
}
// static
-CandidateChromotocolConfig* CandidateChromotocolConfig::CreateFrom(
- const ChromotocolConfig* config) {
- CandidateChromotocolConfig* result = CreateEmpty();
+CandidateSessionConfig* CandidateSessionConfig::CreateFrom(
+ const SessionConfig* config) {
+ CandidateSessionConfig* result = CreateEmpty();
result->AddControlConfig(config->control_config());
result->AddEventConfig(config->event_config());
result->AddVideoConfig(config->video_config());
@@ -222,8 +223,8 @@ CandidateChromotocolConfig* CandidateChromotocolConfig::CreateFrom(
}
// static
-CandidateChromotocolConfig* CandidateChromotocolConfig::CreateDefault() {
- CandidateChromotocolConfig* result = CreateEmpty();
+CandidateSessionConfig* CandidateSessionConfig::CreateDefault() {
+ CandidateSessionConfig* result = CreateEmpty();
result->AddControlConfig(ChannelConfig(ChannelConfig::TRANSPORT_STREAM,
kDefaultStreamVersion,
ChannelConfig::CODEC_UNDEFINED));
@@ -240,4 +241,5 @@ CandidateChromotocolConfig* CandidateChromotocolConfig::CreateDefault() {
return result;
}
+} // namespace protocol
} // namespace remoting
diff --git a/remoting/protocol/chromotocol_config.h b/remoting/protocol/session_config.h
index aef2ecc..830ab79 100644
--- a/remoting/protocol/chromotocol_config.h
+++ b/remoting/protocol/session_config.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef REMOTING_PROTOCOL_CHROMOTOCOL_CONFIG_H_
-#define REMOTING_PROTOCOL_CHROMOTOCOL_CONFIG_H_
+#ifndef REMOTING_PROTOCOL_SESSION_CONFIG_H_
+#define REMOTING_PROTOCOL_SESSION_CONFIG_H_
#include <string>
#include <vector>
@@ -11,10 +11,13 @@
#include "base/basictypes.h"
namespace remoting {
+namespace protocol {
extern const int kDefaultStreamVersion;
// Struct for configuration parameters of a single channel.
+// Some channels (like video) may have multiple underlying sockets that need
+// to be configured simultaneously.
struct ChannelConfig {
enum TransportType {
TRANSPORT_STREAM,
@@ -54,11 +57,11 @@ struct ScreenResolution {
int height;
};
-// ChromotocolConfig is used by ChromotingConnection to store negotiated
+// SessionConfig is used by the chromoting Session to store negotiated
// chromotocol configuration.
-class ChromotocolConfig {
+class SessionConfig {
public:
- ~ChromotocolConfig();
+ ~SessionConfig();
const ChannelConfig& control_config() const { return control_config_; }
const ChannelConfig& event_config() const { return event_config_; }
@@ -72,14 +75,14 @@ class ChromotocolConfig {
void SetVideoConfig(const ChannelConfig& video_config);
void SetInitialResolution(const ScreenResolution& initial_resolution);
- ChromotocolConfig* Clone() const;
+ SessionConfig* Clone() const;
- static ChromotocolConfig* CreateDefault();
+ static SessionConfig* CreateDefault();
private:
- ChromotocolConfig();
- explicit ChromotocolConfig(const ChromotocolConfig& config);
- ChromotocolConfig& operator=(const ChromotocolConfig& b);
+ SessionConfig();
+ explicit SessionConfig(const SessionConfig& config);
+ SessionConfig& operator=(const SessionConfig& b);
ChannelConfig control_config_;
ChannelConfig event_config_;
@@ -88,11 +91,11 @@ class ChromotocolConfig {
};
// Defines session description that is sent from client to the host in the
-// session-initiate message. It is different from the regular ChromotocolConfig
+// session-initiate message. It is different from the regular Config
// because it allows one to specify multiple configurations for each channel.
-class CandidateChromotocolConfig {
+class CandidateSessionConfig {
public:
- ~CandidateChromotocolConfig();
+ ~CandidateSessionConfig();
const std::vector<ChannelConfig>& control_configs() const {
return control_configs_;
@@ -119,29 +122,28 @@ class CandidateChromotocolConfig {
// NULL is returned if such configuration doesn't exist. When selecting
// channel configuration priority is given to the configs listed first
// in |client_config|.
- ChromotocolConfig* Select(const CandidateChromotocolConfig* client_config,
- bool force_host_resolution);
+ SessionConfig* Select(const CandidateSessionConfig* client_config,
+ bool force_host_resolution);
// Returns true if |config| is supported.
- bool IsSupported(const ChromotocolConfig* config) const;
+ bool IsSupported(const SessionConfig* config) const;
// Extracts final protocol configuration. Must be used for the description
// received in the session-accept stanza. If the selection is ambiguous
// (e.g. there is more than one configuration for one of the channel)
// or undefined (e.g. no configurations for a channel) then NULL is returned.
- ChromotocolConfig* GetFinalConfig() const;
+ SessionConfig* GetFinalConfig() const;
- CandidateChromotocolConfig* Clone() const;
+ CandidateSessionConfig* Clone() const;
- static CandidateChromotocolConfig* CreateEmpty();
- static CandidateChromotocolConfig* CreateFrom(
- const ChromotocolConfig* config);
- static CandidateChromotocolConfig* CreateDefault();
+ static CandidateSessionConfig* CreateEmpty();
+ static CandidateSessionConfig* CreateFrom(const SessionConfig* config);
+ static CandidateSessionConfig* CreateDefault();
private:
- CandidateChromotocolConfig();
- explicit CandidateChromotocolConfig(const CandidateChromotocolConfig& config);
- CandidateChromotocolConfig& operator=(const CandidateChromotocolConfig& b);
+ CandidateSessionConfig();
+ explicit CandidateSessionConfig(const CandidateSessionConfig& config);
+ CandidateSessionConfig& operator=(const CandidateSessionConfig& b);
static bool SelectCommonChannelConfig(
const std::vector<ChannelConfig>& host_configs_,
@@ -157,6 +159,7 @@ class CandidateChromotocolConfig {
ScreenResolution initial_resolution_;
};
+} // namespace protocol
} // namespace remoting
-#endif // REMOTING_PROTOCOL_CHROMOTOCOL_CONFIG_H_
+#endif // REMOTING_PROTOCOL_SESSION_CONFIG_H_
diff --git a/remoting/protocol/session_manager.h b/remoting/protocol/session_manager.h
index ab8cdcf..f953e43 100644
--- a/remoting/protocol/session_manager.h
+++ b/remoting/protocol/session_manager.h
@@ -34,8 +34,8 @@
// configuration. The configuration specified in the session-accept is used
// for the session.
//
-// The CandidateChromotocolConfig class represents list of configurations
-// supported by an endpoint. The |chromotocol_config| argument in the Connect()
+// The CandidateSessionConfig class represents list of configurations
+// supported by an endpoint. The |candidate_config| argument in the Connect()
// specifies configuration supported on the client side. When the host receives
// session-initiate stanza, the IncomingSessionCallback is called. The
// configuration sent in the session-intiate staza is available via
@@ -55,7 +55,6 @@
class Task;
namespace remoting {
-
namespace protocol {
// Generic interface for Chromoting session manager.
@@ -78,10 +77,10 @@ class SessionManager : public base::RefCountedThreadSafe<SessionManager> {
IncomingSessionCallback;
// Initializes session to the host |jid|. Ownership of the
- // |chromotocol_config| is passed to the new session.
+ // |config| is passed to the new session.
virtual scoped_refptr<Session> Connect(
const std::string& jid,
- CandidateChromotocolConfig* chromotocol_config,
+ CandidateSessionConfig* config,
Session::StateChangeCallback* state_change_callback) = 0;
// Close session manager and all current sessions. |close_task| is executed
@@ -100,7 +99,6 @@ class SessionManager : public base::RefCountedThreadSafe<SessionManager> {
};
} // namespace protocol
-
} // namespace remoting
#endif // REMOTING_PROTOCOL_SESSION_MANAGER_H_
diff --git a/remoting/protocol/video_reader.cc b/remoting/protocol/video_reader.cc
index b026ac9..832eb04 100644
--- a/remoting/protocol/video_reader.cc
+++ b/remoting/protocol/video_reader.cc
@@ -4,7 +4,7 @@
#include "remoting/protocol/video_reader.h"
-#include "remoting/protocol/chromotocol_config.h"
+#include "remoting/protocol/session_config.h"
#include "remoting/protocol/protobuf_video_reader.h"
#include "remoting/protocol/rtp_video_reader.h"
@@ -14,7 +14,7 @@ namespace protocol {
VideoReader::~VideoReader() { }
// static
-VideoReader* VideoReader::Create(const ChromotocolConfig* config) {
+VideoReader* VideoReader::Create(const SessionConfig* config) {
const ChannelConfig& video_config = config->video_config();
if (video_config.transport == ChannelConfig::TRANSPORT_SRTP) {
return new RtpVideoReader();
diff --git a/remoting/protocol/video_reader.h b/remoting/protocol/video_reader.h
index 9ead3c9f..ab94913 100644
--- a/remoting/protocol/video_reader.h
+++ b/remoting/protocol/video_reader.h
@@ -14,24 +14,22 @@
namespace remoting {
-namespace protocol {
-class Session;
-} // namespace protocol
-
-class ChromotocolConfig;
class ChromotocolConnection;
namespace protocol {
+class Session;
+class SessionConfig;
+
class VideoReader {
public:
- static VideoReader* Create(const ChromotocolConfig* config);
+ static VideoReader* Create(const SessionConfig* config);
virtual ~VideoReader();
// Initializies the reader. Doesn't take ownership of either |connection|
// or |video_stub|.
- virtual void Init(protocol::Session* session,
+ virtual void Init(Session* session,
VideoStub* video_stub) = 0;
// Closes the reader. The stub should not be called after Close().
diff --git a/remoting/protocol/video_writer.cc b/remoting/protocol/video_writer.cc
index 6fc7a88..2336fe3 100644
--- a/remoting/protocol/video_writer.cc
+++ b/remoting/protocol/video_writer.cc
@@ -4,7 +4,7 @@
#include "remoting/protocol/video_writer.h"
-#include "remoting/protocol/chromotocol_config.h"
+#include "remoting/protocol/session_config.h"
#include "remoting/protocol/protobuf_video_writer.h"
#include "remoting/protocol/rtp_video_writer.h"
@@ -14,7 +14,7 @@ namespace protocol {
VideoWriter::~VideoWriter() { }
// static
-VideoWriter* VideoWriter::Create(const ChromotocolConfig* config) {
+VideoWriter* VideoWriter::Create(const SessionConfig* config) {
const ChannelConfig& video_config = config->video_config();
if (video_config.transport == ChannelConfig::TRANSPORT_SRTP) {
return new RtpVideoWriter();
diff --git a/remoting/protocol/video_writer.h b/remoting/protocol/video_writer.h
index 0b39bcb..eae6b6e 100644
--- a/remoting/protocol/video_writer.h
+++ b/remoting/protocol/video_writer.h
@@ -15,24 +15,22 @@
namespace remoting {
-namespace protocol {
-class Session;
-} // namespace protocol
-
-class ChromotocolConfig;
class ChromotocolConnection;
namespace protocol {
+class Session;
+class SessionConfig;
+
// TODO(sergeyu): VideoWriter should implement VideoStub interface.
class VideoWriter {
public:
virtual ~VideoWriter();
- static VideoWriter* Create(const ChromotocolConfig* config);
+ static VideoWriter* Create(const SessionConfig* config);
// Initializes the writer.
- virtual void Init(protocol::Session* session) = 0;
+ virtual void Init(Session* session) = 0;
// Sends the |packet|.
virtual void SendPacket(const VideoPacket& packet) = 0;