Index: webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc |
diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc |
index 56a309c59db9174454f0ef4750ba03fff0e31747..522489e921347ec4b25485452e834a43804fd30c 100644 |
--- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc |
+++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc |
@@ -64,6 +64,15 @@ std::vector<K> Keys(const std::map<K, V>& map) { |
return keys; |
} |
+uint32_t ConvertMsTo24Bits(int64_t time_ms) { |
+ uint32_t time_24_bits = |
+ static_cast<uint32_t>( |
+ ((static_cast<uint64_t>(time_ms) << kAbsSendTimeFraction) + 500) / |
+ 1000) & |
+ 0x00FFFFFF; |
+ return time_24_bits; |
+} |
+ |
bool RemoteBitrateEstimatorAbsSendTime::IsWithinClusterBounds( |
int send_delta_ms, |
const Cluster& cluster_aggregate) { |
@@ -219,12 +228,8 @@ bool RemoteBitrateEstimatorAbsSendTime::IsBitrateImproving( |
void RemoteBitrateEstimatorAbsSendTime::IncomingPacketFeedbackVector( |
const std::vector<PacketInfo>& packet_feedback_vector) { |
for (const auto& packet_info : packet_feedback_vector) { |
- // TODO(holmer): We should get rid of this conversion if possible as we may |
- // lose precision. |
- uint32_t send_time_32bits = (packet_info.send_time_ms) / kTimestampToMs; |
- uint32_t send_time_24bits = |
- send_time_32bits >> kAbsSendTimeInterArrivalUpshift; |
- IncomingPacketInfo(packet_info.arrival_time_ms, send_time_24bits, |
+ IncomingPacketInfo(packet_info.arrival_time_ms, |
+ ConvertMsTo24Bits(packet_info.send_time_ms), |
packet_info.payload_size, 0, packet_info.was_paced); |
} |
} |