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

Unified Diff: media/cast/logging/receiver_time_offset_estimator_impl.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: Speculative workaround fix for win8_chromium_ng compile error. 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/receiver_time_offset_estimator_impl.cc
diff --git a/media/cast/logging/receiver_time_offset_estimator_impl.cc b/media/cast/logging/receiver_time_offset_estimator_impl.cc
index db80fc4ab83b12bb9dd7eeeb7aff71b172de9d90..4a8459744ee8772e73d2f024e5f822f585f40f54 100644
--- a/media/cast/logging/receiver_time_offset_estimator_impl.cc
+++ b/media/cast/logging/receiver_time_offset_estimator_impl.cc
@@ -12,28 +12,38 @@
namespace media {
namespace cast {
+namespace {
+
+// Bitwise merging of values to produce an ordered key for entries in the
+// BoundCalculator::events_ map.
+uint64_t MakeEventKey(RtpTimeTicks rtp, uint16_t packet_id, bool audio) {
+ return (static_cast<uint64_t>(rtp.lower_32_bits()) << 32) |
+ (static_cast<uint64_t>(packet_id) << 1) |
+ (audio ? UINT64_C(1) : UINT64_C(0));
+}
+
+} // namespace
+
ReceiverTimeOffsetEstimatorImpl::BoundCalculator::BoundCalculator()
: has_bound_(false) {}
ReceiverTimeOffsetEstimatorImpl::BoundCalculator::~BoundCalculator() {}
void ReceiverTimeOffsetEstimatorImpl::BoundCalculator::SetSent(
- uint32_t rtp,
- uint32_t packet_id,
+ RtpTimeTicks rtp,
+ uint16_t packet_id,
bool audio,
base::TimeTicks t) {
- uint64_t key = (static_cast<uint64_t>(rtp) << 32) | (packet_id << 1) |
- static_cast<uint64_t>(audio);
+ const uint64_t key = MakeEventKey(rtp, packet_id, audio);
events_[key].first = t;
CheckUpdate(key);
}
void ReceiverTimeOffsetEstimatorImpl::BoundCalculator::SetReceived(
- uint32_t rtp,
+ RtpTimeTicks rtp,
uint16_t packet_id,
bool audio,
base::TimeTicks t) {
- uint64_t key = (static_cast<uint64_t>(rtp) << 32) | (packet_id << 1) |
- static_cast<uint64_t>(audio);
+ const uint64_t key = MakeEventKey(rtp, packet_id, audio);
events_[key].second = t;
CheckUpdate(key);
}

Powered by Google App Engine
This is Rietveld 408576698