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

Unified Diff: media/cast/logging/log_serializer.cc

Issue 1515433002: Replace uses of raw uint32's with a type-checked RtpTimeTicks data type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forgot to include a comment change in cast_messages.h. Created 5 years 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: media/cast/logging/log_serializer.cc
diff --git a/media/cast/logging/log_serializer.cc b/media/cast/logging/log_serializer.cc
index c5cb252d781a3bc6bee05f58c4350335e948818c..e3c5048c0d0c44a2b1a760c14fba7811b9b18791 100644
--- a/media/cast/logging/log_serializer.cc
+++ b/media/cast/logging/log_serializer.cc
@@ -54,7 +54,7 @@ bool DoSerializeEvents(const LogMetadata& metadata,
if (!writer.Skip(proto_size))
return false;
- RtpTimestamp prev_rtp_timestamp = 0;
+ RtpTimeTicks prev_rtp_timestamp;
for (media::cast::FrameEventList::const_iterator it = frame_events.begin();
it != frame_events.end();
++it) {
@@ -63,11 +63,11 @@ bool DoSerializeEvents(const LogMetadata& metadata,
// Adjust relative RTP timestamp so that it is relative to previous frame,
// rather than relative to first RTP timestamp.
// This is done to improve encoding size.
- RtpTimestamp old_relative_rtp_timestamp =
- frame_event.relative_rtp_timestamp();
+ const RtpTimeTicks rtp_timestamp =
+ prev_rtp_timestamp.Expand(frame_event.relative_rtp_timestamp());
frame_event.set_relative_rtp_timestamp(
- old_relative_rtp_timestamp - prev_rtp_timestamp);
- prev_rtp_timestamp = old_relative_rtp_timestamp;
+ (rtp_timestamp - prev_rtp_timestamp).lower_32_bits());
+ prev_rtp_timestamp = rtp_timestamp;
proto_size = frame_event.ByteSize();
DCHECK(proto_size <= kMaxSerializedProtoBytes);
@@ -82,16 +82,17 @@ bool DoSerializeEvents(const LogMetadata& metadata,
}
// Write packet events.
- prev_rtp_timestamp = 0;
+ prev_rtp_timestamp = RtpTimeTicks();
for (media::cast::PacketEventList::const_iterator it = packet_events.begin();
it != packet_events.end();
++it) {
media::cast::proto::AggregatedPacketEvent packet_event(**it);
- RtpTimestamp old_relative_rtp_timestamp =
- packet_event.relative_rtp_timestamp();
+
+ const RtpTimeTicks rtp_timestamp =
+ prev_rtp_timestamp.Expand(packet_event.relative_rtp_timestamp());
packet_event.set_relative_rtp_timestamp(
- old_relative_rtp_timestamp - prev_rtp_timestamp);
- prev_rtp_timestamp = old_relative_rtp_timestamp;
+ (rtp_timestamp - prev_rtp_timestamp).lower_32_bits());
+ prev_rtp_timestamp = rtp_timestamp;
proto_size = packet_event.ByteSize();
DCHECK(proto_size <= kMaxSerializedProtoBytes);

Powered by Google App Engine
This is Rietveld 408576698