From 08933a5dfb2c9d9b55ebd513daece26465b7d3e2 Mon Sep 17 00:00:00 2001 From: "pbos@webrtc.org" Date: Wed, 10 Jul 2013 10:06:29 +0000 Subject: [PATCH] Initialize payload-type frequency in channel.cc. Uninitialized values triggered divide-by-zero crashes in voe_auto_test. BUG= R=stefan@webrtc.org, xians@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1780004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4319 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/modules/rtp_rtcp/source/rtp_payload_registry.cc | 1 + webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc | 2 ++ webrtc/voice_engine/channel.cc | 2 ++ 3 files changed, 5 insertions(+) diff --git a/webrtc/modules/rtp_rtcp/source/rtp_payload_registry.cc b/webrtc/modules/rtp_rtcp/source/rtp_payload_registry.cc index dee05fe428..db56d789ec 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_payload_registry.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_payload_registry.cc @@ -304,6 +304,7 @@ class RTPPayloadAudioStrategy : public RTPPayloadStrategy { ModuleRTPUtility::Payload* payload = new ModuleRTPUtility::Payload; payload->name[RTP_PAYLOAD_NAME_SIZE - 1] = 0; strncpy(payload->name, payloadName, RTP_PAYLOAD_NAME_SIZE - 1); + assert(frequency >= 1000); payload->typeSpecific.Audio.frequency = frequency; payload->typeSpecific.Audio.channels = channels; payload->typeSpecific.Audio.rate = rate; diff --git a/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc b/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc index a1b44d8c46..4c4a76014a 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc @@ -334,6 +334,8 @@ bool RtpReceiverImpl::RetransmitOfOldPacket(const RTPHeader& header, CriticalSectionScoped cs(critical_section_rtp_receiver_); uint32_t frequency_khz = header.payload_type_frequency / 1000; + assert(frequency_khz > 0); + int64_t time_diff_ms = clock_->TimeInMilliseconds() - last_receive_time_; diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc index b6b8c292f1..fdd2f6ce4c 100644 --- a/webrtc/voice_engine/channel.cc +++ b/webrtc/voice_engine/channel.cc @@ -2182,6 +2182,8 @@ int32_t Channel::ReceivedRTPPacket(const int8_t* data, int32_t length) { "IncomingPacket invalid RTP header"); return -1; } + header.payload_type_frequency = + rtp_payload_registry_->GetPayloadTypeFrequency(header.payloadType); bool retransmitted = IsPacketRetransmitted(header); bool in_order = rtp_receiver_->InOrderPacket(header.sequenceNumber); rtp_receive_statistics_->IncomingPacket(header, static_cast(length),