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

Unified Diff: webrtc/modules/audio_coding/neteq/tools/neteq_replacement_input.cc

Issue 2838353002: NetEq: Limit payload size for replacement audio input (Closed)
Patch Set: alessiob's comments Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/neteq/tools/neteq_replacement_input.cc
diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_replacement_input.cc b/webrtc/modules/audio_coding/neteq/tools/neteq_replacement_input.cc
index 9b550cbb2bf015ae58510fe59e52488cb2068f7d..00814f1785a34887bfa1bccb570801058876f877 100644
--- a/webrtc/modules/audio_coding/neteq/tools/neteq_replacement_input.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/neteq_replacement_input.cc
@@ -86,12 +86,16 @@ void NetEqReplacementInput::ReplacePacket() {
RTC_DCHECK(next_hdr);
uint8_t payload[12];
uint32_t input_frame_size_timestamps = last_frame_size_timestamps_;
- if (next_hdr->sequenceNumber == packet_->header.sequenceNumber + 1) {
- // Packets are in order.
- input_frame_size_timestamps =
- next_hdr->timestamp - packet_->header.timestamp;
+ const uint32_t timestamp_diff =
+ next_hdr->timestamp - packet_->header.timestamp;
+ if (next_hdr->sequenceNumber == packet_->header.sequenceNumber + 1 &&
+ timestamp_diff <= 120 * 48) {
+ // Packets are in order and the timestamp diff is less than 5760 samples.
+ // Accept the timestamp diff as a valid frame size.
+ input_frame_size_timestamps = timestamp_diff;
last_frame_size_timestamps_ = input_frame_size_timestamps;
}
+ RTC_DCHECK_LE(input_frame_size_timestamps, 120 * 48);
AleBzk 2017/04/26 14:26:48 I'd rather do this before line 88 and on last_fram
hlundin-webrtc 2017/04/26 14:32:32 I see your point. But I think that we are not as m
FakeDecodeFromFile::PrepareEncoded(packet_->header.timestamp,
input_frame_size_timestamps,
packet_->payload.size(), payload);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698