Avoid creating frames with packets of different timestamps.

Bug: None
Change-Id: Ieca71f844d546c2e97b95131153913f138842acd
Reviewed-on: https://webrtc-review.googlesource.com/c/116680
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26176}
This commit is contained in:
philipel
2019-01-09 12:39:18 +01:00
committed by Commit Bot
parent c610e26be5
commit 8b6995b3d4
2 changed files with 9 additions and 0 deletions

View File

@ -266,6 +266,8 @@ bool PacketBuffer::PotentialNewFrame(uint16_t seq_num) const {
static_cast<uint16_t>(sequence_buffer_[index].seq_num - 1)) {
return false;
}
if (data_buffer_[prev_index].timestamp != data_buffer_[index].timestamp)
return false;
if (sequence_buffer_[prev_index].continuous)
return true;

View File

@ -706,6 +706,13 @@ TEST_F(TestPacketBuffer, FramesAfterClear) {
CheckFrame(9057);
}
TEST_F(TestPacketBuffer, SameFrameDifferentTimestamps) {
Insert(0, kKeyFrame, kFirst, kNotLast, 0, nullptr, 1000);
Insert(1, kKeyFrame, kNotFirst, kLast, 0, nullptr, 1001);
ASSERT_EQ(0UL, frames_from_callback_.size());
}
TEST_F(TestPacketBuffer, DontLeakPayloadData) {
// NOTE! Any eventual leak is suppose to be detected by valgrind
// or any other similar tool.