Refactor LossNotificationController to not use VCMPacket
Bug: None Change-Id: I15e1b3405c6538dd22aaeb125751c158c069478a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/152384 Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Reviewed-by: Philip Eliasson <philipel@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29193}
This commit is contained in:
@ -43,19 +43,15 @@ LossNotificationController::LossNotificationController(
|
||||
|
||||
LossNotificationController::~LossNotificationController() = default;
|
||||
|
||||
void LossNotificationController::OnReceivedPacket(const VCMPacket& packet) {
|
||||
void LossNotificationController::OnReceivedPacket(
|
||||
uint16_t rtp_seq_num,
|
||||
const RtpGenericFrameDescriptor& generic_descriptor) {
|
||||
RTC_DCHECK_RUN_ON(&sequence_checker_);
|
||||
|
||||
if (!packet.generic_descriptor) {
|
||||
RTC_LOG(LS_WARNING) << "Generic frame descriptor missing. Buggy remote? "
|
||||
"Misconfigured local?";
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignore repeated or reordered packets.
|
||||
// TODO(bugs.webrtc.org/10336): Handle packet reordering.
|
||||
if (last_received_seq_num_ &&
|
||||
!AheadOf(packet.seqNum, *last_received_seq_num_)) {
|
||||
!AheadOf(rtp_seq_num, *last_received_seq_num_)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -63,12 +59,12 @@ void LossNotificationController::OnReceivedPacket(const VCMPacket& packet) {
|
||||
|
||||
const bool seq_num_gap =
|
||||
last_received_seq_num_ &&
|
||||
packet.seqNum != static_cast<uint16_t>(*last_received_seq_num_ + 1u);
|
||||
rtp_seq_num != static_cast<uint16_t>(*last_received_seq_num_ + 1u);
|
||||
|
||||
last_received_seq_num_ = packet.seqNum;
|
||||
last_received_seq_num_ = rtp_seq_num;
|
||||
|
||||
if (packet.generic_descriptor->FirstPacketInSubFrame()) {
|
||||
const uint16_t frame_id = packet.generic_descriptor->FrameId();
|
||||
if (generic_descriptor.FirstPacketInSubFrame()) {
|
||||
const uint16_t frame_id = generic_descriptor.FrameId();
|
||||
const int64_t unwrapped_frame_id = frame_id_unwrapper_.Unwrap(frame_id);
|
||||
|
||||
// Ignore repeated or reordered frames.
|
||||
@ -83,7 +79,7 @@ void LossNotificationController::OnReceivedPacket(const VCMPacket& packet) {
|
||||
last_received_unwrapped_frame_id_ = unwrapped_frame_id;
|
||||
|
||||
const bool intra_frame =
|
||||
packet.generic_descriptor->FrameDependenciesDiffs().empty();
|
||||
generic_descriptor.FrameDependenciesDiffs().empty();
|
||||
// Generic Frame Descriptor does not current allow us to distinguish
|
||||
// whether an intra frame is a key frame.
|
||||
// We therefore assume all intra frames are key frames.
|
||||
@ -98,11 +94,10 @@ void LossNotificationController::OnReceivedPacket(const VCMPacket& packet) {
|
||||
current_frame_potentially_decodable_ = true;
|
||||
} else {
|
||||
const bool all_dependencies_decodable = AllDependenciesDecodable(
|
||||
unwrapped_frame_id,
|
||||
packet.generic_descriptor->FrameDependenciesDiffs());
|
||||
unwrapped_frame_id, generic_descriptor.FrameDependenciesDiffs());
|
||||
current_frame_potentially_decodable_ = all_dependencies_decodable;
|
||||
if (seq_num_gap || !current_frame_potentially_decodable_) {
|
||||
HandleLoss(packet.seqNum, current_frame_potentially_decodable_);
|
||||
HandleLoss(rtp_seq_num, current_frame_potentially_decodable_);
|
||||
}
|
||||
}
|
||||
} else if (seq_num_gap || !current_frame_potentially_decodable_) {
|
||||
@ -111,7 +106,7 @@ void LossNotificationController::OnReceivedPacket(const VCMPacket& packet) {
|
||||
// even if only one of its packets is lost. We do this because the bigger
|
||||
// the frame, the more likely it is to be non-discardable, and therefore
|
||||
// the more robust we wish to be to loss of the feedback messages.
|
||||
HandleLoss(packet.seqNum, false);
|
||||
HandleLoss(rtp_seq_num, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user