diff options
-rw-r--r-- | remoting/client/input_handler.cc | 36 | ||||
-rw-r--r-- | remoting/protocol/video_reader.cc | 5 |
2 files changed, 25 insertions, 16 deletions
diff --git a/remoting/client/input_handler.cc b/remoting/client/input_handler.cc index 87c3c89..7048e73 100644 --- a/remoting/client/input_handler.cc +++ b/remoting/client/input_handler.cc @@ -19,31 +19,37 @@ InputHandler::InputHandler(ClientContext* context, } void InputHandler::SendKeyEvent(bool press, int keycode) { - KeyEvent* event = new KeyEvent(); - event->set_key(keycode); - event->set_pressed(press); - protocol::InputStub* stub = connection_->input_stub(); - stub->InjectKeyEvent(event, new DeleteTask<KeyEvent>(event)); + if (stub) { + KeyEvent* event = new KeyEvent(); + event->set_key(keycode); + event->set_pressed(press); + + stub->InjectKeyEvent(event, new DeleteTask<KeyEvent>(event)); + } } void InputHandler::SendMouseMoveEvent(int x, int y) { - MouseEvent* event = new MouseEvent(); - event->set_x(x); - event->set_y(y); - protocol::InputStub* stub = connection_->input_stub(); - stub->InjectMouseEvent(event, new DeleteTask<MouseEvent>(event)); + if (stub) { + MouseEvent* event = new MouseEvent(); + event->set_x(x); + event->set_y(y); + + stub->InjectMouseEvent(event, new DeleteTask<MouseEvent>(event)); + } } void InputHandler::SendMouseButtonEvent(bool button_down, MouseButton button) { - MouseEvent* event = new MouseEvent(); - event->set_button(button); - event->set_button_down(button_down); - protocol::InputStub* stub = connection_->input_stub(); - stub->InjectMouseEvent(event, new DeleteTask<MouseEvent>(event)); + if (stub) { + MouseEvent* event = new MouseEvent(); + event->set_button(button); + event->set_button_down(button_down); + + stub->InjectMouseEvent(event, new DeleteTask<MouseEvent>(event)); + } } } // namespace remoting diff --git a/remoting/protocol/video_reader.cc b/remoting/protocol/video_reader.cc index 2c1585a..b3bc5ed 100644 --- a/remoting/protocol/video_reader.cc +++ b/remoting/protocol/video_reader.cc @@ -19,11 +19,14 @@ VideoReader* VideoReader::Create(const SessionConfig* config) { if (video_config.transport == ChannelConfig::TRANSPORT_SRTP) { return new RtpVideoReader(); } else if (video_config.transport == ChannelConfig::TRANSPORT_STREAM) { - if (video_config.codec == ChannelConfig::CODEC_ZIP) + if (video_config.codec == ChannelConfig::CODEC_VP8) + return new ProtobufVideoReader(VideoPacketFormat::ENCODING_VP8); + else if (video_config.codec == ChannelConfig::CODEC_ZIP) return new ProtobufVideoReader(VideoPacketFormat::ENCODING_ZLIB); else if (video_config.codec == ChannelConfig::CODEC_VERBATIM) return new ProtobufVideoReader(VideoPacketFormat::ENCODING_VERBATIM); } + NOTREACHED(); return NULL; } |