Index: webrtc/modules/video_coding/main/source/jitter_buffer.h |
diff --git a/webrtc/modules/video_coding/main/source/jitter_buffer.h b/webrtc/modules/video_coding/main/source/jitter_buffer.h |
index 8a05f1ff178097b8dff7ab2a725045ef063d8da5..31e3be257824893e664499f7e651676ed8898e5f 100644 |
--- a/webrtc/modules/video_coding/main/source/jitter_buffer.h |
+++ b/webrtc/modules/video_coding/main/source/jitter_buffer.h |
@@ -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_); |