summaryrefslogtreecommitdiffstats
path: root/media/cast/logging
diff options
context:
space:
mode:
authormiu <miu@chromium.org>2015-06-05 18:09:17 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-06 01:09:38 +0000
commit2398f82f74b4d279510d927b6f5643819af20ed5 (patch)
treec9ae097077ca69eba730de6e4edc6053a6c31940 /media/cast/logging
parent1b6797343bab734718a0c81136010863c0c56617 (diff)
downloadchromium_src-2398f82f74b4d279510d927b6f5643819af20ed5.zip
chromium_src-2398f82f74b4d279510d927b6f5643819af20ed5.tar.gz
chromium_src-2398f82f74b4d279510d927b6f5643819af20ed5.tar.bz2
[Cast] Add logging of frame resolution and encoding stats.
Adds logging of per-frame resolution and encoding performance stats. This will improve the real-world performance analysis of Cast Streaming sessions, especially when enabling the dynamic resolution and/or bitrate modes. BUG=156767 Review URL: https://codereview.chromium.org/1161213004 Cr-Commit-Position: refs/heads/master@{#333194}
Diffstat (limited to 'media/cast/logging')
-rw-r--r--media/cast/logging/encoding_event_subscriber.cc19
-rw-r--r--media/cast/logging/encoding_event_subscriber_unittest.cc50
-rw-r--r--media/cast/logging/logging_defines.cc6
-rw-r--r--media/cast/logging/logging_defines.h11
-rw-r--r--media/cast/logging/logging_impl.cc32
-rw-r--r--media/cast/logging/logging_impl.h15
-rw-r--r--media/cast/logging/logging_impl_unittest.cc5
-rw-r--r--media/cast/logging/logging_raw.cc46
-rw-r--r--media/cast/logging/logging_raw.h35
-rw-r--r--media/cast/logging/logging_raw_unittest.cc8
-rw-r--r--media/cast/logging/proto/raw_events.proto8
-rw-r--r--media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc20
-rw-r--r--media/cast/logging/serialize_deserialize_test.cc11
-rw-r--r--media/cast/logging/simple_event_subscriber_unittest.cc2
-rw-r--r--media/cast/logging/stats_event_subscriber_unittest.cc12
15 files changed, 221 insertions, 59 deletions
diff --git a/media/cast/logging/encoding_event_subscriber.cc b/media/cast/logging/encoding_event_subscriber.cc
index 2722524..82ec06f 100644
--- a/media/cast/logging/encoding_event_subscriber.cc
+++ b/media/cast/logging/encoding_event_subscriber.cc
@@ -9,6 +9,7 @@
#include <utility>
#include "base/logging.h"
+#include "base/numerics/safe_conversions.h"
#include "media/cast/logging/proto/proto_utils.h"
using google::protobuf::RepeatedPtrField;
@@ -93,10 +94,24 @@ void EncodingEventSubscriber::OnReceiveFrameEvent(
event_proto->add_event_timestamp_ms(
(frame_event.timestamp - base::TimeTicks()).InMilliseconds());
- if (frame_event.type == FRAME_ENCODED) {
+ if (frame_event.type == FRAME_CAPTURE_END) {
+ if (frame_event.media_type == VIDEO_EVENT &&
+ frame_event.width > 0 && frame_event.height > 0) {
+ event_proto->set_width(frame_event.width);
+ event_proto->set_height(frame_event.height);
+ }
+ } else if (frame_event.type == FRAME_ENCODED) {
event_proto->set_encoded_frame_size(frame_event.size);
+ if (frame_event.encoder_cpu_utilization >= 0.0) {
+ event_proto->set_encoder_cpu_percent_utilized(base::saturated_cast<int32>(
+ frame_event.encoder_cpu_utilization * 100.0 + 0.5));
+ }
+ if (frame_event.idealized_bitrate_utilization >= 0.0) {
+ event_proto->set_idealized_bitrate_percent_utilized(
+ base::saturated_cast<int32>(
+ frame_event.idealized_bitrate_utilization * 100.0 + 0.5));
+ }
if (frame_event.media_type == VIDEO_EVENT) {
- event_proto->set_encoded_frame_size(frame_event.size);
event_proto->set_key_frame(frame_event.key_frame);
event_proto->set_target_bitrate(frame_event.target_bitrate);
}
diff --git a/media/cast/logging/encoding_event_subscriber_unittest.cc b/media/cast/logging/encoding_event_subscriber_unittest.cc
index 0e33c5f..b052bbb 100644
--- a/media/cast/logging/encoding_event_subscriber_unittest.cc
+++ b/media/cast/logging/encoding_event_subscriber_unittest.cc
@@ -76,17 +76,25 @@ TEST_F(EncodingEventSubscriberTest, FrameEventTruncating) {
base::TimeTicks now(testing_clock_->NowTicks());
// Entry with RTP timestamp 0 should get dropped.
+ int width = 320;
+ int height = 180;
for (int i = 0; i < 11; i++) {
cast_environment_->Logging()->InsertFrameEvent(now,
FRAME_CAPTURE_BEGIN,
VIDEO_EVENT,
i * 100,
/*frame_id*/ 0);
+ cast_environment_->Logging()->InsertCapturedVideoFrameEvent(now,
+ i * 100,
+ width,
+ height);
cast_environment_->Logging()->InsertFrameEvent(now,
FRAME_DECODED,
VIDEO_EVENT,
i * 100,
/*frame_id*/ 0);
+ width += 160;
+ height += 90;
}
GetEventsAndReset();
@@ -94,6 +102,14 @@ TEST_F(EncodingEventSubscriberTest, FrameEventTruncating) {
ASSERT_EQ(10u, frame_events_.size());
EXPECT_EQ(100u, frame_events_.front()->relative_rtp_timestamp());
EXPECT_EQ(1000u, frame_events_.back()->relative_rtp_timestamp());
+ width = 320;
+ height = 180;
+ for (const auto& event : frame_events_) {
+ width += 160;
+ height += 90;
+ EXPECT_EQ(width, event->width());
+ EXPECT_EQ(height, event->height());
+ }
}
TEST_F(EncodingEventSubscriberTest, PacketEventTruncating) {
@@ -223,9 +239,12 @@ TEST_F(EncodingEventSubscriberTest, FrameEventSize) {
int size = 123;
bool key_frame = true;
int target_bitrate = 1024;
+ double encoder_cpu_utilization = 0.90;
+ double idealized_bitrate_utilization = 0.42;
cast_environment_->Logging()->InsertEncodedFrameEvent(
now, FRAME_ENCODED, VIDEO_EVENT, rtp_timestamp,
- /*frame_id*/ 0, size, key_frame, target_bitrate);
+ /*frame_id*/ 0, size, key_frame, target_bitrate,
+ encoder_cpu_utilization, idealized_bitrate_utilization);
GetEventsAndReset();
@@ -248,6 +267,8 @@ TEST_F(EncodingEventSubscriberTest, FrameEventSize) {
EXPECT_TRUE(event->has_key_frame());
EXPECT_EQ(key_frame, event->key_frame());
EXPECT_EQ(target_bitrate, event->target_bitrate());
+ EXPECT_EQ(90, event->encoder_cpu_percent_utilized());
+ EXPECT_EQ(42, event->idealized_bitrate_percent_utilized());
}
TEST_F(EncodingEventSubscriberTest, MultipleFrameEvents) {
@@ -264,7 +285,8 @@ TEST_F(EncodingEventSubscriberTest, MultipleFrameEvents) {
cast_environment_->Logging()->InsertEncodedFrameEvent(
now2, FRAME_ENCODED, AUDIO_EVENT, rtp_timestamp2,
/*frame_id*/ 0, /*size*/ 123, /* key_frame - unused */ false,
- /*target_bitrate - unused*/ 0);
+ /*target_bitrate - unused*/ 0,
+ 0.44, 0.55);
testing_clock_->Advance(base::TimeDelta::FromMilliseconds(20));
base::TimeTicks now3(testing_clock_->NowTicks());
@@ -306,6 +328,8 @@ TEST_F(EncodingEventSubscriberTest, MultipleFrameEvents) {
EXPECT_EQ(InMilliseconds(now2), event->event_timestamp_ms(0));
EXPECT_FALSE(event->has_key_frame());
+ EXPECT_EQ(44, event->encoder_cpu_percent_utilized());
+ EXPECT_EQ(55, event->idealized_bitrate_percent_utilized());
}
TEST_F(EncodingEventSubscriberTest, PacketEvent) {
@@ -526,11 +550,10 @@ TEST_F(EncodingEventSubscriberTest, FirstRtpTimestamp) {
rtp_timestamp,
/*frame_id*/ 0);
- cast_environment_->Logging()->InsertFrameEvent(now,
- FRAME_CAPTURE_END,
- VIDEO_EVENT,
- rtp_timestamp + 30,
- /*frame_id*/ 1);
+ cast_environment_->Logging()->InsertCapturedVideoFrameEvent(
+ now,
+ rtp_timestamp + 30,
+ 1280, 720);
GetEventsAndReset();
@@ -542,6 +565,8 @@ TEST_F(EncodingEventSubscriberTest, FirstRtpTimestamp) {
++it;
ASSERT_NE(frame_events_.end(), it);
EXPECT_EQ(30u, (*it)->relative_rtp_timestamp());
+ EXPECT_EQ(1280, (*it)->width());
+ EXPECT_EQ(720, (*it)->height());
rtp_timestamp = 67890;
@@ -567,11 +592,10 @@ TEST_F(EncodingEventSubscriberTest, RelativeRtpTimestampWrapAround) {
/*frame_id*/ 0);
// RtpTimestamp has now wrapped around.
- cast_environment_->Logging()->InsertFrameEvent(now,
- FRAME_CAPTURE_END,
- VIDEO_EVENT,
- rtp_timestamp + 30,
- /*frame_id*/ 1);
+ cast_environment_->Logging()->InsertCapturedVideoFrameEvent(
+ now,
+ rtp_timestamp + 30,
+ 1280, 720);
GetEventsAndReset();
@@ -582,6 +606,8 @@ TEST_F(EncodingEventSubscriberTest, RelativeRtpTimestampWrapAround) {
++it;
ASSERT_NE(frame_events_.end(), it);
EXPECT_EQ(30u, (*it)->relative_rtp_timestamp());
+ EXPECT_EQ(1280, (*it)->width());
+ EXPECT_EQ(720, (*it)->height());
}
TEST_F(EncodingEventSubscriberTest, MaxEventsPerProto) {
diff --git a/media/cast/logging/logging_defines.cc b/media/cast/logging/logging_defines.cc
index 05ceeb9..e240b2f 100644
--- a/media/cast/logging/logging_defines.cc
+++ b/media/cast/logging/logging_defines.cc
@@ -33,8 +33,10 @@ const char* CastLoggingToString(CastLoggingEvent event) {
}
FrameEvent::FrameEvent()
- : rtp_timestamp(0u), frame_id(kFrameIdUnknown), size(0u), type(UNKNOWN),
- media_type(UNKNOWN_EVENT), key_frame(false), target_bitrate(0) {}
+ : rtp_timestamp(0u), frame_id(kFrameIdUnknown), width(0), height(0),
+ size(0u), type(UNKNOWN), media_type(UNKNOWN_EVENT), key_frame(false),
+ target_bitrate(0), encoder_cpu_utilization(-1.0),
+ idealized_bitrate_utilization(-1.0) {}
FrameEvent::~FrameEvent() {}
PacketEvent::PacketEvent()
diff --git a/media/cast/logging/logging_defines.h b/media/cast/logging/logging_defines.h
index 0f57fe9..dc29554 100644
--- a/media/cast/logging/logging_defines.h
+++ b/media/cast/logging/logging_defines.h
@@ -55,7 +55,11 @@ struct FrameEvent {
RtpTimestamp rtp_timestamp;
uint32 frame_id;
- // Size of encoded frame. Only set for FRAME_ENCODED event.
+ // Resolution of the frame. Only set for video FRAME_CAPTURE_END events.
+ int width;
+ int height;
+
+ // Size of encoded frame in bytes. Only set for FRAME_ENCODED event.
size_t size;
// Time of event logged.
@@ -77,6 +81,11 @@ struct FrameEvent {
// The requested target bitrate of the encoder at the time the frame is
// encoded. Only set for video FRAME_ENCODED event.
int target_bitrate;
+
+ // Encoding performance metrics. See media/cast/sender/sender_encoded_frame.h
+ // for a description of these values.
+ double encoder_cpu_utilization;
+ double idealized_bitrate_utilization;
};
struct PacketEvent {
diff --git a/media/cast/logging/logging_impl.cc b/media/cast/logging/logging_impl.cc
index b5351e3..b64674f 100644
--- a/media/cast/logging/logging_impl.cc
+++ b/media/cast/logging/logging_impl.cc
@@ -28,16 +28,32 @@ void LoggingImpl::InsertFrameEvent(const base::TimeTicks& time_of_event,
rtp_timestamp, frame_id);
}
-void LoggingImpl::InsertEncodedFrameEvent(const base::TimeTicks& time_of_event,
- CastLoggingEvent event,
- EventMediaType event_media_type,
- uint32 rtp_timestamp,
- uint32 frame_id, int frame_size,
- bool key_frame,
- int target_bitrate) {
+void LoggingImpl::InsertCapturedVideoFrameEvent(
+ const base::TimeTicks& time_of_event,
+ uint32 rtp_timestamp,
+ int width,
+ int height) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ raw_.InsertCapturedVideoFrameEvent(
+ time_of_event, rtp_timestamp, width, height);
+}
+
+
+void LoggingImpl::InsertEncodedFrameEvent(
+ const base::TimeTicks& time_of_event,
+ CastLoggingEvent event,
+ EventMediaType event_media_type,
+ uint32 rtp_timestamp,
+ uint32 frame_id,
+ int encoded_size,
+ bool key_frame,
+ int target_bitrate,
+ double encoder_cpu_utilization,
+ double idealized_bitrate_utilization) {
DCHECK(thread_checker_.CalledOnValidThread());
raw_.InsertEncodedFrameEvent(time_of_event, event, event_media_type,
- rtp_timestamp, frame_id, frame_size, key_frame, target_bitrate);
+ rtp_timestamp, frame_id, encoded_size, key_frame, target_bitrate,
+ encoder_cpu_utilization, idealized_bitrate_utilization);
}
void LoggingImpl::InsertFrameEventWithDelay(
diff --git a/media/cast/logging/logging_impl.h b/media/cast/logging/logging_impl.h
index ba453c8..1fc3e76 100644
--- a/media/cast/logging/logging_impl.h
+++ b/media/cast/logging/logging_impl.h
@@ -29,12 +29,21 @@ class LoggingImpl {
CastLoggingEvent event, EventMediaType event_media_type,
uint32 rtp_timestamp, uint32 frame_id);
+ void InsertCapturedVideoFrameEvent(const base::TimeTicks& time_of_event,
+ uint32 rtp_timestamp,
+ int width,
+ int height);
+
void InsertEncodedFrameEvent(const base::TimeTicks& time_of_event,
CastLoggingEvent event,
EventMediaType event_media_type,
- uint32 rtp_timestamp, uint32 frame_id,
- int frame_size, bool key_frame,
- int target_bitrate);
+ uint32 rtp_timestamp,
+ uint32 frame_id,
+ int encoded_size,
+ bool key_frame,
+ int target_bitrate,
+ double encoder_cpu_utilization,
+ double idealized_bitrate_utilization);
void InsertFrameEventWithDelay(const base::TimeTicks& time_of_event,
CastLoggingEvent event,
diff --git a/media/cast/logging/logging_impl_unittest.cc b/media/cast/logging/logging_impl_unittest.cc
index eae1dcd..fb2779c 100644
--- a/media/cast/logging/logging_impl_unittest.cc
+++ b/media/cast/logging/logging_impl_unittest.cc
@@ -85,7 +85,8 @@ TEST_F(LoggingImplTest, FrameLoggingWithSize) {
sum_size += static_cast<size_t>(size);
logging_.InsertEncodedFrameEvent(testing_clock_.NowTicks(),
FRAME_ENCODED, VIDEO_EVENT, rtp_timestamp,
- frame_id, size, true, target_bitrate);
+ frame_id, size, true, target_bitrate,
+ 0.1, 2.3);
testing_clock_.Advance(base::TimeDelta::FromMilliseconds(kFrameIntervalMs));
rtp_timestamp += kFrameIntervalMs * 90;
++frame_id;
@@ -146,7 +147,7 @@ TEST_F(LoggingImplTest, MultipleEventFrameLogging) {
logging_.InsertEncodedFrameEvent(testing_clock_.NowTicks(),
FRAME_ENCODED, AUDIO_EVENT,
rtp_timestamp,
- frame_id, 1500, true, 0);
+ frame_id, 1500, true, 0, 4.5, 6.7);
} else if (frame_id % 3) {
logging_.InsertFrameEvent(testing_clock_.NowTicks(), FRAME_DECODED,
VIDEO_EVENT, rtp_timestamp, frame_id);
diff --git a/media/cast/logging/logging_raw.cc b/media/cast/logging/logging_raw.cc
index 229064d..b80c05e 100644
--- a/media/cast/logging/logging_raw.cc
+++ b/media/cast/logging/logging_raw.cc
@@ -22,18 +22,34 @@ void LoggingRaw::InsertFrameEvent(const base::TimeTicks& time_of_event,
uint32 rtp_timestamp,
uint32 frame_id) {
InsertBaseFrameEvent(time_of_event, event, event_media_type, frame_id,
- rtp_timestamp, base::TimeDelta(), 0, false, 0);
+ rtp_timestamp, base::TimeDelta(), 0, 0, 0, false, 0,
+ -1.0, -1.0);
+}
+
+void LoggingRaw::InsertCapturedVideoFrameEvent(
+ const base::TimeTicks& time_of_event,
+ uint32 rtp_timestamp,
+ int width,
+ int height) {
+ InsertBaseFrameEvent(time_of_event, FRAME_CAPTURE_END, VIDEO_EVENT,
+ kFrameIdUnknown, rtp_timestamp, base::TimeDelta(), width,
+ height, 0, false, 0, -1.0, -1.0);
}
void LoggingRaw::InsertEncodedFrameEvent(const base::TimeTicks& time_of_event,
CastLoggingEvent event,
EventMediaType event_media_type,
- uint32 rtp_timestamp, uint32 frame_id,
- int size, bool key_frame,
- int target_bitrate) {
+ uint32 rtp_timestamp,
+ uint32 frame_id,
+ int encoded_size,
+ bool key_frame,
+ int target_bitrate,
+ double encoder_cpu_utilization,
+ double idealized_bitrate_utilization) {
InsertBaseFrameEvent(time_of_event, event, event_media_type,
- frame_id, rtp_timestamp, base::TimeDelta(), size,
- key_frame, target_bitrate);
+ frame_id, rtp_timestamp, base::TimeDelta(),
+ 0, 0, encoded_size, key_frame, target_bitrate,
+ encoder_cpu_utilization, idealized_bitrate_utilization);
}
void LoggingRaw::InsertFrameEventWithDelay(const base::TimeTicks& time_of_event,
@@ -43,7 +59,7 @@ void LoggingRaw::InsertFrameEventWithDelay(const base::TimeTicks& time_of_event,
uint32 frame_id,
base::TimeDelta delay) {
InsertBaseFrameEvent(time_of_event, event, event_media_type, frame_id,
- rtp_timestamp, delay, 0, false, 0);
+ rtp_timestamp, delay, 0, 0, 0, false, 0, -1.0, -1.0);
}
void LoggingRaw::InsertBaseFrameEvent(const base::TimeTicks& time_of_event,
@@ -51,18 +67,28 @@ void LoggingRaw::InsertBaseFrameEvent(const base::TimeTicks& time_of_event,
EventMediaType event_media_type,
uint32 frame_id,
uint32 rtp_timestamp,
- base::TimeDelta delay, int size,
- bool key_frame, int target_bitrate) {
+ base::TimeDelta delay,
+ int width,
+ int height,
+ int encoded_size,
+ bool key_frame,
+ int target_bitrate,
+ double encoder_cpu_utilization,
+ double idealized_bitrate_utilization) {
FrameEvent frame_event;
frame_event.rtp_timestamp = rtp_timestamp;
frame_event.frame_id = frame_id;
- frame_event.size = size;
+ frame_event.width = width;
+ frame_event.height = height;
+ frame_event.size = encoded_size;
frame_event.timestamp = time_of_event;
frame_event.type = event;
frame_event.media_type = event_media_type;
frame_event.delay_delta = delay;
frame_event.key_frame = key_frame;
frame_event.target_bitrate = target_bitrate;
+ frame_event.encoder_cpu_utilization = encoder_cpu_utilization;
+ frame_event.idealized_bitrate_utilization = idealized_bitrate_utilization;
for (std::vector<RawEventSubscriber*>::const_iterator it =
subscribers_.begin();
it != subscribers_.end(); ++it) {
diff --git a/media/cast/logging/logging_raw.h b/media/cast/logging/logging_raw.h
index 8ed4a59..49ec985 100644
--- a/media/cast/logging/logging_raw.h
+++ b/media/cast/logging/logging_raw.h
@@ -30,18 +30,28 @@ class LoggingRaw : public base::NonThreadSafe {
CastLoggingEvent event, EventMediaType event_media_type,
uint32 rtp_timestamp, uint32 frame_id);
+ // Inserts a FRAME_CAPTURE_END event with the VIDEO_EVENT media type.
+ void InsertCapturedVideoFrameEvent(const base::TimeTicks& time_of_event,
+ uint32 rtp_timestamp,
+ int width,
+ int height);
+
// This function is only applicable for FRAME_ENCODED event.
- // |size| - Size of encoded frame.
+ // |encoded_size| - Size of encoded frame in bytes.
// |key_frame| - Whether the frame is a key frame. This field is only
// applicable for video event.
// |target_bitrate| - The target bitrate of the encoder the time the frame
// was encoded. Only applicable for video event.
void InsertEncodedFrameEvent(const base::TimeTicks& time_of_event,
- CastLoggingEvent event,
- EventMediaType event_media_type,
- uint32 rtp_timestamp, uint32 frame_id,
- int size, bool key_frame,
- int target_bitrate);
+ CastLoggingEvent event,
+ EventMediaType event_media_type,
+ uint32 rtp_timestamp,
+ uint32 frame_id,
+ int encoded_size,
+ bool key_frame,
+ int target_bitrate,
+ double encoder_cpu_utilization,
+ double idealized_bitrate_utilization);
// Render/playout delay
// This function is only applicable for FRAME_PLAYOUT event.
@@ -73,9 +83,16 @@ class LoggingRaw : public base::NonThreadSafe {
void InsertBaseFrameEvent(const base::TimeTicks& time_of_event,
CastLoggingEvent event,
EventMediaType event_media_type,
- uint32 frame_id, uint32 rtp_timestamp,
- base::TimeDelta delay, int size, bool key_frame,
- int target_bitrate);
+ uint32 frame_id,
+ uint32 rtp_timestamp,
+ base::TimeDelta delay,
+ int width,
+ int height,
+ int encoded_size,
+ bool key_frame,
+ int target_bitrate,
+ double encoder_cpu_utilization,
+ double idealized_bitrate_utilization);
// List of subscriber pointers. This class does not own the subscribers.
std::vector<RawEventSubscriber*> subscribers_;
diff --git a/media/cast/logging/logging_raw_unittest.cc b/media/cast/logging/logging_raw_unittest.cc
index 40a1ae5..0ecfbbf 100644
--- a/media/cast/logging/logging_raw_unittest.cc
+++ b/media/cast/logging/logging_raw_unittest.cc
@@ -56,8 +56,11 @@ TEST_F(LoggingRawTest, EncodedFrameEvent) {
int size = 1024;
bool key_frame = true;
int target_bitrate = 4096;
+ double encoder_cpu_utilization = 0.11;
+ double idealized_bitrate_utilization = 0.98;
raw_.InsertEncodedFrameEvent(timestamp, event_type, media_type,
- rtp_timestamp, frame_id, size, key_frame, target_bitrate);
+ rtp_timestamp, frame_id, size, key_frame, target_bitrate,
+ encoder_cpu_utilization, idealized_bitrate_utilization);
event_subscriber_.GetPacketEventsAndReset(&packet_events_);
EXPECT_TRUE(packet_events_.empty());
@@ -73,6 +76,9 @@ TEST_F(LoggingRawTest, EncodedFrameEvent) {
EXPECT_EQ(base::TimeDelta(), frame_events_[0].delay_delta);
EXPECT_EQ(key_frame, frame_events_[0].key_frame);
EXPECT_EQ(target_bitrate, frame_events_[0].target_bitrate);
+ EXPECT_EQ(encoder_cpu_utilization, frame_events_[0].encoder_cpu_utilization);
+ EXPECT_EQ(idealized_bitrate_utilization,
+ frame_events_[0].idealized_bitrate_utilization);
}
TEST_F(LoggingRawTest, FrameEventWithDelay) {
diff --git a/media/cast/logging/proto/raw_events.proto b/media/cast/logging/proto/raw_events.proto
index e9e75bc..3463998 100644
--- a/media/cast/logging/proto/raw_events.proto
+++ b/media/cast/logging/proto/raw_events.proto
@@ -127,6 +127,14 @@ message AggregatedFrameEvent {
// Only set if there is a video frame encoded event.
optional int32 target_bitrate = 7;
+
+ // Only set if there is a frame capture event.
+ optional int32 width = 8;
+ optional int32 height = 9;
+
+ // Only set if there is a frame encoded event.
+ optional int32 encoder_cpu_percent_utilized = 10;
+ optional int32 idealized_bitrate_percent_utilized = 11;
};
message BasePacketEvent {
diff --git a/media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc b/media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc
index bc1fc51..ca791d4 100644
--- a/media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc
+++ b/media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc
@@ -70,7 +70,9 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, EstimateOffset) {
frame_id,
1234,
true,
- 5678);
+ 5678,
+ 9.10,
+ 11.12);
cast_environment_->Logging()->InsertPacketEvent(
sender_clock_->NowTicks(),
@@ -133,7 +135,9 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, EventCArrivesBeforeEventB) {
frame_id,
1234,
true,
- 5678);
+ 5678,
+ 9.10,
+ 11.12);
cast_environment_->Logging()->InsertPacketEvent(
sender_clock_->NowTicks(),
@@ -201,7 +205,9 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, MultipleIterations) {
frame_id_a,
1234,
true,
- 5678);
+ 5678,
+ 9.10,
+ 11.12);
cast_environment_->Logging()->InsertPacketEvent(
sender_clock_->NowTicks(),
@@ -218,7 +224,9 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, MultipleIterations) {
frame_id_b,
1234,
true,
- 5678);
+ 5678,
+ 9.10,
+ 11.12);
cast_environment_->Logging()->InsertPacketEvent(
sender_clock_->NowTicks(),
@@ -266,7 +274,9 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, MultipleIterations) {
frame_id_c,
1234,
true,
- 5678);
+ 5678,
+ 9.10,
+ 11.12);
cast_environment_->Logging()->InsertPacketEvent(
sender_clock_->NowTicks(),
diff --git a/media/cast/logging/serialize_deserialize_test.cc b/media/cast/logging/serialize_deserialize_test.cc
index af36cda..f1766d0 100644
--- a/media/cast/logging/serialize_deserialize_test.cc
+++ b/media/cast/logging/serialize_deserialize_test.cc
@@ -28,8 +28,12 @@ const media::cast::CastLoggingEvent kVideoPacketEvents[] = {
media::cast::PACKET_SENT_TO_NETWORK, media::cast::PACKET_RECEIVED};
// The frame event fields cycle through these numbers.
+const int kWidth[] = {1280, 1280, 1280, 1280, 1920, 1920, 1920, 1920};
+const int kHeight[] = {720, 720, 720, 720, 1080, 1080, 1080, 1080};
const int kEncodedFrameSize[] = {512, 425, 399, 400, 237};
const int64 kDelayMillis[] = {15, 4, 8, 42, 23, 16};
+const int kEncoderCPUPercentUtilized[] = {10, 9, 42, 3, 11, 12, 15, 7};
+const int kIdealizedBitratePercentUtilized[] = {9, 9, 9, 15, 36, 38, 35, 40};
const int kMaxSerializedBytes = 10000;
@@ -63,9 +67,16 @@ class SerializeDeserializeTest : public ::testing::Test {
frame_event->add_event_timestamp_ms(event_time_ms);
event_time_ms += 1024;
}
+ frame_event->set_width(kWidth[i % arraysize(kWidth)]);
+ frame_event->set_height(kHeight[i % arraysize(kHeight)]);
frame_event->set_encoded_frame_size(
kEncodedFrameSize[i % arraysize(kEncodedFrameSize)]);
frame_event->set_delay_millis(kDelayMillis[i % arraysize(kDelayMillis)]);
+ frame_event->set_encoder_cpu_percent_utilized(kEncoderCPUPercentUtilized[
+ i % arraysize(kEncoderCPUPercentUtilized)]);
+ frame_event->set_idealized_bitrate_percent_utilized(
+ kIdealizedBitratePercentUtilized[
+ i % arraysize(kIdealizedBitratePercentUtilized)]);
frame_event_list_.push_back(frame_event);
}
diff --git a/media/cast/logging/simple_event_subscriber_unittest.cc b/media/cast/logging/simple_event_subscriber_unittest.cc
index 653eecd..bf2c210 100644
--- a/media/cast/logging/simple_event_subscriber_unittest.cc
+++ b/media/cast/logging/simple_event_subscriber_unittest.cc
@@ -43,7 +43,7 @@ TEST_F(SimpleEventSubscriberTest, GetAndResetEvents) {
cast_environment_->Logging()->InsertEncodedFrameEvent(
testing_clock_->NowTicks(), FRAME_ENCODED, AUDIO_EVENT,
/*rtp_timestamp*/ 100u, /*frame_id*/ 0u, /*frame_size*/ 123,
- /*key_frame*/ false, 0);
+ /*key_frame*/ false, 0, 0.01, 0.02);
cast_environment_->Logging()->InsertFrameEventWithDelay(
testing_clock_->NowTicks(), FRAME_PLAYOUT, AUDIO_EVENT,
/*rtp_timestamp*/ 100u,
diff --git a/media/cast/logging/stats_event_subscriber_unittest.cc b/media/cast/logging/stats_event_subscriber_unittest.cc
index 4501454..bd6da06 100644
--- a/media/cast/logging/stats_event_subscriber_unittest.cc
+++ b/media/cast/logging/stats_event_subscriber_unittest.cc
@@ -99,7 +99,9 @@ TEST_F(StatsEventSubscriberTest, CaptureEncode) {
frame_id,
1024,
true,
- 5678);
+ 5678,
+ 9.10,
+ 11.12);
} else if (i < extra_frames) {
dropped_frames++;
}
@@ -159,7 +161,9 @@ TEST_F(StatsEventSubscriberTest, Encode) {
frame_id,
size,
true,
- 5678);
+ 5678,
+ 9.10,
+ 11.12);
last_event_time = sender_clock_->NowTicks();
AdvanceClocks(base::TimeDelta::FromMicroseconds(35678));
@@ -553,7 +557,9 @@ TEST_F(StatsEventSubscriberTest, Histograms) {
frame_id,
1024,
true,
- 5678);
+ 5678,
+ 9.10,
+ 11.12);
}
// Send 3 packets for the last frame.