Revert 4127 "Switch frame list implementation to std::map."

We want to revert r4104 for b/9216252, but because r4127 was built on top of r4104, we need to revert r4127 first. We'll un/re-revert this if we discover that r4104 is not to blame.


> Switch frame list implementation to std::map.
> 
> This reduces the complexity of insert and find (by timestamp) from linear to logarithmic, which has a big impact on large frame lists.
> 
> BUG=1726
> TEST=trybots, vie_auto_test --automated
> R=mikhal@webrtc.org
> 
> Review URL: https://webrtc-codereview.appspot.com/1561005

TBR=stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/1590005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4145 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
tnakamura@webrtc.org
2013-05-31 16:06:01 +00:00
parent 5ed7051799
commit 4d9c07ad6d
2 changed files with 79 additions and 65 deletions

View File

@ -11,7 +11,7 @@
#ifndef WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_JITTER_BUFFER_H_
#define WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_JITTER_BUFFER_H_
#include <map>
#include <list>
#include <set>
#include <vector>
@ -47,22 +47,11 @@ struct VCMJitterSample {
int64_t latest_packet_time;
};
class TimestampLessThan {
public:
bool operator() (const uint32_t& timestamp1,
const uint32_t& timestamp2) const {
return IsNewerTimestamp(timestamp2, timestamp1);
}
};
class FrameList :
public std::map<uint32_t, VCMFrameBuffer*, TimestampLessThan> {
class FrameList : public std::list<VCMFrameBuffer*> {
public:
void InsertFrame(VCMFrameBuffer* frame);
VCMFrameBuffer* FindFrame(uint32_t timestamp) const;
VCMFrameBuffer* PopFrame(uint32_t timestamp);
VCMFrameBuffer* Front() const;
VCMFrameBuffer* Back() const;
int RecycleFramesUntilKeyFrame(FrameList::iterator* key_frame_it);
int CleanUpOldOrEmptyFrames(VCMDecodingState* decoding_state);
};