Migrate modules/video_coding to webrtc::Mutex.
Bug: webrtc:11567 Change-Id: I8023fbe7595f7ba8ae7c7db3583fc2e560ec3df2 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178803 Commit-Queue: Markus Handell <handellm@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31644}
This commit is contained in:
committed by
Commit Bot
parent
fb6f975401
commit
6deec38ede
@ -47,7 +47,7 @@ VCMTiming::~VCMTiming() {
|
||||
}
|
||||
|
||||
void VCMTiming::Reset() {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
MutexLock lock(&mutex_);
|
||||
ts_extrapolator_->Reset(clock_->TimeInMilliseconds());
|
||||
codec_timer_.reset(new VCMCodecTimer());
|
||||
render_delay_ms_ = kDefaultRenderDelayMs;
|
||||
@ -58,32 +58,32 @@ void VCMTiming::Reset() {
|
||||
}
|
||||
|
||||
void VCMTiming::set_render_delay(int render_delay_ms) {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
MutexLock lock(&mutex_);
|
||||
render_delay_ms_ = render_delay_ms;
|
||||
}
|
||||
|
||||
void VCMTiming::set_min_playout_delay(int min_playout_delay_ms) {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
MutexLock lock(&mutex_);
|
||||
min_playout_delay_ms_ = min_playout_delay_ms;
|
||||
}
|
||||
|
||||
int VCMTiming::min_playout_delay() {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
MutexLock lock(&mutex_);
|
||||
return min_playout_delay_ms_;
|
||||
}
|
||||
|
||||
void VCMTiming::set_max_playout_delay(int max_playout_delay_ms) {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
MutexLock lock(&mutex_);
|
||||
max_playout_delay_ms_ = max_playout_delay_ms;
|
||||
}
|
||||
|
||||
int VCMTiming::max_playout_delay() {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
MutexLock lock(&mutex_);
|
||||
return max_playout_delay_ms_;
|
||||
}
|
||||
|
||||
void VCMTiming::SetJitterDelay(int jitter_delay_ms) {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
MutexLock lock(&mutex_);
|
||||
if (jitter_delay_ms != jitter_delay_ms_) {
|
||||
jitter_delay_ms_ = jitter_delay_ms;
|
||||
// When in initial state, set current delay to minimum delay.
|
||||
@ -94,7 +94,7 @@ void VCMTiming::SetJitterDelay(int jitter_delay_ms) {
|
||||
}
|
||||
|
||||
void VCMTiming::UpdateCurrentDelay(uint32_t frame_timestamp) {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
MutexLock lock(&mutex_);
|
||||
int target_delay_ms = TargetDelayInternal();
|
||||
|
||||
if (current_delay_ms_ == 0) {
|
||||
@ -135,7 +135,7 @@ void VCMTiming::UpdateCurrentDelay(uint32_t frame_timestamp) {
|
||||
|
||||
void VCMTiming::UpdateCurrentDelay(int64_t render_time_ms,
|
||||
int64_t actual_decode_time_ms) {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
MutexLock lock(&mutex_);
|
||||
uint32_t target_delay_ms = TargetDelayInternal();
|
||||
int64_t delayed_ms =
|
||||
actual_decode_time_ms -
|
||||
@ -158,20 +158,20 @@ void VCMTiming::StopDecodeTimer(uint32_t /*time_stamp*/,
|
||||
}
|
||||
|
||||
void VCMTiming::StopDecodeTimer(int32_t decode_time_ms, int64_t now_ms) {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
MutexLock lock(&mutex_);
|
||||
codec_timer_->AddTiming(decode_time_ms, now_ms);
|
||||
assert(decode_time_ms >= 0);
|
||||
++num_decoded_frames_;
|
||||
}
|
||||
|
||||
void VCMTiming::IncomingTimestamp(uint32_t time_stamp, int64_t now_ms) {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
MutexLock lock(&mutex_);
|
||||
ts_extrapolator_->Update(now_ms, time_stamp);
|
||||
}
|
||||
|
||||
int64_t VCMTiming::RenderTimeMs(uint32_t frame_timestamp,
|
||||
int64_t now_ms) const {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
MutexLock lock(&mutex_);
|
||||
return RenderTimeMsInternal(frame_timestamp, now_ms);
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ int VCMTiming::RequiredDecodeTimeMs() const {
|
||||
|
||||
int64_t VCMTiming::MaxWaitingTime(int64_t render_time_ms,
|
||||
int64_t now_ms) const {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
MutexLock lock(&mutex_);
|
||||
|
||||
const int64_t max_wait_time_ms =
|
||||
render_time_ms - now_ms - RequiredDecodeTimeMs() - render_delay_ms_;
|
||||
@ -211,7 +211,7 @@ int64_t VCMTiming::MaxWaitingTime(int64_t render_time_ms,
|
||||
}
|
||||
|
||||
int VCMTiming::TargetVideoDelay() const {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
MutexLock lock(&mutex_);
|
||||
return TargetDelayInternal();
|
||||
}
|
||||
|
||||
@ -226,7 +226,7 @@ bool VCMTiming::GetTimings(int* max_decode_ms,
|
||||
int* jitter_buffer_ms,
|
||||
int* min_playout_delay_ms,
|
||||
int* render_delay_ms) const {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
MutexLock lock(&mutex_);
|
||||
*max_decode_ms = RequiredDecodeTimeMs();
|
||||
*current_delay_ms = current_delay_ms_;
|
||||
*target_delay_ms = TargetDelayInternal();
|
||||
@ -237,12 +237,12 @@ bool VCMTiming::GetTimings(int* max_decode_ms,
|
||||
}
|
||||
|
||||
void VCMTiming::SetTimingFrameInfo(const TimingFrameInfo& info) {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
MutexLock lock(&mutex_);
|
||||
timing_frame_info_.emplace(info);
|
||||
}
|
||||
|
||||
absl::optional<TimingFrameInfo> VCMTiming::GetTimingFrameInfo() {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
MutexLock lock(&mutex_);
|
||||
return timing_frame_info_;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user