Chromium Code Reviews| 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(); |