Split out counting unique rtp timestamps from packet_buffer
Bug: None Change-Id: Ia6fd05f284e8304cf56ab9ddf944fb222a4c9573 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158676 Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Reviewed-by: Philip Eliasson <philipel@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29656}
This commit is contained in:

committed by
Commit Bot

parent
a0adf3d440
commit
09860e0bc3
@ -40,7 +40,6 @@ PacketBuffer::PacketBuffer(Clock* clock,
|
||||
first_packet_received_(false),
|
||||
is_cleared_to_first_seq_num_(false),
|
||||
buffer_(start_buffer_size),
|
||||
unique_frames_seen_(0),
|
||||
sps_pps_idr_is_h264_keyframe_(
|
||||
field_trial::IsEnabled("WebRTC-SpsPpsIdrIsH264Keyframe")) {
|
||||
RTC_DCHECK_LE(start_buffer_size, max_buffer_size);
|
||||
@ -56,7 +55,6 @@ PacketBuffer::~PacketBuffer() {
|
||||
PacketBuffer::InsertResult PacketBuffer::InsertPacket(VCMPacket* packet) {
|
||||
PacketBuffer::InsertResult result;
|
||||
rtc::CritScope lock(&crit_);
|
||||
OnTimestampReceived(packet->timestamp);
|
||||
|
||||
uint16_t seq_num = packet->seqNum;
|
||||
size_t index = seq_num % buffer_.size();
|
||||
@ -208,11 +206,6 @@ absl::optional<int64_t> PacketBuffer::LastReceivedKeyframePacketMs() const {
|
||||
return last_received_keyframe_packet_ms_;
|
||||
}
|
||||
|
||||
int PacketBuffer::GetUniqueFramesSeen() const {
|
||||
rtc::CritScope lock(&crit_);
|
||||
return unique_frames_seen_;
|
||||
}
|
||||
|
||||
bool PacketBuffer::ExpandBufferSize() {
|
||||
if (buffer_.size() == max_size_) {
|
||||
RTC_LOG(LS_WARNING) << "PacketBuffer is already at max size (" << max_size_
|
||||
@ -486,18 +479,5 @@ void PacketBuffer::UpdateMissingPackets(uint16_t seq_num) {
|
||||
}
|
||||
}
|
||||
|
||||
void PacketBuffer::OnTimestampReceived(uint32_t rtp_timestamp) {
|
||||
const size_t kMaxTimestampsHistory = 1000;
|
||||
if (rtp_timestamps_history_set_.insert(rtp_timestamp).second) {
|
||||
rtp_timestamps_history_queue_.push(rtp_timestamp);
|
||||
++unique_frames_seen_;
|
||||
if (rtp_timestamps_history_set_.size() > kMaxTimestampsHistory) {
|
||||
uint32_t discarded_timestamp = rtp_timestamps_history_queue_.front();
|
||||
rtp_timestamps_history_set_.erase(discarded_timestamp);
|
||||
rtp_timestamps_history_queue_.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace video_coding
|
||||
} // namespace webrtc
|
||||
|
Reference in New Issue
Block a user