Index: remoting/protocol/audio_reader.cc |
diff --git a/remoting/protocol/audio_reader.cc b/remoting/protocol/audio_reader.cc |
index 4269176f1db9baa0a83dcd598928abe7cf197995..9723201ec72afb8e1775d57a271107ee7eaf98f2 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, |