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

Unified Diff: remoting/protocol/connection_to_host.cc

Issue 10532211: Added piping for sending audio packets from host to client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed unittests Created 8 years, 6 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/connection_to_host.h ('k') | remoting/protocol/content_description.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/connection_to_host.cc
diff --git a/remoting/protocol/connection_to_host.cc b/remoting/protocol/connection_to_host.cc
index 296439bf0d6ef6d3285bd5c278ab3cdb24f8df83..6b785bb833b603edbb9ea0a578ee0439265a4a50 100644
--- a/remoting/protocol/connection_to_host.cc
+++ b/remoting/protocol/connection_to_host.cc
@@ -10,6 +10,8 @@
#include "remoting/base/constants.h"
#include "remoting/jingle_glue/javascript_signal_strategy.h"
#include "remoting/jingle_glue/xmpp_signal_strategy.h"
+#include "remoting/protocol/audio_reader.h"
+#include "remoting/protocol/audio_stub.h"
#include "remoting/protocol/auth_util.h"
#include "remoting/protocol/authenticator.h"
#include "remoting/protocol/client_control_dispatcher.h"
@@ -33,6 +35,7 @@ ConnectionToHost::ConnectionToHost(
client_stub_(NULL),
clipboard_stub_(NULL),
video_stub_(NULL),
+ audio_stub_(NULL),
state_(CONNECTING),
error_(OK) {
}
@@ -62,11 +65,13 @@ void ConnectionToHost::Connect(scoped_refptr<XmppProxy> xmpp_proxy,
HostEventCallback* event_callback,
ClientStub* client_stub,
ClipboardStub* clipboard_stub,
- VideoStub* video_stub) {
+ VideoStub* video_stub,
+ AudioStub* audio_stub) {
event_callback_ = event_callback;
client_stub_ = client_stub;
clipboard_stub_ = clipboard_stub;
video_stub_ = video_stub;
+ audio_stub_ = audio_stub;
authenticator_ = authenticator.Pass();
// Save jid of the host. The actual connection is created later after
@@ -162,6 +167,12 @@ void ConnectionToHost::OnSessionStateChange(
video_reader_->Init(session_.get(), video_stub_, base::Bind(
&ConnectionToHost::OnChannelInitialized, base::Unretained(this)));
+ audio_reader_ = AudioReader::Create(session_->config());
+ if (audio_reader_.get()) {
+ audio_reader_->Init(session_.get(), audio_stub_, base::Bind(
+ &ConnectionToHost::OnChannelInitialized, base::Unretained(this)));
+ }
+
control_dispatcher_.reset(new ClientControlDispatcher());
control_dispatcher_->Init(session_.get(), base::Bind(
&ConnectionToHost::OnChannelInitialized, base::Unretained(this)));
@@ -208,15 +219,23 @@ void ConnectionToHost::OnChannelInitialized(bool successful) {
}
void ConnectionToHost::NotifyIfChannelsReady() {
- if (control_dispatcher_.get() && control_dispatcher_->is_connected() &&
- event_dispatcher_.get() && event_dispatcher_->is_connected() &&
- video_reader_.get() && video_reader_->is_connected() &&
- state_ == CONNECTING) {
- // Start forwarding clipboard and input events.
- clipboard_forwarder_.set_clipboard_stub(control_dispatcher_.get());
- event_forwarder_.set_input_stub(event_dispatcher_.get());
- SetState(CONNECTED, OK);
+ if (!control_dispatcher_.get() || !control_dispatcher_->is_connected())
+ return;
+ if (!event_dispatcher_.get() || !event_dispatcher_->is_connected())
+ return;
+ if (!video_reader_.get() || !video_reader_->is_connected())
+ return;
+ if ((!audio_reader_.get() || !audio_reader_->is_connected()) &&
+ session_->config().is_audio_enabled()) {
+ return;
}
+ if (state_ != CONNECTING)
+ return;
+
+ // Start forwarding clipboard and input events.
+ clipboard_forwarder_.set_clipboard_stub(control_dispatcher_.get());
+ event_forwarder_.set_input_stub(event_dispatcher_.get());
+ SetState(CONNECTED, OK);
}
void ConnectionToHost::CloseOnError(ErrorCode error) {
@@ -230,6 +249,7 @@ void ConnectionToHost::CloseChannels() {
clipboard_forwarder_.set_clipboard_stub(NULL);
event_forwarder_.set_input_stub(NULL);
video_reader_.reset();
+ audio_reader_.reset();
}
void ConnectionToHost::SetState(State state, ErrorCode error) {
« no previous file with comments | « remoting/protocol/connection_to_host.h ('k') | remoting/protocol/content_description.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698