summaryrefslogtreecommitdiffstats
path: root/remoting/protocol/audio_reader.cc
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-18 04:17:23 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-18 04:17:23 +0000
commit3e9187d08a26fb43a360a468c18b670bae2dd3b0 (patch)
tree7e3f0071f447b2ef76c2e6d11c08a9bc25e90911 /remoting/protocol/audio_reader.cc
parent2c539b896f7cd8e1ff6a1209418a5c7d15b3b6bc (diff)
downloadchromium_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/audio_reader.cc')
-rw-r--r--remoting/protocol/audio_reader.cc34
1 files changed, 4 insertions, 30 deletions
diff --git a/remoting/protocol/audio_reader.cc b/remoting/protocol/audio_reader.cc
index 4269176..9723201 100644
--- a/remoting/protocol/audio_reader.cc
+++ b/remoting/protocol/audio_reader.cc
@@ -14,14 +14,12 @@ namespace remoting {
namespace protocol {
AudioReader::AudioReader(AudioPacket::Encoding encoding)
- : session_(NULL),
+ : ChannelDispatcherBase(kAudioChannelName),
encoding_(encoding),
audio_stub_(NULL) {
}
AudioReader::~AudioReader() {
- if (session_)
- session_->CancelChannelCreation(kAudioChannelName);
}
// static
@@ -32,33 +30,9 @@ scoped_ptr<AudioReader> AudioReader::Create(const SessionConfig& config) {
return scoped_ptr<AudioReader>(new AudioReader(AudioPacket::ENCODING_RAW));
}
-void AudioReader::Init(protocol::Session* session,
- AudioStub* audio_stub,
- const InitializedCallback& callback) {
- session_ = session;
- initialized_callback_ = callback;
- audio_stub_ = audio_stub;
-
- session_->CreateStreamChannel(
- kAudioChannelName,
- base::Bind(&AudioReader::OnChannelReady, base::Unretained(this)));
-}
-
-bool AudioReader::is_connected() {
- return channel_.get() != NULL;
-}
-
-void AudioReader::OnChannelReady(scoped_ptr<net::StreamSocket> socket) {
- if (!socket.get()) {
- initialized_callback_.Run(false);
- return;
- }
-
- DCHECK(!channel_.get());
- channel_ = socket.Pass();
- reader_.Init(channel_.get(), base::Bind(&AudioReader::OnNewData,
- base::Unretained(this)));
- initialized_callback_.Run(true);
+void AudioReader::OnInitialized() {
+ reader_.Init(channel(), base::Bind(&AudioReader::OnNewData,
+ base::Unretained(this)));
}
void AudioReader::OnNewData(scoped_ptr<AudioPacket> packet,