remove more CriticalSectionWrappers.
BUG=webrtc:7035 Review-Url: https://codereview.webrtc.org/2779623002 Cr-Commit-Position: refs/heads/master@{#17392}
This commit is contained in:
@ -148,8 +148,8 @@ private:
|
||||
|
||||
bool LimitMixedAudio(AudioFrame* mixedAudio) const;
|
||||
|
||||
const rtc::CriticalSection _crit;
|
||||
const rtc::CriticalSection _cbCrit;
|
||||
rtc::CriticalSection _crit;
|
||||
rtc::CriticalSection _cbCrit;
|
||||
|
||||
int32_t _id;
|
||||
|
||||
|
||||
@ -33,8 +33,7 @@ struct MediaOptimization::EncodedFrameSample {
|
||||
};
|
||||
|
||||
MediaOptimization::MediaOptimization(Clock* clock)
|
||||
: crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
clock_(clock),
|
||||
: clock_(clock),
|
||||
max_bit_rate_(0),
|
||||
codec_width_(0),
|
||||
codec_height_(0),
|
||||
@ -56,7 +55,7 @@ MediaOptimization::~MediaOptimization(void) {
|
||||
}
|
||||
|
||||
void MediaOptimization::Reset() {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
rtc::CritScope lock(&crit_sect_);
|
||||
SetEncodingDataInternal(0, 0, 0, 0, 0, 0, max_payload_size_);
|
||||
memset(incoming_frame_times_, -1, sizeof(incoming_frame_times_));
|
||||
incoming_frame_rate_ = 0.0;
|
||||
@ -79,7 +78,7 @@ void MediaOptimization::SetEncodingData(int32_t max_bit_rate,
|
||||
uint32_t frame_rate,
|
||||
int num_layers,
|
||||
int32_t mtu) {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
rtc::CritScope lock(&crit_sect_);
|
||||
SetEncodingDataInternal(max_bit_rate, frame_rate, target_bitrate, width,
|
||||
height, num_layers, mtu);
|
||||
}
|
||||
@ -107,7 +106,7 @@ void MediaOptimization::SetEncodingDataInternal(int32_t max_bit_rate,
|
||||
}
|
||||
|
||||
uint32_t MediaOptimization::SetTargetRates(uint32_t target_bitrate) {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
rtc::CritScope lock(&crit_sect_);
|
||||
|
||||
video_target_bitrate_ = target_bitrate;
|
||||
|
||||
@ -125,7 +124,7 @@ uint32_t MediaOptimization::SetTargetRates(uint32_t target_bitrate) {
|
||||
}
|
||||
|
||||
uint32_t MediaOptimization::InputFrameRate() {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
rtc::CritScope lock(&crit_sect_);
|
||||
return InputFrameRateInternal();
|
||||
}
|
||||
|
||||
@ -137,7 +136,7 @@ uint32_t MediaOptimization::InputFrameRateInternal() {
|
||||
}
|
||||
|
||||
uint32_t MediaOptimization::SentFrameRate() {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
rtc::CritScope lock(&crit_sect_);
|
||||
return SentFrameRateInternal();
|
||||
}
|
||||
|
||||
@ -148,7 +147,7 @@ uint32_t MediaOptimization::SentFrameRateInternal() {
|
||||
}
|
||||
|
||||
uint32_t MediaOptimization::SentBitRate() {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
rtc::CritScope lock(&crit_sect_);
|
||||
const int64_t now_ms = clock_->TimeInMilliseconds();
|
||||
PurgeOldFrameSamples(now_ms);
|
||||
UpdateSentBitrate(now_ms);
|
||||
@ -159,7 +158,7 @@ int32_t MediaOptimization::UpdateWithEncodedData(
|
||||
const EncodedImage& encoded_image) {
|
||||
size_t encoded_length = encoded_image._length;
|
||||
uint32_t timestamp = encoded_image._timeStamp;
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
rtc::CritScope lock(&crit_sect_);
|
||||
const int64_t now_ms = clock_->TimeInMilliseconds();
|
||||
PurgeOldFrameSamples(now_ms);
|
||||
if (encoded_frame_samples_.size() > 0 &&
|
||||
@ -184,12 +183,12 @@ int32_t MediaOptimization::UpdateWithEncodedData(
|
||||
}
|
||||
|
||||
void MediaOptimization::EnableFrameDropper(bool enable) {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
rtc::CritScope lock(&crit_sect_);
|
||||
frame_dropper_->Enable(enable);
|
||||
}
|
||||
|
||||
bool MediaOptimization::DropFrame() {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
rtc::CritScope lock(&crit_sect_);
|
||||
UpdateIncomingFrameRate();
|
||||
// Leak appropriate number of bytes.
|
||||
frame_dropper_->Leak((uint32_t)(InputFrameRateInternal() + 0.5f));
|
||||
|
||||
@ -101,7 +101,7 @@ class MediaOptimization {
|
||||
uint32_t SentFrameRateInternal() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
||||
|
||||
// Protect all members.
|
||||
std::unique_ptr<CriticalSectionWrapper> crit_sect_;
|
||||
rtc::CriticalSection crit_sect_;
|
||||
|
||||
Clock* clock_ GUARDED_BY(crit_sect_);
|
||||
int32_t max_bit_rate_ GUARDED_BY(crit_sect_);
|
||||
|
||||
@ -72,8 +72,7 @@ VCMReceiver::VCMReceiver(VCMTiming* timing,
|
||||
std::unique_ptr<EventWrapper> jitter_buffer_event,
|
||||
NackSender* nack_sender,
|
||||
KeyFrameRequestSender* keyframe_request_sender)
|
||||
: crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
clock_(clock),
|
||||
: clock_(clock),
|
||||
jitter_buffer_(clock_,
|
||||
std::move(jitter_buffer_event),
|
||||
nack_sender,
|
||||
@ -86,11 +85,10 @@ VCMReceiver::VCMReceiver(VCMTiming* timing,
|
||||
|
||||
VCMReceiver::~VCMReceiver() {
|
||||
render_wait_event_->Set();
|
||||
delete crit_sect_;
|
||||
}
|
||||
|
||||
void VCMReceiver::Reset() {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
if (!jitter_buffer_.Running()) {
|
||||
jitter_buffer_.Start();
|
||||
} else {
|
||||
@ -242,7 +240,7 @@ void VCMReceiver::ReceiveStatistics(uint32_t* bitrate, uint32_t* framerate) {
|
||||
void VCMReceiver::SetNackMode(VCMNackMode nackMode,
|
||||
int64_t low_rtt_nack_threshold_ms,
|
||||
int64_t high_rtt_nack_threshold_ms) {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
// Default to always having NACK enabled in hybrid mode.
|
||||
jitter_buffer_.SetNackMode(nackMode, low_rtt_nack_threshold_ms,
|
||||
high_rtt_nack_threshold_ms);
|
||||
@ -256,7 +254,7 @@ void VCMReceiver::SetNackSettings(size_t max_nack_list_size,
|
||||
}
|
||||
|
||||
VCMNackMode VCMReceiver::NackMode() const {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
return jitter_buffer_.nack_mode();
|
||||
}
|
||||
|
||||
@ -273,7 +271,7 @@ VCMDecodeErrorMode VCMReceiver::DecodeErrorMode() const {
|
||||
}
|
||||
|
||||
int VCMReceiver::SetMinReceiverDelay(int desired_delay_ms) {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
if (desired_delay_ms < 0 || desired_delay_ms > kMaxReceiverDelayMs) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -14,10 +14,10 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/base/criticalsection.h"
|
||||
#include "webrtc/modules/video_coding/jitter_buffer.h"
|
||||
#include "webrtc/modules/video_coding/packet.h"
|
||||
#include "webrtc/modules/video_coding/timing.h"
|
||||
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
|
||||
#include "webrtc/modules/video_coding/include/video_coding.h"
|
||||
#include "webrtc/modules/video_coding/include/video_coding_defines.h"
|
||||
|
||||
@ -91,7 +91,7 @@ class VCMReceiver {
|
||||
void TriggerDecoderShutdown();
|
||||
|
||||
private:
|
||||
CriticalSectionWrapper* crit_sect_;
|
||||
rtc::CriticalSection crit_sect_;
|
||||
Clock* const clock_;
|
||||
VCMJitterBuffer jitter_buffer_;
|
||||
VCMTiming* timing_;
|
||||
|
||||
@ -21,22 +21,21 @@
|
||||
namespace webrtc {
|
||||
|
||||
VCMTiming::VCMTiming(Clock* clock, VCMTiming* master_timing)
|
||||
: crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
clock_(clock),
|
||||
master_(false),
|
||||
ts_extrapolator_(),
|
||||
codec_timer_(new VCMCodecTimer()),
|
||||
render_delay_ms_(kDefaultRenderDelayMs),
|
||||
min_playout_delay_ms_(0),
|
||||
max_playout_delay_ms_(10000),
|
||||
jitter_delay_ms_(0),
|
||||
current_delay_ms_(0),
|
||||
last_decode_ms_(0),
|
||||
prev_frame_timestamp_(0),
|
||||
num_decoded_frames_(0),
|
||||
num_delayed_decoded_frames_(0),
|
||||
first_decoded_frame_ms_(-1),
|
||||
sum_missed_render_deadline_ms_(0) {
|
||||
: clock_(clock),
|
||||
master_(false),
|
||||
ts_extrapolator_(),
|
||||
codec_timer_(new VCMCodecTimer()),
|
||||
render_delay_ms_(kDefaultRenderDelayMs),
|
||||
min_playout_delay_ms_(0),
|
||||
max_playout_delay_ms_(10000),
|
||||
jitter_delay_ms_(0),
|
||||
current_delay_ms_(0),
|
||||
last_decode_ms_(0),
|
||||
prev_frame_timestamp_(0),
|
||||
num_decoded_frames_(0),
|
||||
num_delayed_decoded_frames_(0),
|
||||
first_decoded_frame_ms_(-1),
|
||||
sum_missed_render_deadline_ms_(0) {
|
||||
if (master_timing == NULL) {
|
||||
master_ = true;
|
||||
ts_extrapolator_ = new TimestampExtrapolator(clock_->TimeInMilliseconds());
|
||||
@ -50,11 +49,10 @@ VCMTiming::~VCMTiming() {
|
||||
if (master_) {
|
||||
delete ts_extrapolator_;
|
||||
}
|
||||
delete crit_sect_;
|
||||
}
|
||||
|
||||
void VCMTiming::UpdateHistograms() const {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
if (num_decoded_frames_ == 0) {
|
||||
return;
|
||||
}
|
||||
@ -77,7 +75,7 @@ void VCMTiming::UpdateHistograms() const {
|
||||
}
|
||||
|
||||
void VCMTiming::Reset() {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
ts_extrapolator_->Reset(clock_->TimeInMilliseconds());
|
||||
codec_timer_.reset(new VCMCodecTimer());
|
||||
render_delay_ms_ = kDefaultRenderDelayMs;
|
||||
@ -88,37 +86,37 @@ void VCMTiming::Reset() {
|
||||
}
|
||||
|
||||
void VCMTiming::ResetDecodeTime() {
|
||||
CriticalSectionScoped lock(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
codec_timer_.reset(new VCMCodecTimer());
|
||||
}
|
||||
|
||||
void VCMTiming::set_render_delay(int render_delay_ms) {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
render_delay_ms_ = render_delay_ms;
|
||||
}
|
||||
|
||||
void VCMTiming::set_min_playout_delay(int min_playout_delay_ms) {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
min_playout_delay_ms_ = min_playout_delay_ms;
|
||||
}
|
||||
|
||||
int VCMTiming::min_playout_delay() {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
return min_playout_delay_ms_;
|
||||
}
|
||||
|
||||
void VCMTiming::set_max_playout_delay(int max_playout_delay_ms) {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
max_playout_delay_ms_ = max_playout_delay_ms;
|
||||
}
|
||||
|
||||
int VCMTiming::max_playout_delay() {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
return max_playout_delay_ms_;
|
||||
}
|
||||
|
||||
void VCMTiming::SetJitterDelay(int jitter_delay_ms) {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
if (jitter_delay_ms != jitter_delay_ms_) {
|
||||
jitter_delay_ms_ = jitter_delay_ms;
|
||||
// When in initial state, set current delay to minimum delay.
|
||||
@ -129,7 +127,7 @@ void VCMTiming::SetJitterDelay(int jitter_delay_ms) {
|
||||
}
|
||||
|
||||
void VCMTiming::UpdateCurrentDelay(uint32_t frame_timestamp) {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
int target_delay_ms = TargetDelayInternal();
|
||||
|
||||
if (current_delay_ms_ == 0) {
|
||||
@ -171,7 +169,7 @@ void VCMTiming::UpdateCurrentDelay(uint32_t frame_timestamp) {
|
||||
|
||||
void VCMTiming::UpdateCurrentDelay(int64_t render_time_ms,
|
||||
int64_t actual_decode_time_ms) {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
uint32_t target_delay_ms = TargetDelayInternal();
|
||||
int64_t delayed_ms =
|
||||
actual_decode_time_ms -
|
||||
@ -190,7 +188,7 @@ int32_t VCMTiming::StopDecodeTimer(uint32_t time_stamp,
|
||||
int32_t decode_time_ms,
|
||||
int64_t now_ms,
|
||||
int64_t render_time_ms) {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
codec_timer_->AddTiming(decode_time_ms, now_ms);
|
||||
assert(decode_time_ms >= 0);
|
||||
last_decode_ms_ = decode_time_ms;
|
||||
@ -209,13 +207,13 @@ int32_t VCMTiming::StopDecodeTimer(uint32_t time_stamp,
|
||||
}
|
||||
|
||||
void VCMTiming::IncomingTimestamp(uint32_t time_stamp, int64_t now_ms) {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
ts_extrapolator_->Update(now_ms, time_stamp);
|
||||
}
|
||||
|
||||
int64_t VCMTiming::RenderTimeMs(uint32_t frame_timestamp,
|
||||
int64_t now_ms) const {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
const int64_t render_time_ms = RenderTimeMsInternal(frame_timestamp, now_ms);
|
||||
return render_time_ms;
|
||||
}
|
||||
@ -249,7 +247,7 @@ int VCMTiming::RequiredDecodeTimeMs() const {
|
||||
|
||||
uint32_t VCMTiming::MaxWaitingTime(int64_t render_time_ms,
|
||||
int64_t now_ms) const {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
|
||||
const int64_t max_wait_time_ms =
|
||||
render_time_ms - now_ms - RequiredDecodeTimeMs() - render_delay_ms_;
|
||||
@ -262,7 +260,7 @@ uint32_t VCMTiming::MaxWaitingTime(int64_t render_time_ms,
|
||||
|
||||
bool VCMTiming::EnoughTimeToDecode(
|
||||
uint32_t available_processing_time_ms) const {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
int64_t required_decode_time_ms = RequiredDecodeTimeMs();
|
||||
if (required_decode_time_ms < 0) {
|
||||
// Haven't decoded any frames yet, try decoding one to get an estimate
|
||||
@ -279,7 +277,7 @@ bool VCMTiming::EnoughTimeToDecode(
|
||||
}
|
||||
|
||||
int VCMTiming::TargetVideoDelay() const {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
return TargetDelayInternal();
|
||||
}
|
||||
|
||||
@ -295,7 +293,7 @@ bool VCMTiming::GetTimings(int* decode_ms,
|
||||
int* jitter_buffer_ms,
|
||||
int* min_playout_delay_ms,
|
||||
int* render_delay_ms) const {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
*decode_ms = last_decode_ms_;
|
||||
*max_decode_ms = RequiredDecodeTimeMs();
|
||||
*current_delay_ms = current_delay_ms_;
|
||||
|
||||
@ -13,9 +13,9 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/criticalsection.h"
|
||||
#include "webrtc/base/thread_annotations.h"
|
||||
#include "webrtc/modules/video_coding/codec_timer.h"
|
||||
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -114,7 +114,7 @@ class VCMTiming {
|
||||
private:
|
||||
void UpdateHistograms() const;
|
||||
|
||||
CriticalSectionWrapper* crit_sect_;
|
||||
rtc::CriticalSection crit_sect_;
|
||||
Clock* const clock_;
|
||||
bool master_ GUARDED_BY(crit_sect_);
|
||||
TimestampExtrapolator* ts_extrapolator_ GUARDED_BY(crit_sect_);
|
||||
|
||||
@ -50,21 +50,19 @@ namespace {
|
||||
// a register method all the way down to the function calling it.
|
||||
class EncodedImageCallbackWrapper : public EncodedImageCallback {
|
||||
public:
|
||||
EncodedImageCallbackWrapper()
|
||||
: cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
callback_(nullptr) {}
|
||||
EncodedImageCallbackWrapper() : callback_(nullptr) {}
|
||||
|
||||
virtual ~EncodedImageCallbackWrapper() {}
|
||||
|
||||
void Register(EncodedImageCallback* callback) {
|
||||
CriticalSectionScoped cs(cs_.get());
|
||||
rtc::CritScope lock(&cs_);
|
||||
callback_ = callback;
|
||||
}
|
||||
|
||||
virtual Result OnEncodedImage(const EncodedImage& encoded_image,
|
||||
const CodecSpecificInfo* codec_specific_info,
|
||||
const RTPFragmentationHeader* fragmentation) {
|
||||
CriticalSectionScoped cs(cs_.get());
|
||||
rtc::CritScope lock(&cs_);
|
||||
if (callback_) {
|
||||
return callback_->OnEncodedImage(encoded_image, codec_specific_info,
|
||||
fragmentation);
|
||||
@ -73,7 +71,7 @@ class EncodedImageCallbackWrapper : public EncodedImageCallback {
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<CriticalSectionWrapper> cs_;
|
||||
rtc::CriticalSection cs_;
|
||||
EncodedImageCallback* callback_ GUARDED_BY(cs_);
|
||||
};
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
|
||||
#include "webrtc/base/criticalsection.h"
|
||||
#ifdef _WIN32
|
||||
#include "webrtc/system_wrappers/include/fix_interlocked_exchange_pointer_win.h"
|
||||
#endif
|
||||
@ -40,14 +40,8 @@ static T* GetStaticInstance(CountOperation count_operation) {
|
||||
static T* volatile instance = NULL;
|
||||
CreateOperation state = kInstanceExists;
|
||||
#ifndef _WIN32
|
||||
// This memory is staticly allocated once. The application does not try to
|
||||
// free this memory. This approach is taken to avoid issues with
|
||||
// destruction order for statically allocated memory. The memory will be
|
||||
// reclaimed by the OS and memory leak tools will not recognize memory
|
||||
// reachable from statics leaked so no noise is added by doing this.
|
||||
static CriticalSectionWrapper* crit_sect(
|
||||
CriticalSectionWrapper::CreateCriticalSection());
|
||||
CriticalSectionScoped lock(crit_sect);
|
||||
rtc::CriticalSection crit_sect;
|
||||
rtc::CritScope lock(&crit_sect);
|
||||
|
||||
if (count_operation ==
|
||||
kAddRefNoCreate && instance_count == 0) {
|
||||
@ -77,13 +71,13 @@ static T* GetStaticInstance(CountOperation count_operation) {
|
||||
// since the thread owned by the tracing class also traces).
|
||||
// TODO(hellner): this is a bit out of place but here goes, de-couple
|
||||
// thread implementation with trace implementation.
|
||||
crit_sect->Leave();
|
||||
crit_sect.Leave();
|
||||
if (old_instance) {
|
||||
delete old_instance;
|
||||
}
|
||||
// Re-acquire the lock since the scoped critical section will release
|
||||
// it.
|
||||
crit_sect->Enter();
|
||||
crit_sect.Enter();
|
||||
return NULL;
|
||||
}
|
||||
#else // _WIN32
|
||||
|
||||
@ -19,17 +19,12 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
TracePosix::TracePosix()
|
||||
: crit_sect_(*CriticalSectionWrapper::CreateCriticalSection()) {
|
||||
TracePosix::TracePosix() {
|
||||
struct timeval system_time_high_res;
|
||||
gettimeofday(&system_time_high_res, 0);
|
||||
prev_api_tick_count_ = prev_tick_count_ = system_time_high_res.tv_sec;
|
||||
}
|
||||
|
||||
TracePosix::~TracePosix() {
|
||||
delete &crit_sect_;
|
||||
}
|
||||
|
||||
int32_t TracePosix::AddTime(char* trace_message, const TraceLevel level) const {
|
||||
struct timeval system_time_high_res;
|
||||
if (gettimeofday(&system_time_high_res, 0) == -1) {
|
||||
@ -42,7 +37,7 @@ int32_t TracePosix::AddTime(char* trace_message, const TraceLevel level) const {
|
||||
const uint32_t ms_time = system_time_high_res.tv_usec / 1000;
|
||||
uint32_t prev_tickCount = 0;
|
||||
{
|
||||
CriticalSectionScoped lock(&crit_sect_);
|
||||
rtc::CritScope lock(&crit_sect_);
|
||||
if (level == kTraceApiCall) {
|
||||
prev_tickCount = prev_tick_count_;
|
||||
prev_tick_count_ = ms_time;
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_TRACE_POSIX_H_
|
||||
#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_TRACE_POSIX_H_
|
||||
|
||||
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
|
||||
#include "webrtc/base/criticalsection.h"
|
||||
#include "webrtc/system_wrappers/source/trace_impl.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -19,7 +19,7 @@ namespace webrtc {
|
||||
class TracePosix : public TraceImpl {
|
||||
public:
|
||||
TracePosix();
|
||||
~TracePosix() override;
|
||||
~TracePosix() override = default;
|
||||
|
||||
// This method can be called on several different threads different from
|
||||
// the creating thread.
|
||||
@ -31,7 +31,7 @@ class TracePosix : public TraceImpl {
|
||||
volatile mutable uint32_t prev_api_tick_count_;
|
||||
volatile mutable uint32_t prev_tick_count_;
|
||||
|
||||
CriticalSectionWrapper& crit_sect_;
|
||||
rtc::CriticalSection crit_sect_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
namespace webrtc {
|
||||
|
||||
class Clock;
|
||||
class CriticalSectionWrapper;
|
||||
class PacketReceiver;
|
||||
|
||||
class NetworkPacket {
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class CriticalSectionWrapper;
|
||||
class EventTimerWrapper;
|
||||
|
||||
namespace test {
|
||||
|
||||
@ -32,8 +32,6 @@ enum { MAX_AUDIO_BUFFER_IN_SAMPLES = 60 * 32 };
|
||||
enum { MAX_AUDIO_BUFFER_IN_BYTES = MAX_AUDIO_BUFFER_IN_SAMPLES * 2 };
|
||||
enum { kMaxAudioBufferQueueLength = 100 };
|
||||
|
||||
class CriticalSectionWrapper;
|
||||
|
||||
class FileRecorderImpl : public FileRecorder {
|
||||
public:
|
||||
FileRecorderImpl(uint32_t instanceID, FileFormats fileFormat);
|
||||
|
||||
Reference in New Issue
Block a user