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

Unified Diff: remoting/protocol/webrtc_connection_to_host.cc

Issue 1580823003: Implement client-side video stream support for WebRTC-based protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@packet_options_rem
Patch Set: Created 4 years, 11 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
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 9733163a3e1cf86e1fd98061531710e50f149a65..1cf0c306824c9bef6039bdefb9ba5e096ba7685c 100644
--- a/remoting/protocol/webrtc_connection_to_host.cc
+++ b/remoting/protocol/webrtc_connection_to_host.cc
@@ -12,7 +12,9 @@
#include "remoting/protocol/client_stub.h"
#include "remoting/protocol/clipboard_stub.h"
#include "remoting/protocol/transport_context.h"
+#include "remoting/protocol/video_renderer.h"
#include "remoting/protocol/webrtc_transport.h"
+#include "remoting/protocol/webrtc_video_renderer_adapter.h"
namespace remoting {
namespace protocol {
@@ -64,7 +66,7 @@ void WebrtcConnectionToHost::set_clipboard_stub(ClipboardStub* clipboard_stub) {
}
void WebrtcConnectionToHost::set_video_renderer(VideoRenderer* video_renderer) {
- NOTIMPLEMENTED();
+ video_renderer_ = video_renderer;
}
void WebrtcConnectionToHost::set_audio_stub(AudioStub* audio_stub) {
@@ -88,9 +90,13 @@ void WebrtcConnectionToHost::OnSessionStateChange(Session::State state) {
break;
case Session::CLOSED:
+ CloseChannels();
+ SetState(CLOSED, OK);
+ break;
+
case Session::FAILED:
CloseChannels();
- SetState(CLOSED, state == Session::FAILED ? session_->error() : OK);
+ SetState(FAILED, session_->error());
break;
}
}
@@ -112,6 +118,18 @@ void WebrtcConnectionToHost::OnWebrtcTransportError(ErrorCode error) {
SetState(FAILED, error);
}
+void WebrtcConnectionToHost::OnWebrtcTransportMediaStreamAdded(
+ scoped_refptr<webrtc::MediaStreamInterface> stream) {
+ video_adapter_.reset(new WebrtcVideoRendererAdapter(
+ stream, video_renderer_->GetFrameConsumer()));
Jamie 2016/01/12 21:00:04 Does this add an additional stream, or replace the
Sergey Ulanov 2016/01/12 22:13:45 Done.
+}
+
+void WebrtcConnectionToHost::OnWebrtcTransportMediaStreamRemoved(
+ scoped_refptr<webrtc::MediaStreamInterface> stream) {
+ if (video_adapter_ && video_adapter_->label() == stream->label())
+ video_adapter_.reset();
+}
+
void WebrtcConnectionToHost::OnChannelInitialized(
ChannelDispatcherBase* channel_dispatcher) {
NotifyIfChannelsReady();

Powered by Google App Engine
This is Rietveld 408576698