Replace raw new by MakeUnique, and improve declarations.
For unique_ptrs assigned at construction time, declare them const, and use RTC_PT_GUARDED_BY rather than RTC_GUARDED_BY. Bug: None Change-Id: I8aa83e062a1550780ee07792c1fbb195267d5524 Reviewed-on: https://webrtc-review.googlesource.com/12923 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Philip Eliasson <philipel@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20348}
This commit is contained in:
parent
4b1a363e4c
commit
712048c64f
@ -23,6 +23,7 @@
|
||||
#include "modules/utility/include/process_thread.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/ptr_util.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
|
||||
@ -47,11 +48,11 @@ PacedSender::PacedSender(const Clock* clock,
|
||||
RtcEventLog* event_log)
|
||||
: clock_(clock),
|
||||
packet_sender_(packet_sender),
|
||||
alr_detector_(new AlrDetector()),
|
||||
alr_detector_(rtc::MakeUnique<AlrDetector>()),
|
||||
paused_(false),
|
||||
media_budget_(new IntervalBudget(0)),
|
||||
padding_budget_(new IntervalBudget(0)),
|
||||
prober_(new BitrateProber(event_log)),
|
||||
media_budget_(rtc::MakeUnique<IntervalBudget>(0)),
|
||||
padding_budget_(rtc::MakeUnique<IntervalBudget>(0)),
|
||||
prober_(rtc::MakeUnique<BitrateProber>(event_log)),
|
||||
probing_send_failure_(false),
|
||||
estimated_bitrate_bps_(0),
|
||||
min_send_bitrate_kbps_(0u),
|
||||
@ -59,7 +60,7 @@ PacedSender::PacedSender(const Clock* clock,
|
||||
pacing_bitrate_kbps_(0),
|
||||
time_last_update_us_(clock->TimeInMicroseconds()),
|
||||
first_sent_packet_ms_(-1),
|
||||
packets_(new PacketQueue(clock)),
|
||||
packets_(rtc::MakeUnique<PacketQueue>(clock)),
|
||||
packet_counter_(0),
|
||||
pacing_factor_(kDefaultPaceMultiplier),
|
||||
queue_time_limit(kMaxQueueLengthMs),
|
||||
|
||||
@ -166,19 +166,21 @@ class PacedSender : public Pacer {
|
||||
|
||||
const Clock* const clock_;
|
||||
PacketSender* const packet_sender_;
|
||||
std::unique_ptr<AlrDetector> alr_detector_ RTC_GUARDED_BY(critsect_);
|
||||
const std::unique_ptr<AlrDetector> alr_detector_ RTC_PT_GUARDED_BY(critsect_);
|
||||
|
||||
rtc::CriticalSection critsect_;
|
||||
bool paused_ RTC_GUARDED_BY(critsect_);
|
||||
// This is the media budget, keeping track of how many bits of media
|
||||
// we can pace out during the current interval.
|
||||
std::unique_ptr<IntervalBudget> media_budget_ RTC_GUARDED_BY(critsect_);
|
||||
const std::unique_ptr<IntervalBudget> media_budget_
|
||||
RTC_PT_GUARDED_BY(critsect_);
|
||||
// This is the padding budget, keeping track of how many bits of padding we're
|
||||
// allowed to send out during the current interval. This budget will be
|
||||
// utilized when there's no media to send.
|
||||
std::unique_ptr<IntervalBudget> padding_budget_ RTC_GUARDED_BY(critsect_);
|
||||
const std::unique_ptr<IntervalBudget> padding_budget_
|
||||
RTC_PT_GUARDED_BY(critsect_);
|
||||
|
||||
std::unique_ptr<BitrateProber> prober_ RTC_GUARDED_BY(critsect_);
|
||||
const std::unique_ptr<BitrateProber> prober_ RTC_PT_GUARDED_BY(critsect_);
|
||||
bool probing_send_failure_ RTC_GUARDED_BY(critsect_);
|
||||
// Actual configured bitrates (media_budget_ may temporarily be higher in
|
||||
// order to meet pace time constraint).
|
||||
@ -190,7 +192,7 @@ class PacedSender : public Pacer {
|
||||
int64_t time_last_update_us_ RTC_GUARDED_BY(critsect_);
|
||||
int64_t first_sent_packet_ms_ RTC_GUARDED_BY(critsect_);
|
||||
|
||||
std::unique_ptr<PacketQueue> packets_ RTC_GUARDED_BY(critsect_);
|
||||
const std::unique_ptr<PacketQueue> packets_ RTC_PT_GUARDED_BY(critsect_);
|
||||
uint64_t packet_counter_ RTC_GUARDED_BY(critsect_);
|
||||
ProcessThread* process_thread_ = nullptr;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user