Track last packet receive times in RtpVideoStreamReceiver instead of the PacketBuffer.

Bug: webrtc:12579
Change-Id: I4adb8c6ada913127b9e65d97ddce0dc71ec6ccee
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214784
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33713}
This commit is contained in:
philipel
2021-04-12 13:42:03 +02:00
committed by Commit Bot
parent cd83ae2d65
commit ce423ce12d
9 changed files with 125 additions and 180 deletions

View File

@ -25,7 +25,6 @@
#include "rtc_base/numerics/sequence_number_util.h"
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/thread_annotations.h"
#include "system_wrappers/include/clock.h"
namespace webrtc {
namespace video_coding {
@ -76,7 +75,7 @@ class PacketBuffer {
};
// Both |start_buffer_size| and |max_buffer_size| must be a power of 2.
PacketBuffer(Clock* clock, size_t start_buffer_size, size_t max_buffer_size);
PacketBuffer(size_t start_buffer_size, size_t max_buffer_size);
~PacketBuffer();
ABSL_MUST_USE_RESULT InsertResult InsertPacket(std::unique_ptr<Packet> packet)
@ -86,16 +85,9 @@ class PacketBuffer {
void ClearTo(uint16_t seq_num) RTC_LOCKS_EXCLUDED(mutex_);
void Clear() RTC_LOCKS_EXCLUDED(mutex_);
// Timestamp (not RTP timestamp) of the last received packet/keyframe packet.
absl::optional<int64_t> LastReceivedPacketMs() const
RTC_LOCKS_EXCLUDED(mutex_);
absl::optional<int64_t> LastReceivedKeyframePacketMs() const
RTC_LOCKS_EXCLUDED(mutex_);
void ForceSpsPpsIdrIsH264Keyframe();
private:
Clock* const clock_;
// Clears with |mutex_| taken.
void ClearInternal() RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
@ -132,13 +124,6 @@ class PacketBuffer {
// determine continuity between them.
std::vector<std::unique_ptr<Packet>> buffer_ RTC_GUARDED_BY(mutex_);
// Timestamp of the last received packet/keyframe packet.
absl::optional<int64_t> last_received_packet_ms_ RTC_GUARDED_BY(mutex_);
absl::optional<int64_t> last_received_keyframe_packet_ms_
RTC_GUARDED_BY(mutex_);
absl::optional<uint32_t> last_received_keyframe_rtp_timestamp_
RTC_GUARDED_BY(mutex_);
absl::optional<uint16_t> newest_inserted_seq_num_ RTC_GUARDED_BY(mutex_);
std::set<uint16_t, DescendingSeqNumComp<uint16_t>> missing_packets_
RTC_GUARDED_BY(mutex_);