OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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/client_video_stats_dispatcher.h" | |
6 | |
7 #include <utility> | |
8 | |
9 #include "base/bind.h" | |
10 #include "base/callback_helpers.h" | |
11 #include "net/socket/stream_socket.h" | |
12 #include "remoting/base/compound_buffer.h" | |
13 #include "remoting/proto/video_stats.pb.h" | |
14 #include "remoting/protocol/frame_stats.h" | |
15 #include "remoting/protocol/message_pipe.h" | |
16 #include "remoting/protocol/message_serialization.h" | |
17 #include "remoting/protocol/video_stats_stub.h" | |
18 | |
19 namespace remoting { | |
20 namespace protocol { | |
21 | |
22 ClientVideoStatsDispatcher::ClientVideoStatsDispatcher( | |
23 const std::string& stream_name, | |
24 VideoStatsStub* video_stats_stub) | |
25 : ChannelDispatcherBase(kVideoStatsChannelNamePrefix + stream_name), | |
Jamie
2016/07/22 17:13:52
Did you consider passing the stream name in the pr
Sergey Ulanov
2016/07/22 17:47:47
Yes. I think it would make code more complex in ca
| |
26 video_stats_stub_(video_stats_stub) {} | |
27 | |
28 ClientVideoStatsDispatcher::~ClientVideoStatsDispatcher() {} | |
29 | |
30 void ClientVideoStatsDispatcher::OnIncomingMessage( | |
31 std::unique_ptr<CompoundBuffer> message) { | |
32 std::unique_ptr<FrameStatsMessage> stats_proto = | |
33 ParseMessage<FrameStatsMessage>(message.get()); | |
34 if (!stats_proto) | |
35 return; | |
36 | |
37 if (!stats_proto->has_frame_id()) { | |
38 LOG(ERROR) << "Received invalid FrameStatsMessage."; | |
39 return; | |
40 } | |
41 video_stats_stub_->OnVideoFrameStats( | |
42 stats_proto->frame_id(), | |
43 HostFrameStats::FromFrameStatsMessage(*stats_proto)); | |
44 } | |
45 | |
46 } // namespace protocol | |
47 } // namespace remoting | |
OLD | NEW |