rtc::CopyOnWriteBuffer video_payload;
RTPVideoHeader video_header;
+ RtpPacketInfo packet_info;
};
struct InsertResult {
std::vector<std::unique_ptr<Packet>> packets;
video_coding::PacketBuffer::InsertResult insert_result;
{
MutexLock lock(&packet_buffer_lock_);
- int64_t unwrapped_rtp_seq_num =
- rtp_seq_num_unwrapper_.Unwrap(rtp_packet.SequenceNumber());
- auto& packet_info =
- packet_infos_
- .emplace(
- unwrapped_rtp_seq_num,
- RtpPacketInfo(
- rtp_packet.Ssrc(), rtp_packet.Csrcs(),
- rtp_packet.Timestamp(),
- /*audio_level=*/absl::nullopt,
- rtp_packet.GetExtension<AbsoluteCaptureTimeExtension>(),
- /*receive_time_ms=*/clock_->TimeInMilliseconds()))
- .first->second;
+ packet->packet_info = RtpPacketInfo(
+ rtp_packet.Ssrc(), rtp_packet.Csrcs(), rtp_packet.Timestamp(),
+ /*audio_level=*/absl::nullopt,
+ rtp_packet.GetExtension<AbsoluteCaptureTimeExtension>(),
+ /*receive_time_ms=*/clock_->TimeInMilliseconds());
+ auto& packet_info = packet->packet_info;
// Try to extrapolate absolute capture time if it is missing.
packet_info.set_absolute_capture_time(
// PacketBuffer promisses frame boundaries are correctly set on each
// packet. Document that assumption with the DCHECKs.
RTC_DCHECK_EQ(frame_boundary, packet->is_first_packet_in_frame());
- int64_t unwrapped_rtp_seq_num =
- rtp_seq_num_unwrapper_.Unwrap(packet->seq_num);
- RTC_DCHECK(packet_infos_.count(unwrapped_rtp_seq_num) > 0);
- RtpPacketInfo& packet_info = packet_infos_[unwrapped_rtp_seq_num];
+ RtpPacketInfo& packet_info = packet->packet_info;
if (packet->is_first_packet_in_frame()) {
first_packet = packet.get();
max_nack_count = packet->times_nacked;
}
}
RTC_DCHECK(frame_boundary);
-
- if (result.buffer_cleared) {
- packet_infos_.clear();
- }
} // packet_buffer_lock_
if (result.buffer_cleared) {
{
MutexLock lock(&packet_buffer_lock_);
packet_buffer_.ClearTo(seq_num);
- int64_t unwrapped_rtp_seq_num = rtp_seq_num_unwrapper_.Unwrap(seq_num);
- packet_infos_.erase(packet_infos_.begin(),
- packet_infos_.upper_bound(unwrapped_rtp_seq_num));
}
MutexLock lock(&reference_finder_lock_);
reference_finder_->ClearTo(seq_num);
SeqNumUnwrapper<uint16_t> rtp_seq_num_unwrapper_
RTC_GUARDED_BY(packet_buffer_lock_);
- std::map<int64_t, RtpPacketInfo> packet_infos_
- RTC_GUARDED_BY(packet_buffer_lock_);
};
} // namespace webrtc
auto packet =
std::make_unique<video_coding::PacketBuffer::Packet>(rtp_packet, video);
- int64_t unwrapped_rtp_seq_num =
- rtp_seq_num_unwrapper_.Unwrap(rtp_packet.SequenceNumber());
- auto& packet_info =
- packet_infos_
- .emplace(
- unwrapped_rtp_seq_num,
- RtpPacketInfo(
- rtp_packet.Ssrc(), rtp_packet.Csrcs(), rtp_packet.Timestamp(),
- /*audio_level=*/absl::nullopt,
- rtp_packet.GetExtension<AbsoluteCaptureTimeExtension>(),
- /*receive_time_ms=*/clock_->CurrentTime()))
- .first->second;
+ packet->packet_info = RtpPacketInfo(
+ rtp_packet.Ssrc(), rtp_packet.Csrcs(), rtp_packet.Timestamp(),
+ /*audio_level=*/absl::nullopt,
+ rtp_packet.GetExtension<AbsoluteCaptureTimeExtension>(),
+ /*receive_time_ms=*/clock_->CurrentTime());
+ auto& packet_info = packet->packet_info;
// Try to extrapolate absolute capture time if it is missing.
packet_info.set_absolute_capture_time(
// PacketBuffer promisses frame boundaries are correctly set on each
// packet. Document that assumption with the DCHECKs.
RTC_DCHECK_EQ(frame_boundary, packet->is_first_packet_in_frame());
- int64_t unwrapped_rtp_seq_num =
- rtp_seq_num_unwrapper_.Unwrap(packet->seq_num);
- RTC_DCHECK(packet_infos_.count(unwrapped_rtp_seq_num) > 0);
- RtpPacketInfo& packet_info = packet_infos_[unwrapped_rtp_seq_num];
+ RtpPacketInfo& packet_info = packet->packet_info;
if (packet->is_first_packet_in_frame()) {
first_packet = packet.get();
max_nack_count = packet->times_nacked;
last_received_rtp_system_time_.reset();
last_received_keyframe_rtp_system_time_.reset();
last_received_keyframe_rtp_timestamp_.reset();
- packet_infos_.clear();
RequestKeyFrame();
}
}
}
if (seq_num != -1) {
- int64_t unwrapped_rtp_seq_num = rtp_seq_num_unwrapper_.Unwrap(seq_num);
- packet_infos_.erase(packet_infos_.begin(),
- packet_infos_.upper_bound(unwrapped_rtp_seq_num));
packet_buffer_.ClearTo(seq_num);
reference_finder_->ClearTo(seq_num);
}
SeqNumUnwrapper<uint16_t> rtp_seq_num_unwrapper_
RTC_GUARDED_BY(packet_sequence_checker_);
- std::map<int64_t, RtpPacketInfo> packet_infos_
- RTC_GUARDED_BY(packet_sequence_checker_);
};
} // namespace webrtc