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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtp_sender.cc

Issue 1412683004: Fix bug in how send timestamps are converted to 24 bits. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: some stuff Created 5 years, 2 months 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: webrtc/modules/rtp_rtcp/source/rtp_sender.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc
index 1a56c632b372fffe0bd5cf7131f64af093eb4758..ac5ed7e326510a98619588046a3435b66528780a 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc
@@ -26,8 +26,9 @@
namespace webrtc {
// Max in the RFC 3550 is 255 bytes, we limit it to be modulus 32 for SRTP.
-const size_t kMaxPaddingLength = 224;
-const int kSendSideDelayWindowMs = 1000;
+static const size_t kMaxPaddingLength = 224;
+static const int kSendSideDelayWindowMs = 1000;
+static const uint32_t kAbsSendTimeFraction = 18;
namespace {
@@ -45,6 +46,16 @@ const char* FrameTypeToString(FrameType frame_type) {
return "";
}
+// TODO(holmer): Merge this with the implementation in
+// remote_bitrate_estimator_abs_send_time.cc.
+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;
+}
} // namespace
class BitrateAggregator {
@@ -1596,7 +1607,7 @@ void RTPSender::UpdateAbsoluteSendTime(uint8_t* rtp_packet,
// Update absolute send time field (convert ms to 24-bit unsigned with 18 bit
// fractional part).
ByteWriter<uint32_t, 3>::WriteBigEndian(rtp_packet + offset + 1,
- ((now_ms << 18) / 1000) & 0x00ffffff);
+ ConvertMsTo24Bits(now_ms));
}
uint16_t RTPSender::UpdateTransportSequenceNumber(

Powered by Google App Engine
This is Rietveld 408576698