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

Side by Side Diff: remoting/protocol/client_video_stats_dispatcher.cc

Issue 2176443002: Add client and host dispatchers for video_stats channel to send video stats from host to client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simple_channel
Patch Set: . Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « remoting/protocol/client_video_stats_dispatcher.h ('k') | remoting/protocol/frame_stats.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « remoting/protocol/client_video_stats_dispatcher.h ('k') | remoting/protocol/frame_stats.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698