Skip to content

Commit a6b445c

Browse files
David Kilzerphiln
authored andcommitted
Avoid divide-by-zero in webrtc::StreamStatisticianImpl::BitrateReceived
https://bugs.webkit.org/show_bug.cgi?id=264718 <rdar://117912996> Reviewed by Youenn Fablet. Merge upstream 7dbf55437f109cb13d131d91ba645029686fa247 by Harald Alvestrand <hta@webrtc.org>. * Source/ThirdParty/libwebrtc/Source/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc: * Source/ThirdParty/libwebrtc/Source/webrtc/test/fuzzers/utils/rtp_replayer.cc: -- Ensure payload type frequency does not cause divide-by-zero This CL does 2 things: - Change the DCHECK for payload_type_frequency to a CHECK (so that this error will be a crash not a divide-by-zero) - Change the replay helper that was used by the fuzzer to set the frequency of the packets to the video value (90K). Bug: chromium:1466826 Change-Id: I39941f250b1782b36a3bcddfd347a016591466ec Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/312700 Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#40468} Canonical link: https://commits.webkit.org/270656@main
1 parent f00b46e commit a6b445c

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

Source/ThirdParty/libwebrtc/Source/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ bool StreamStatisticianImpl::IsRetransmitOfOldPacket(
313313
const RtpPacketReceived& packet,
314314
int64_t now_ms) const {
315315
uint32_t frequency_khz = packet.payload_type_frequency() / 1000;
316-
RTC_DCHECK_GT(frequency_khz, 0);
316+
RTC_CHECK_GT(frequency_khz, 0);
317317

318318
int64_t time_diff_ms = now_ms - last_receive_time_ms_;
319319

Source/ThirdParty/libwebrtc/Source/webrtc/test/fuzzers/utils/rtp_replayer.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ void RtpReplayer::ReplayPackets(
187187
RTC_LOG(LS_ERROR) << "Packet error, corrupt packets or incorrect setup?";
188188
break;
189189
}
190+
// Set the clock rate - always 90K for video
191+
received_packet.set_payload_type_frequency(kVideoPayloadTypeFrequency);
190192

191193
call->Receiver()->DeliverRtpPacket(
192194
MediaType::VIDEO, std::move(received_packet),

0 commit comments

Comments
 (0)