Fix undefined behavior in getTimestampFromSeconds()
@@ -1 +1 @@
-Subproject commit 2e8b40713acc3733e56de35800dfbdb496cedaef
+Subproject commit 4baf059f0aef40ad4f112ed767f246a0ec81be88
@@ -68,6 +68,10 @@ using std::weak_ptr;
using binary = std::vector<byte>;
using binary_ptr = std::shared_ptr<binary>;
+using std::int16_t;
+using std::int32_t;
+using std::int64_t;
+using std::int8_t;
using std::ptrdiff_t;
using std::size_t;
using std::uint16_t;
@@ -64,7 +64,7 @@ double RtpPacketizationConfig::timestampToSeconds(uint32_t timestamp) {
}
uint32_t RtpPacketizationConfig::getTimestampFromSeconds(double seconds, uint32_t clockRate) {
- return uint32_t(seconds * clockRate);
+ return uint32_t(int64_t(seconds * double(clockRate))); // convert to integer then cast to u32
uint32_t RtpPacketizationConfig::secondsToTimestamp(double seconds) {