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

Unified Diff: remoting/protocol/frame_stats.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 side-by-side diff with in-line comments
Download patch
Index: remoting/protocol/frame_stats.cc
diff --git a/remoting/protocol/frame_stats.cc b/remoting/protocol/frame_stats.cc
index 37ec56e94a0e7902ade0ce340ab4e6d61288043e..80bf7c296db4b855b4ece9b92158b64c20302508 100644
--- a/remoting/protocol/frame_stats.cc
+++ b/remoting/protocol/frame_stats.cc
@@ -5,6 +5,7 @@
#include "remoting/protocol/frame_stats.h"
#include "remoting/proto/video.pb.h"
+#include "remoting/proto/video_stats.pb.h"
namespace remoting {
namespace protocol {
@@ -54,6 +55,75 @@ HostFrameStats HostFrameStats::GetForVideoPacket(const VideoPacket& packet) {
return result;
}
+// static
+HostFrameStats HostFrameStats::FromFrameStatsMessage(
+ const FrameStatsMessage& message) {
+ HostFrameStats result;
+ result.frame_size = message.frame_size();
+ if (message.has_latest_event_timestamp()) {
+ result.latest_event_timestamp =
+ base::TimeTicks::FromInternalValue(message.latest_event_timestamp());
+ }
+ if (message.has_capture_time_ms()) {
+ result.capture_delay =
+ base::TimeDelta::FromMilliseconds(message.capture_time_ms());
+ }
+ if (message.has_encode_time_ms()) {
+ result.encode_delay =
+ base::TimeDelta::FromMilliseconds(message.encode_time_ms());
+ }
+ if (message.has_capture_pending_time_ms()) {
+ result.capture_pending_delay =
+ base::TimeDelta::FromMilliseconds(message.capture_pending_time_ms());
+ }
+ if (message.has_capture_overhead_time_ms()) {
+ result.capture_overhead_delay =
+ base::TimeDelta::FromMilliseconds(message.capture_overhead_time_ms());
+ }
+ if (message.has_encode_pending_time_ms()) {
+ result.encode_pending_delay =
+ base::TimeDelta::FromMilliseconds(message.encode_pending_time_ms());
+ }
+
+ if (message.has_send_pending_time_ms()) {
+ result.send_pending_delay =
+ base::TimeDelta::FromMilliseconds(message.send_pending_time_ms());
+ }
+
+ return result;
+}
+
+void HostFrameStats::ToFrameStatsMessage(FrameStatsMessage* message_out) const {
+ message_out->set_frame_size(frame_size);
+
+ if (!latest_event_timestamp.is_null()) {
+ message_out->set_latest_event_timestamp(
+ latest_event_timestamp.ToInternalValue());
+ }
+ if (capture_delay != base::TimeDelta::Max()) {
+ message_out->set_capture_time_ms(capture_delay.InMilliseconds());
+ }
+ if (encode_delay != base::TimeDelta::Max()) {
+ message_out->set_encode_time_ms(encode_delay.InMilliseconds());
+ }
+ if (capture_pending_delay != base::TimeDelta::Max()) {
+ message_out->set_capture_pending_time_ms(
+ capture_pending_delay.InMilliseconds());
+ }
+ if (capture_overhead_delay != base::TimeDelta::Max()) {
+ message_out->set_capture_overhead_time_ms(
+ capture_overhead_delay.InMilliseconds());
+ }
+ if (encode_pending_delay != base::TimeDelta::Max()) {
+ message_out->set_encode_pending_time_ms(
+ encode_pending_delay.InMilliseconds());
+ }
+ if (send_pending_delay != base::TimeDelta::Max()) {
+ message_out->set_send_pending_time_ms(send_pending_delay.InMilliseconds());
+ }
+
+}
+
FrameStats::FrameStats() = default;
FrameStats::FrameStats(const FrameStats&) = default;
FrameStats::~FrameStats() = default;

Powered by Google App Engine
This is Rietveld 408576698