Fix overflow due to rounding in AbsoluteSendTime::To24Bits
Actual rounding is not important for this time as long it is consistent during the call: only difference between two absolute send time matter Rounding down avoids producing 1 < 24 when value is close to the wrap around boundary. Bug: None Change-Id: Ibbf5bae21bc37eccdc5d4c130a59796ee5108017 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/268001 Commit-Queue: Åsa Persson <asapersson@webrtc.org> Auto-Submit: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Åsa Persson <asapersson@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37468}
This commit is contained in:
parent
0be8eba07e
commit
a17651f7d8
@ -26,7 +26,6 @@
|
||||
#include "api/video/video_rotation.h"
|
||||
#include "api/video/video_timing.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "rtc_base/numerics/divide_round.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -45,7 +44,7 @@ class AbsoluteSendTime {
|
||||
|
||||
static constexpr uint32_t To24Bits(Timestamp time) {
|
||||
int64_t time_us = time.us() % (int64_t{1 << 6} * 1'000'000);
|
||||
int64_t time6x18 = DivideRoundToNearest(time_us << 18, 1'000'000);
|
||||
int64_t time6x18 = (time_us << 18) / 1'000'000;
|
||||
RTC_DCHECK_GE(time6x18, 0);
|
||||
RTC_DCHECK_LT(time6x18, 1 << 24);
|
||||
return static_cast<uint32_t>(time6x18);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user