blob: bc23cfda952374990f04fe4e7a84b0f353db75d4 [file] [log] [blame]
sergeyu2385cffe2014-09-19 19:23:411// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "remoting/protocol/host_video_dispatcher.h"
6
sergeyu89d088b2015-12-24 00:22:447#include <utility>
8
sergeyu2385cffe2014-09-19 19:23:419#include "base/bind.h"
10#include "net/socket/stream_socket.h"
sergeyuf1005f62016-02-03 21:11:3011#include "remoting/base/compound_buffer.h"
sergeyu2385cffe2014-09-19 19:23:4112#include "remoting/base/constants.h"
sergeyud8af2ca2016-01-30 03:04:3613#include "remoting/proto/video.pb.h"
sergeyuf1005f62016-02-03 21:11:3014#include "remoting/protocol/message_pipe.h"
sergeyu2385cffe2014-09-19 19:23:4115#include "remoting/protocol/message_serialization.h"
sergeyu97568a8162015-02-24 18:00:5516#include "remoting/protocol/video_feedback_stub.h"
sergeyu2385cffe2014-09-19 19:23:4117
18namespace remoting {
19namespace protocol {
20
21HostVideoDispatcher::HostVideoDispatcher()
sergeyud8af2ca2016-01-30 03:04:3622 : ChannelDispatcherBase(kVideoChannelName) {}
Chris Watkins6fe52aa2017-11-28 03:24:0523HostVideoDispatcher::~HostVideoDispatcher() = default;
sergeyu2385cffe2014-09-19 19:23:4124
dcheng0765c492016-04-06 22:41:5325void HostVideoDispatcher::ProcessVideoPacket(
26 std::unique_ptr<VideoPacket> packet,
Erik Jensen56d7f2e2019-02-20 01:38:5627 base::OnceClosure done) {
28 message_pipe()->Send(packet.get(), std::move(done));
sergeyu2385cffe2014-09-19 19:23:4129}
30
sergeyud8af2ca2016-01-30 03:04:3631void HostVideoDispatcher::OnIncomingMessage(
dcheng0765c492016-04-06 22:41:5332 std::unique_ptr<CompoundBuffer> message) {
33 std::unique_ptr<VideoAck> ack = ParseMessage<VideoAck>(message.get());
sergeyud8af2ca2016-01-30 03:04:3634 if (!ack)
35 return;
sergeyu97568a8162015-02-24 18:00:5536 if (video_feedback_stub_)
sergeyuaa6fa2342015-12-22 23:26:4837 video_feedback_stub_->ProcessVideoAck(std::move(ack));
sergeyu97568a8162015-02-24 18:00:5538}
39
sergeyu2385cffe2014-09-19 19:23:4140} // namespace protocol
41} // namespace remoting