Delete master_timing argument to VCMTiming.
Makes construction simpler, and allows the ts_extrapolator_ pointer to be marked const. Followup to https://webrtc-review.googlesource.com/c/src/+/190721 Bug: webrtc:12102 Change-Id: I2abeb960935b5470509f654a4a9d5121c8001900 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/190981 Reviewed-by: Philip Eliasson <philipel@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32535}
This commit is contained in:
@ -21,11 +21,11 @@
|
|||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
VCMTiming::VCMTiming(Clock* clock, VCMTiming* master_timing)
|
VCMTiming::VCMTiming(Clock* clock)
|
||||||
: clock_(clock),
|
: clock_(clock),
|
||||||
master_(false),
|
ts_extrapolator_(std::make_unique<TimestampExtrapolator>(
|
||||||
ts_extrapolator_(),
|
clock_->TimeInMilliseconds())),
|
||||||
codec_timer_(new VCMCodecTimer()),
|
codec_timer_(std::make_unique<VCMCodecTimer>()),
|
||||||
render_delay_ms_(kDefaultRenderDelayMs),
|
render_delay_ms_(kDefaultRenderDelayMs),
|
||||||
min_playout_delay_ms_(0),
|
min_playout_delay_ms_(0),
|
||||||
max_playout_delay_ms_(10000),
|
max_playout_delay_ms_(10000),
|
||||||
@ -37,24 +37,12 @@ VCMTiming::VCMTiming(Clock* clock, VCMTiming* master_timing)
|
|||||||
low_latency_renderer_enabled_("enabled", true) {
|
low_latency_renderer_enabled_("enabled", true) {
|
||||||
ParseFieldTrial({&low_latency_renderer_enabled_},
|
ParseFieldTrial({&low_latency_renderer_enabled_},
|
||||||
field_trial::FindFullName("WebRTC-LowLatencyRenderer"));
|
field_trial::FindFullName("WebRTC-LowLatencyRenderer"));
|
||||||
if (master_timing == NULL) {
|
|
||||||
master_ = true;
|
|
||||||
ts_extrapolator_ = new TimestampExtrapolator(clock_->TimeInMilliseconds());
|
|
||||||
} else {
|
|
||||||
ts_extrapolator_ = master_timing->ts_extrapolator_;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
VCMTiming::~VCMTiming() {
|
|
||||||
if (master_) {
|
|
||||||
delete ts_extrapolator_;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VCMTiming::Reset() {
|
void VCMTiming::Reset() {
|
||||||
MutexLock lock(&mutex_);
|
MutexLock lock(&mutex_);
|
||||||
ts_extrapolator_->Reset(clock_->TimeInMilliseconds());
|
ts_extrapolator_->Reset(clock_->TimeInMilliseconds());
|
||||||
codec_timer_.reset(new VCMCodecTimer());
|
codec_timer_ = std::make_unique<VCMCodecTimer>();
|
||||||
render_delay_ms_ = kDefaultRenderDelayMs;
|
render_delay_ms_ = kDefaultRenderDelayMs;
|
||||||
min_playout_delay_ms_ = 0;
|
min_playout_delay_ms_ = 0;
|
||||||
jitter_delay_ms_ = 0;
|
jitter_delay_ms_ = 0;
|
||||||
@ -190,6 +178,8 @@ int64_t VCMTiming::RenderTimeMsInternal(uint32_t frame_timestamp,
|
|||||||
// Render as soon as possible or with low-latency renderer algorithm.
|
// Render as soon as possible or with low-latency renderer algorithm.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
// Note that TimestampExtrapolator::ExtrapolateLocalTime is not a const
|
||||||
|
// method; it mutates the object's wraparound state.
|
||||||
int64_t estimated_complete_time_ms =
|
int64_t estimated_complete_time_ms =
|
||||||
ts_extrapolator_->ExtrapolateLocalTime(frame_timestamp);
|
ts_extrapolator_->ExtrapolateLocalTime(frame_timestamp);
|
||||||
if (estimated_complete_time_ms == -1) {
|
if (estimated_complete_time_ms == -1) {
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "rtc_base/experiments/field_trial_parser.h"
|
#include "rtc_base/experiments/field_trial_parser.h"
|
||||||
#include "rtc_base/synchronization/mutex.h"
|
#include "rtc_base/synchronization/mutex.h"
|
||||||
#include "rtc_base/thread_annotations.h"
|
#include "rtc_base/thread_annotations.h"
|
||||||
|
#include "rtc_base/time/timestamp_extrapolator.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
@ -27,10 +28,8 @@ class TimestampExtrapolator;
|
|||||||
|
|
||||||
class VCMTiming {
|
class VCMTiming {
|
||||||
public:
|
public:
|
||||||
// The primary timing component should be passed
|
explicit VCMTiming(Clock* clock);
|
||||||
// if this is the dual timing component.
|
virtual ~VCMTiming() = default;
|
||||||
explicit VCMTiming(Clock* clock, VCMTiming* master_timing = NULL);
|
|
||||||
virtual ~VCMTiming();
|
|
||||||
|
|
||||||
// Resets the timing to the initial state.
|
// Resets the timing to the initial state.
|
||||||
void Reset();
|
void Reset();
|
||||||
@ -117,8 +116,7 @@ class VCMTiming {
|
|||||||
private:
|
private:
|
||||||
mutable Mutex mutex_;
|
mutable Mutex mutex_;
|
||||||
Clock* const clock_;
|
Clock* const clock_;
|
||||||
bool master_ RTC_GUARDED_BY(mutex_);
|
const std::unique_ptr<TimestampExtrapolator> ts_extrapolator_
|
||||||
TimestampExtrapolator* ts_extrapolator_ RTC_GUARDED_BY(mutex_)
|
|
||||||
RTC_PT_GUARDED_BY(mutex_);
|
RTC_PT_GUARDED_BY(mutex_);
|
||||||
std::unique_ptr<VCMCodecTimer> codec_timer_ RTC_GUARDED_BY(mutex_)
|
std::unique_ptr<VCMCodecTimer> codec_timer_ RTC_GUARDED_BY(mutex_)
|
||||||
RTC_PT_GUARDED_BY(mutex_);
|
RTC_PT_GUARDED_BY(mutex_);
|
||||||
|
Reference in New Issue
Block a user