Prepare to replace VideoLayerFrameId with int64_t.
Bug: webrtc:12206 Change-Id: I10bfdefbc95a79e0595956c1a0e688051da6d2b9 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/207180 Reviewed-by: Sam Zackrisson <saza@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Philip Eliasson <philipel@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33265}
This commit is contained in:
@ -50,14 +50,14 @@ RtpVp8RefFinder::FrameDecision RtpVp8RefFinder::ManageFrameInternal(
|
||||
return kDrop;
|
||||
|
||||
frame->SetSpatialIndex(0);
|
||||
frame->id.picture_id = codec_header.pictureId & 0x7FFF;
|
||||
frame->SetId(codec_header.pictureId & 0x7FFF);
|
||||
|
||||
if (last_picture_id_ == -1)
|
||||
last_picture_id_ = frame->id.picture_id;
|
||||
last_picture_id_ = frame->Id();
|
||||
|
||||
// Clean up info about not yet received frames that are too old.
|
||||
uint16_t old_picture_id =
|
||||
Subtract<kFrameIdLength>(frame->id.picture_id, kMaxNotYetReceivedFrames);
|
||||
Subtract<kFrameIdLength>(frame->Id(), kMaxNotYetReceivedFrames);
|
||||
auto clean_frames_to = not_yet_received_frames_.lower_bound(old_picture_id);
|
||||
not_yet_received_frames_.erase(not_yet_received_frames_.begin(),
|
||||
clean_frames_to);
|
||||
@ -67,12 +67,11 @@ RtpVp8RefFinder::FrameDecision RtpVp8RefFinder::ManageFrameInternal(
|
||||
}
|
||||
// Find if there has been a gap in fully received frames and save the picture
|
||||
// id of those frames in |not_yet_received_frames_|.
|
||||
if (AheadOf<uint16_t, kFrameIdLength>(frame->id.picture_id,
|
||||
last_picture_id_)) {
|
||||
if (AheadOf<uint16_t, kFrameIdLength>(frame->Id(), last_picture_id_)) {
|
||||
do {
|
||||
last_picture_id_ = Add<kFrameIdLength>(last_picture_id_, 1);
|
||||
not_yet_received_frames_.insert(last_picture_id_);
|
||||
} while (last_picture_id_ != frame->id.picture_id);
|
||||
} while (last_picture_id_ != frame->Id());
|
||||
}
|
||||
|
||||
int64_t unwrapped_tl0 = tl0_unwrapper_.Unwrap(codec_header.tl0PicIdx & 0xFF);
|
||||
@ -110,8 +109,7 @@ RtpVp8RefFinder::FrameDecision RtpVp8RefFinder::ManageFrameInternal(
|
||||
|
||||
// Is this an old frame that has already been used to update the state? If
|
||||
// so, drop it.
|
||||
if (AheadOrAt<uint16_t, kFrameIdLength>(last_pid_on_layer,
|
||||
frame->id.picture_id)) {
|
||||
if (AheadOrAt<uint16_t, kFrameIdLength>(last_pid_on_layer, frame->Id())) {
|
||||
return kDrop;
|
||||
}
|
||||
|
||||
@ -128,8 +126,7 @@ RtpVp8RefFinder::FrameDecision RtpVp8RefFinder::ManageFrameInternal(
|
||||
// Is this an old frame that has already been used to update the state? If
|
||||
// so, drop it.
|
||||
if (last_pid_on_layer != -1 &&
|
||||
AheadOrAt<uint16_t, kFrameIdLength>(last_pid_on_layer,
|
||||
frame->id.picture_id)) {
|
||||
AheadOrAt<uint16_t, kFrameIdLength>(last_pid_on_layer, frame->Id())) {
|
||||
return kDrop;
|
||||
}
|
||||
|
||||
@ -150,7 +147,7 @@ RtpVp8RefFinder::FrameDecision RtpVp8RefFinder::ManageFrameInternal(
|
||||
// a layer sync frame has been received after this frame for the same
|
||||
// base layer frame, drop this frame.
|
||||
if (AheadOf<uint16_t, kFrameIdLength>(layer_info_it->second[layer],
|
||||
frame->id.picture_id)) {
|
||||
frame->Id())) {
|
||||
return kDrop;
|
||||
}
|
||||
|
||||
@ -159,14 +156,14 @@ RtpVp8RefFinder::FrameDecision RtpVp8RefFinder::ManageFrameInternal(
|
||||
auto not_received_frame_it =
|
||||
not_yet_received_frames_.upper_bound(layer_info_it->second[layer]);
|
||||
if (not_received_frame_it != not_yet_received_frames_.end() &&
|
||||
AheadOf<uint16_t, kFrameIdLength>(frame->id.picture_id,
|
||||
AheadOf<uint16_t, kFrameIdLength>(frame->Id(),
|
||||
*not_received_frame_it)) {
|
||||
return kStash;
|
||||
}
|
||||
|
||||
if (!(AheadOf<uint16_t, kFrameIdLength>(frame->id.picture_id,
|
||||
if (!(AheadOf<uint16_t, kFrameIdLength>(frame->Id(),
|
||||
layer_info_it->second[layer]))) {
|
||||
RTC_LOG(LS_WARNING) << "Frame with picture id " << frame->id.picture_id
|
||||
RTC_LOG(LS_WARNING) << "Frame with picture id " << frame->Id()
|
||||
<< " and packet range [" << frame->first_seq_num()
|
||||
<< ", " << frame->last_seq_num()
|
||||
<< "] already received, "
|
||||
@ -191,17 +188,17 @@ void RtpVp8RefFinder::UpdateLayerInfoVp8(RtpFrameObject* frame,
|
||||
while (layer_info_it != layer_info_.end()) {
|
||||
if (layer_info_it->second[temporal_idx] != -1 &&
|
||||
AheadOf<uint16_t, kFrameIdLength>(layer_info_it->second[temporal_idx],
|
||||
frame->id.picture_id)) {
|
||||
frame->Id())) {
|
||||
// The frame was not newer, then no subsequent layer info have to be
|
||||
// update.
|
||||
break;
|
||||
}
|
||||
|
||||
layer_info_it->second[temporal_idx] = frame->id.picture_id;
|
||||
layer_info_it->second[temporal_idx] = frame->Id();
|
||||
++unwrapped_tl0;
|
||||
layer_info_it = layer_info_.find(unwrapped_tl0);
|
||||
}
|
||||
not_yet_received_frames_.erase(frame->id.picture_id);
|
||||
not_yet_received_frames_.erase(frame->Id());
|
||||
|
||||
UnwrapPictureIds(frame);
|
||||
}
|
||||
@ -233,7 +230,7 @@ void RtpVp8RefFinder::RetryStashedFrames(
|
||||
void RtpVp8RefFinder::UnwrapPictureIds(RtpFrameObject* frame) {
|
||||
for (size_t i = 0; i < frame->num_references; ++i)
|
||||
frame->references[i] = unwrapper_.Unwrap(frame->references[i]);
|
||||
frame->id.picture_id = unwrapper_.Unwrap(frame->id.picture_id);
|
||||
frame->SetId(unwrapper_.Unwrap(frame->Id()));
|
||||
}
|
||||
|
||||
void RtpVp8RefFinder::ClearTo(uint16_t seq_num) {
|
||||
|
||||
Reference in New Issue
Block a user