Add support for handling reordered SS data on the receive-side for VP9.

BUG=chromium:500602

Review URL: https://codereview.webrtc.org/1386903002

Cr-Commit-Position: refs/heads/master@{#10383}
This commit is contained in:
asapersson
2015-10-23 00:27:14 -07:00
committed by Commit bot
parent a3587fb779
commit 9a4cd87640
7 changed files with 547 additions and 42 deletions

View File

@ -74,6 +74,37 @@ class FrameList
void Reset(UnorderedFrameList* free_frames);
};
class Vp9SsMap {
public:
typedef std::map<uint32_t, GofInfoVP9, TimestampLessThan> SsMap;
bool Insert(const VCMPacket& packet);
void Reset();
// Removes SS data that are older than |timestamp|.
// The |timestamp| should be an old timestamp, i.e. packets with older
// timestamps should no longer be inserted.
void RemoveOld(uint32_t timestamp);
bool UpdatePacket(VCMPacket* packet);
void UpdateFrames(FrameList* frames);
// Public for testing.
// Returns an iterator to the corresponding SS data for the input |timestamp|.
bool Find(uint32_t timestamp, SsMap::iterator* it);
private:
// These two functions are called by RemoveOld.
// Checks if it is time to do a clean up (done each kSsCleanupIntervalSec).
bool TimeForCleanup(uint32_t timestamp) const;
// Advances the oldest SS data to handle timestamp wrap in cases where SS data
// are received very seldom (e.g. only once in beginning, second when
// IsNewerTimestamp is not true).
void AdvanceFront(uint32_t timestamp);
SsMap ss_map_;
};
class VCMJitterBuffer {
public:
VCMJitterBuffer(Clock* clock, rtc::scoped_ptr<EventWrapper> event);
@ -307,10 +338,8 @@ class VCMJitterBuffer {
FrameList incomplete_frames_ GUARDED_BY(crit_sect_);
VCMDecodingState last_decoded_state_ GUARDED_BY(crit_sect_);
bool first_packet_since_reset_;
// Contains last received frame's temporal information for non-flexible mode.
GofInfoVP9 last_gof_;
uint32_t last_gof_timestamp_;
bool last_gof_valid_;
// Contains scalability structure data for VP9.
Vp9SsMap vp9_ss_map_ GUARDED_BY(crit_sect_);
// Statistics.
VCMReceiveStatisticsCallback* stats_callback_ GUARDED_BY(crit_sect_);