/* * Copyright (c) 2021 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
namespace webrtc { namespace { bool ValidReferences(const EncodedFrame& frame) { // All references must point backwards, and duplicates are not allowed. for (size_t i = 0; i < frame.num_references; ++i) { if (frame.references[i] >= frame.Id()) returnfalse;
for (size_t j = i + 1; j < frame.num_references; ++j) { if (frame.references[i] == frame.references[j]) returnfalse;
}
}
returntrue;
}
// Since FrameBuffer::FrameInfo is private it can't be used in the function // signature, hence the FrameIteratorT type. template <typename FrameIteratorT>
rtc::ArrayView<const int64_t> GetReferences(const FrameIteratorT& it) { return {it->second.encoded_frame->references,
std::min<size_t>(it->second.encoded_frame->num_references,
EncodedFrame::kMaxFrameReferences)};
}
auto end_it = std::next(next_decodable_temporal_unit_->last_frame); for (auto it = next_decodable_temporal_unit_->first_frame; it != end_it;
++it) {
decoded_frame_history_.InsertDecoded(GetFrameId(it), GetTimestamp(it));
res.push_back(std::move(it->second.encoded_frame));
}
DropNextDecodableTemporalUnit(); return res;
}
void FrameBuffer::DropNextDecodableTemporalUnit() { if (!next_decodable_temporal_unit_) { return;
}
auto end_it = std::next(next_decodable_temporal_unit_->last_frame);
if (IsLastFrameInTemporalUnit(last_frame_it)) { bool temporal_unit_decodable = true; for (auto it = first_frame_it; it != frame_it && temporal_unit_decodable;
++it) { for (int64_t reference : GetReferences(it)) { if (!decoded_frame_history_.WasDecoded(reference) &&
!absl::c_linear_search(frames_in_temporal_unit, reference)) { // A frame in the temporal unit has a non-decoded reference outside // the temporal unit, so it's not yet ready to be decoded.
temporal_unit_decodable = false; break;
}
}
}
if (temporal_unit_decodable) { if (!next_decodable_temporal_unit_) {
next_decodable_temporal_unit_ = {first_frame_it, last_frame_it};
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.