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 d5116542d6bfbc08bfd4eceab9de1ab0d4f1bf63..0ac958b60c8bb29db13d89393a3d4bb41f076d73 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 rtp, |
- uint32 packet_id, |
+ RtpTimeTicks rtp, |
+ uint16_t packet_id, |
bool audio, |
base::TimeTicks t) { |
- uint64 key = (static_cast<uint64>(rtp) << 32) | (packet_id << 1) | |
- static_cast<uint64>(audio); |
+ const uint64_t key = MakeEventKey(rtp, packet_id, audio); |
events_[key].first = t; |
CheckUpdate(key); |
} |
void ReceiverTimeOffsetEstimatorImpl::BoundCalculator::SetReceived( |
- uint32 rtp, |
- uint16 packet_id, |
+ RtpTimeTicks rtp, |
+ uint16_t packet_id, |
bool audio, |
base::TimeTicks t) { |
- uint64 key = (static_cast<uint64>(rtp) << 32) | (packet_id << 1) | |
- static_cast<uint64>(audio); |
+ const uint64_t key = MakeEventKey(rtp, packet_id, audio); |
events_[key].second = t; |
CheckUpdate(key); |
} |