Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Unified Diff: webrtc/modules/rtp_rtcp/source/rtp_receiver_audio.cc

Issue 2870043003: Handle padded audio packets correctly (Closed)
Patch Set: Second review Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtp_receiver_audio.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_receiver_audio.cc b/webrtc/modules/rtp_rtcp/source/rtp_receiver_audio.cc
index acc5926e5b5829db837678226958890b0f90ebb8..e3237948fb323e3b6a152d82f03b6338e5e7690c 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_receiver_audio.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_receiver_audio.cc
@@ -212,9 +212,10 @@ int32_t RTPReceiverAudio::ParseAudioCodecSpecific(
size_t payload_length,
const AudioPayload& audio_specific,
bool is_red) {
-
if (payload_length == 0) {
minyue-webrtc 2017/05/10 13:03:18 I tried it, and I am afraid OnReceivedPayloadData(
- return 0;
+ rtp_header->type.Audio.isCNG = false;
+ rtp_header->frameType = kEmptyFrame;
+ return data_callback_->OnReceivedPayloadData(nullptr, 0, rtp_header);
}
bool telephone_event_packet =
@@ -239,6 +240,7 @@ int32_t RTPReceiverAudio::ParseAudioCodecSpecific(
number_of_events = MAX_NUMBER_OF_PARALLEL_TELEPHONE_EVENTS;
}
for (size_t n = 0; n < number_of_events; ++n) {
+ RTC_DCHECK_GE(payload_length, (4 * n) + 2);
bool end = (payload_data[(4 * n) + 1] & 0x80) ? true : false;
std::set<uint8_t>::iterator event =
@@ -291,6 +293,7 @@ int32_t RTPReceiverAudio::ParseAudioCodecSpecific(
}
}
// TODO(holmer): Break this out to have RED parsing handled generically.
+ RTC_DCHECK_GT(payload_length, 0);
if (is_red && !(payload_data[0] & 0x80)) {
// we recive only one frame packed in a RED packet remove the RED wrapper
rtp_header->header.payloadType = payload_data[0];
« no previous file with comments | « webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698