Fix uninitialized value warning in rtp_payload_registry and make sure we return an error if the payload type isn't registered.

R=pbos@webrtc.org, xians@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/1782004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4321 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org 2013-07-10 12:42:15 +00:00
parent 452d853c43
commit 9de89a6f6b
2 changed files with 4 additions and 0 deletions

View File

@ -103,6 +103,7 @@ int32_t RTPPayloadRegistry::RegisterReceivePayload(
if (ModuleRTPUtility::StringCompare(payload_name, "red", 3)) {
red_payload_type_ = payload_type;
payload = new ModuleRTPUtility::Payload;
memset(payload, 0, sizeof(*payload));
payload->audio = false;
payload->name[RTP_PAYLOAD_NAME_SIZE - 1] = 0;
strncpy(payload->name, payload_name, RTP_PAYLOAD_NAME_SIZE - 1);

View File

@ -2184,6 +2184,9 @@ int32_t Channel::ReceivedRTPPacket(const int8_t* data, int32_t length) {
}
header.payload_type_frequency =
rtp_payload_registry_->GetPayloadTypeFrequency(header.payloadType);
if (header.payload_type_frequency < 0) {
return -1;
}
bool retransmitted = IsPacketRetransmitted(header);
bool in_order = rtp_receiver_->InOrderPacket(header.sequenceNumber);
rtp_receive_statistics_->IncomingPacket(header, static_cast<uint16_t>(length),