Bugfix for Vp9 GOF and missing frames.

In order to correctly determine the references of a frame when using Vp9
with GOF one has to wait for all frames on the lower temporal layers
to make sure no up-switch point is missed.

This patch fix a bug where upon receiving a frame the RtpFrameReferenceFinder
would try to add missing frame for a group with a not yet knows scalability
structure.

BUG=webrtc:5514

Review-Url: https://codereview.webrtc.org/2127073002
Cr-Commit-Position: refs/heads/master@{#13487}
This commit is contained in:
philipel
2016-07-15 06:50:27 -07:00
committed by Commit bot
parent 136778252d
commit c9b27d56c0
3 changed files with 132 additions and 51 deletions

View File

@ -44,6 +44,14 @@ class RtpFrameReferenceFinder {
static const int kMaxGofSaved = 15;
static const int kMaxPaddingAge = 100;
struct GofInfo {
GofInfo(GofInfoVP9* gof, uint16_t last_picture_id)
: gof(gof), last_picture_id(last_picture_id) {}
GofInfoVP9* gof;
uint16_t last_picture_id;
};
rtc::CriticalSection crit_;
// Find the relevant group of pictures and update its "last-picture-id-with
@ -82,13 +90,13 @@ class RtpFrameReferenceFinder {
// Check if we are missing a frame necessary to determine the references
// for this frame.
bool MissingRequiredFrameVp9(uint16_t picture_id, const GofInfoVP9& gof)
bool MissingRequiredFrameVp9(uint16_t picture_id, const GofInfo& info)
EXCLUSIVE_LOCKS_REQUIRED(crit_);
// Updates which frames that have been received. If there is a gap,
// missing frames will be added to |missing_frames_for_layer_| or
// if this is an already missing frame then it will be removed.
void FrameReceivedVp9(uint16_t picture_id, const GofInfoVP9& gof)
void FrameReceivedVp9(uint16_t picture_id, GofInfo* info)
EXCLUSIVE_LOCKS_REQUIRED(crit_);
// Check if there is a frame with the up-switch flag set in the interval
@ -147,15 +155,14 @@ class RtpFrameReferenceFinder {
std::array<GofInfoVP9, kMaxGofSaved> scalability_structures_
GUARDED_BY(crit_);
// Holds the picture id and the Gof information for a given TL0 picture index.
std::map<uint8_t,
std::pair<uint16_t, GofInfoVP9*>,
DescendingSeqNumComp<uint8_t>>
gof_info_ GUARDED_BY(crit_);
// Holds the the Gof information for a given TL0 picture index.
std::map<uint8_t, GofInfo, DescendingSeqNumComp<uint8_t>> gof_info_
GUARDED_BY(crit_);
// Keep track of which picture id and which temporal layer that had the
// up switch flag set.
std::map<uint16_t, uint8_t> up_switch_ GUARDED_BY(crit_);
std::map<uint16_t, uint8_t, DescendingSeqNumComp<uint16_t, kPicIdLength>>
up_switch_ GUARDED_BY(crit_);
// For every temporal layer, keep a set of which frames that are missing.
std::array<std::set<uint16_t, DescendingSeqNumComp<uint16_t, kPicIdLength>>,