mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Clear PacketBuffer on large negative jumps at the start of the video stream
PacketBuffer is not designed to store wide range of the rtp sequence numbers Bug: webrtc:15508 Change-Id: I62b19ba2896a667d795a41c38a60f55ee3f60566 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/321845 Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@google.com> Cr-Commit-Position: refs/heads/main@{#40839}
This commit is contained in:
parent
e9f9c28d48
commit
34ec5c3f20
2 changed files with 13 additions and 0 deletions
|
@ -77,6 +77,13 @@ PacketBuffer::InsertResult PacketBuffer::InsertPacket(
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ForwardDiff<uint16_t>(first_seq_num_, seq_num) >= max_size_) {
|
||||||
|
// Large negative jump in rtp sequence number: clear the buffer and treat
|
||||||
|
// latest packet as the new first packet.
|
||||||
|
Clear();
|
||||||
|
first_packet_received_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
first_seq_num_ = seq_num;
|
first_seq_num_ = seq_num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -705,6 +705,12 @@ TEST_P(PacketBufferH264ParameterizedTest, OneFrameMaxSeqNum) {
|
||||||
StartSeqNumsAre(65534));
|
StartSeqNumsAre(65534));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_P(PacketBufferH264ParameterizedTest, InsertTooOldPackets) {
|
||||||
|
InsertH264(4660, kKeyFrame, kFirst, kNotLast, 1000);
|
||||||
|
InsertH264(37429, kDeltaFrame, kFirst, kNotLast, 1000);
|
||||||
|
InsertH264(4662, kKeyFrame, kFirst, kLast, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_P(PacketBufferH264ParameterizedTest, ClearMissingPacketsOnKeyframe) {
|
TEST_P(PacketBufferH264ParameterizedTest, ClearMissingPacketsOnKeyframe) {
|
||||||
InsertH264(0, kKeyFrame, kFirst, kLast, 1000);
|
InsertH264(0, kKeyFrame, kFirst, kLast, 1000);
|
||||||
InsertH264(2, kKeyFrame, kFirst, kLast, 3000);
|
InsertH264(2, kKeyFrame, kFirst, kLast, 3000);
|
||||||
|
|
Loading…
Reference in a new issue