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

Unified Diff: remoting/protocol/webrtc_connection_to_host.cc

Issue 2146213002: Add support for dynamic channels in WebrtcTransport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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/webrtc_connection_to_host.h ('k') | remoting/protocol/webrtc_data_stream_adapter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/webrtc_connection_to_host.cc
diff --git a/remoting/protocol/webrtc_connection_to_host.cc b/remoting/protocol/webrtc_connection_to_host.cc
index cadcef833055938d5e8dfb9979a820842b3df5d0..c4deea51c3ff4fd401b731a36607cccd51dedf9a 100644
--- a/remoting/protocol/webrtc_connection_to_host.cc
+++ b/remoting/protocol/webrtc_connection_to_host.cc
@@ -11,6 +11,7 @@
#include "remoting/protocol/client_event_dispatcher.h"
#include "remoting/protocol/client_stub.h"
#include "remoting/protocol/clipboard_stub.h"
+#include "remoting/protocol/message_pipe.h"
#include "remoting/protocol/transport_context.h"
#include "remoting/protocol/video_renderer.h"
#include "remoting/protocol/webrtc_transport.h"
@@ -102,11 +103,6 @@ void WebrtcConnectionToHost::OnSessionStateChange(Session::State state) {
}
void WebrtcConnectionToHost::OnWebrtcTransportConnecting() {
- control_dispatcher_.reset(new ClientControlDispatcher());
- control_dispatcher_->Init(transport_->incoming_channel_factory(), this);
- control_dispatcher_->set_client_stub(client_stub_);
- control_dispatcher_->set_clipboard_stub(clipboard_stub_);
-
event_dispatcher_.reset(new ClientEventDispatcher());
event_dispatcher_->Init(transport_->outgoing_channel_factory(), this);
}
@@ -118,6 +114,19 @@ void WebrtcConnectionToHost::OnWebrtcTransportError(ErrorCode error) {
SetState(FAILED, error);
}
+void WebrtcConnectionToHost::OnWebrtcTransportIncomingDataChannel(
+ const std::string& name,
+ std::unique_ptr<MessagePipe> pipe) {
+ if (!control_dispatcher_)
+ control_dispatcher_.reset(new ClientControlDispatcher());
+ if (name == control_dispatcher_->channel_name() &&
+ !control_dispatcher_->is_connected()) {
+ control_dispatcher_->set_client_stub(client_stub_);
+ control_dispatcher_->set_clipboard_stub(clipboard_stub_);
+ control_dispatcher_->Init(std::move(pipe), this);
+ }
+}
+
void WebrtcConnectionToHost::OnWebrtcTransportMediaStreamAdded(
scoped_refptr<webrtc::MediaStreamInterface> stream) {
if (video_adapter_) {
@@ -138,6 +147,13 @@ void WebrtcConnectionToHost::OnChannelInitialized(
NotifyIfChannelsReady();
}
+void WebrtcConnectionToHost::OnChannelClosed(
+ ChannelDispatcherBase* channel_dispatcher) {
+ LOG(ERROR) << "Channel " << channel_dispatcher->channel_name()
+ << " was closed unexpectedly.";
+ SetState(FAILED, INCOMPATIBLE_PROTOCOL);
+}
+
ConnectionToHost::State WebrtcConnectionToHost::state() const {
return state_;
}
« no previous file with comments | « remoting/protocol/webrtc_connection_to_host.h ('k') | remoting/protocol/webrtc_data_stream_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698