Store PacketBuffer by value instead of as reference counted object

Bug: None
Change-Id: I5a594972e8a8dad731c927a1a374301e549f5d71
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153887
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29267}
This commit is contained in:
Danil Chapovalov
2019-09-20 17:57:15 +02:00
committed by Commit Bot
parent 3c5f91b748
commit f7457e55fe
9 changed files with 120 additions and 155 deletions

View File

@ -16,7 +16,6 @@
#include <set>
#include <vector>
#include "api/scoped_refptr.h"
#include "api/video/encoded_image.h"
#include "modules/include/module_common_types.h"
#include "modules/video_coding/packet.h"
@ -41,12 +40,11 @@ class OnAssembledFrameCallback {
class PacketBuffer {
public:
static rtc::scoped_refptr<PacketBuffer> Create(
Clock* clock,
size_t start_buffer_size,
size_t max_buffer_size,
OnAssembledFrameCallback* frame_callback);
// Both |start_buffer_size| and |max_buffer_size| must be a power of 2.
PacketBuffer(Clock* clock,
size_t start_buffer_size,
size_t max_buffer_size,
OnAssembledFrameCallback* frame_callback);
virtual ~PacketBuffer();
// Returns true unless the packet buffer is cleared, which means that a key
@ -65,16 +63,6 @@ class PacketBuffer {
// Returns number of different frames seen in the packet buffer
int GetUniqueFramesSeen() const;
int AddRef() const;
int Release() const;
protected:
// Both |start_buffer_size| and |max_buffer_size| must be a power of 2.
PacketBuffer(Clock* clock,
size_t start_buffer_size,
size_t max_buffer_size,
OnAssembledFrameCallback* frame_callback);
private:
friend RtpFrameObject;
// Since we want the packet buffer to be as packet type agnostic
@ -181,8 +169,6 @@ class PacketBuffer {
std::set<uint32_t> rtp_timestamps_history_set_ RTC_GUARDED_BY(crit_);
// Stores the same unique timestamps in the order of insertion.
std::queue<uint32_t> rtp_timestamps_history_queue_ RTC_GUARDED_BY(crit_);
mutable volatile int ref_count_ = 0;
};
} // namespace video_coding