修复除0的bug

This commit is contained in:
ziyue 2021-08-22 15:13:20 +08:00
parent 10afab77f3
commit b3ad0891e6
2 changed files with 4 additions and 1 deletions

View File

@ -219,6 +219,7 @@ bool DtsGenerator::getDts_l(uint32_t pts, uint32_t &dts){
} }
void NtpStamp::setNtpStamp(uint32_t rtp_stamp, uint32_t sample_rate, uint64_t ntp_stamp_ms) { void NtpStamp::setNtpStamp(uint32_t rtp_stamp, uint32_t sample_rate, uint64_t ntp_stamp_ms) {
assert(sample_rate);
update(uint64_t(rtp_stamp) * 1000 / sample_rate, ntp_stamp_ms); update(uint64_t(rtp_stamp) * 1000 / sample_rate, ntp_stamp_ms);
} }

View File

@ -103,8 +103,10 @@ RtpPacket::Ptr RtpTrack::inputRtp(TrackType type, int sample_rate, uint8_t *ptr,
void RtpTrack::setNtpStamp(uint32_t rtp_stamp, uint32_t sample_rate, uint64_t ntp_stamp_ms) { void RtpTrack::setNtpStamp(uint32_t rtp_stamp, uint32_t sample_rate, uint64_t ntp_stamp_ms) {
_disable_ntp = rtp_stamp == 0 && sample_rate == 0 && ntp_stamp_ms == 0; _disable_ntp = rtp_stamp == 0 && sample_rate == 0 && ntp_stamp_ms == 0;
if (sample_rate) {
_ntp_stamp.setNtpStamp(rtp_stamp, sample_rate, ntp_stamp_ms); _ntp_stamp.setNtpStamp(rtp_stamp, sample_rate, ntp_stamp_ms);
} }
}
//////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////