diff --git a/modules/video_coding/packet_buffer.cc b/modules/video_coding/packet_buffer.cc index 80c66661fb..4ef0b007bd 100644 --- a/modules/video_coding/packet_buffer.cc +++ b/modules/video_coding/packet_buffer.cc @@ -266,6 +266,8 @@ bool PacketBuffer::PotentialNewFrame(uint16_t seq_num) const { static_cast(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; diff --git a/modules/video_coding/video_packet_buffer_unittest.cc b/modules/video_coding/video_packet_buffer_unittest.cc index ee890dd4bd..c546d72eac 100644 --- a/modules/video_coding/video_packet_buffer_unittest.cc +++ b/modules/video_coding/video_packet_buffer_unittest.cc @@ -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.