Added ClearTo(seq_num) to RtpFrameReferenceFinder.
In order to be able to clear out any potentially stashed old frames from the RtpFrameReferenceFinder we can now clear frames that contain packets older than |seq_num|. BUG=webrtc:5514 Review-Url: https://codereview.webrtc.org/2304723004 Cr-Commit-Position: refs/heads/master@{#14156}
This commit is contained in:
@ -14,7 +14,7 @@
|
||||
#include <array>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <queue>
|
||||
#include <deque>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
|
||||
@ -40,9 +40,22 @@ class OnCompleteFrameCallback {
|
||||
class RtpFrameReferenceFinder {
|
||||
public:
|
||||
explicit RtpFrameReferenceFinder(OnCompleteFrameCallback* frame_callback);
|
||||
|
||||
// Manage this frame until:
|
||||
// - We have all information needed to determine its references, after
|
||||
// which |frame_callback_| is called with the completed frame, or
|
||||
// - We have too many stashed frames (determined by |kMaxStashedFrames)
|
||||
// so we drop this frame, or
|
||||
// - It gets cleared by ClearTo, which also means we drop it.
|
||||
void ManageFrame(std::unique_ptr<RtpFrameObject> frame);
|
||||
|
||||
// Notifies that padding has been received, which the reference finder
|
||||
// might need to calculate the references of a frame.
|
||||
void PaddingReceived(uint16_t seq_num);
|
||||
|
||||
// Clear all stashed frames that include packets older than |seq_num|.
|
||||
void ClearTo(uint16_t seq_num);
|
||||
|
||||
private:
|
||||
static const uint16_t kPicIdLength = 1 << 7;
|
||||
static const uint8_t kMaxTemporalLayers = 5;
|
||||
@ -146,7 +159,7 @@ class RtpFrameReferenceFinder {
|
||||
|
||||
// Frames that have been fully received but didn't have all the information
|
||||
// needed to determine their references.
|
||||
std::queue<std::unique_ptr<RtpFrameObject>> stashed_frames_ GUARDED_BY(crit_);
|
||||
std::deque<std::unique_ptr<RtpFrameObject>> stashed_frames_ GUARDED_BY(crit_);
|
||||
|
||||
// Holds the information about the last completed frame for a given temporal
|
||||
// layer given a Tl0 picture index.
|
||||
@ -177,6 +190,11 @@ class RtpFrameReferenceFinder {
|
||||
kMaxTemporalLayers>
|
||||
missing_frames_for_layer_ GUARDED_BY(crit_);
|
||||
|
||||
// How far frames have been cleared by sequence number. A frame will be
|
||||
// cleared if it contains a packet with a sequence number older than
|
||||
// |cleared_to_seq_num_|.
|
||||
int cleared_to_seq_num_ GUARDED_BY(crit_);
|
||||
|
||||
OnCompleteFrameCallback* frame_callback_;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user