diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-18 04:17:23 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-18 04:17:23 +0000 |
commit | 3e9187d08a26fb43a360a468c18b670bae2dd3b0 (patch) | |
tree | 7e3f0071f447b2ef76c2e6d11c08a9bc25e90911 /remoting/protocol/jingle_session.cc | |
parent | 2c539b896f7cd8e1ff6a1209418a5c7d15b3b6bc (diff) | |
download | chromium_src-3e9187d08a26fb43a360a468c18b670bae2dd3b0.zip chromium_src-3e9187d08a26fb43a360a468c18b670bae2dd3b0.tar.gz chromium_src-3e9187d08a26fb43a360a468c18b670bae2dd3b0.tar.bz2 |
Add support for multiplexed channels in remoting::protocol::Session interface.
Now the Session interface has two methods that return channel factories - one for regular channels and one for multiplexed channels.
Also refactored AudioReader and AudioWriter to inherit from
ChannelDispatcherBase.
BUG=137135
Review URL: https://chromiumcodereview.appspot.com/10823323
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152240 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/protocol/jingle_session.cc')
-rw-r--r-- | remoting/protocol/jingle_session.cc | 73 |
1 files changed, 45 insertions, 28 deletions
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc index 814e09f..bcf105b 100644 --- a/remoting/protocol/jingle_session.cc +++ b/remoting/protocol/jingle_session.cc @@ -13,6 +13,7 @@ #include "remoting/jingle_glue/iq_sender.h" #include "remoting/protocol/authenticator.h" #include "remoting/protocol/channel_authenticator.h" +#include "remoting/protocol/channel_multiplexer.h" #include "remoting/protocol/content_description.h" #include "remoting/protocol/jingle_messages.h" #include "remoting/protocol/jingle_session_manager.h" @@ -38,6 +39,9 @@ const int kTransportInfoSendDelayMs = 2; // |transport-info|. const int kMessageResponseTimeoutSeconds = 10; +// Name of the multiplexed channel. +const char kMuxChannelName[] = "mux"; + ErrorCode AuthRejectionReasonToErrorCode( Authenticator::RejectionReason reason) { switch (reason) { @@ -61,6 +65,7 @@ JingleSession::JingleSession(JingleSessionManager* session_manager) } JingleSession::~JingleSession() { + channel_multiplexer_.reset(); STLDeleteContainerPointers(pending_requests_.begin(), pending_requests_.end()); STLDeleteContainerPairSecondPointers(channels_.begin(), channels_.end()); @@ -170,6 +175,46 @@ void JingleSession::AcceptIncomingConnection( return; } +const std::string& JingleSession::jid() { + DCHECK(CalledOnValidThread()); + return peer_jid_; +} + +const CandidateSessionConfig* JingleSession::candidate_config() { + DCHECK(CalledOnValidThread()); + return candidate_config_.get(); +} + +const SessionConfig& JingleSession::config() { + DCHECK(CalledOnValidThread()); + return config_; +} + +void JingleSession::set_config(const SessionConfig& config) { + DCHECK(CalledOnValidThread()); + DCHECK(!config_is_set_); + config_ = config; + config_is_set_ = true; +} + +ChannelFactory* JingleSession::GetTransportChannelFactory() { + DCHECK(CalledOnValidThread()); + return this; +} + +ChannelFactory* JingleSession::GetMultiplexedChannelFactory() { + DCHECK(CalledOnValidThread()); + if (!channel_multiplexer_.get()) + channel_multiplexer_.reset(new ChannelMultiplexer(this, kMuxChannelName)); + return channel_multiplexer_.get(); +} + +void JingleSession::Close() { + DCHECK(CalledOnValidThread()); + + CloseInternal(OK); +} + void JingleSession::CreateStreamChannel( const std::string& name, const StreamChannelCallback& callback) { @@ -206,34 +251,6 @@ void JingleSession::CancelChannelCreation(const std::string& name) { } } -const std::string& JingleSession::jid() { - DCHECK(CalledOnValidThread()); - return peer_jid_; -} - -const CandidateSessionConfig* JingleSession::candidate_config() { - DCHECK(CalledOnValidThread()); - return candidate_config_.get(); -} - -const SessionConfig& JingleSession::config() { - DCHECK(CalledOnValidThread()); - return config_; -} - -void JingleSession::set_config(const SessionConfig& config) { - DCHECK(CalledOnValidThread()); - DCHECK(!config_is_set_); - config_ = config; - config_is_set_ = true; -} - -void JingleSession::Close() { - DCHECK(CalledOnValidThread()); - - CloseInternal(OK); -} - void JingleSession::OnTransportCandidate(Transport* transport, const cricket::Candidate& candidate) { pending_candidates_.push_back(JingleMessage::NamedCandidate( |