Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Unified Diff: remoting/protocol/audio_writer.cc

Issue 10823323: Add support for multiplexed channels in remoting::protocol::Session interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/audio_writer.h ('k') | remoting/protocol/channel_dispatcher_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/audio_writer.cc
diff --git a/remoting/protocol/audio_writer.cc b/remoting/protocol/audio_writer.cc
index 4b786a14de4f3dc81038b508b05ec3a7ecf67a86..37c90ed33e54f80fbc0993a57dad70676e253a19 100644
--- a/remoting/protocol/audio_writer.cc
+++ b/remoting/protocol/audio_writer.cc
@@ -16,53 +16,20 @@ namespace remoting {
namespace protocol {
AudioWriter::AudioWriter()
- : session_(NULL) {
+ : ChannelDispatcherBase(kAudioChannelName) {
}
AudioWriter::~AudioWriter() {
- Close();
}
-void AudioWriter::Init(protocol::Session* session,
- const InitializedCallback& callback) {
- session_ = session;
- initialized_callback_ = callback;
-
- session_->CreateStreamChannel(
- kAudioChannelName,
- base::Bind(&AudioWriter::OnChannelReady, base::Unretained(this)));
-}
-
-void AudioWriter::OnChannelReady(scoped_ptr<net::StreamSocket> socket) {
- if (!socket.get()) {
- initialized_callback_.Run(false);
- return;
- }
-
- DCHECK(!channel_.get());
- channel_ = socket.Pass();
- // TODO(sergeyu): Provide WriteFailedCallback for the buffered writer.
+void AudioWriter::OnInitialized() {
+ // TODO(sergeyu): Provide a non-null WriteFailedCallback for the writer.
buffered_writer_.Init(
- channel_.get(), BufferedSocketWriter::WriteFailedCallback());
-
- initialized_callback_.Run(true);
-}
-
-void AudioWriter::Close() {
- buffered_writer_.Close();
- channel_.reset();
- if (session_) {
- session_->CancelChannelCreation(kAudioChannelName);
- session_ = NULL;
- }
-}
-
-bool AudioWriter::is_connected() {
- return channel_.get() != NULL;
+ channel(), BufferedSocketWriter::WriteFailedCallback());
}
void AudioWriter::ProcessAudioPacket(scoped_ptr<AudioPacket> packet,
- const base::Closure& done) {
+ const base::Closure& done) {
buffered_writer_.Write(SerializeAndFrameMessage(*packet), done);
}
« no previous file with comments | « remoting/protocol/audio_writer.h ('k') | remoting/protocol/channel_dispatcher_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698