mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-15 14:50:39 +01:00
Remove mutable from rtc::CriticalSection members.
rtc::CriticalSection is now lockable from const methods and no longer need to remain mutable. BUG= R=tommi@webrtc.org Review URL: https://codereview.webrtc.org/1613643004 Cr-Commit-Position: refs/heads/master@{#11367}
This commit is contained in:
parent
7d0d0e0763
commit
5ad935cb56
38 changed files with 49 additions and 49 deletions
|
@ -278,7 +278,7 @@ class FakeAudioCaptureModule
|
|||
|
||||
// Protects variables that are accessed from process_thread_ and
|
||||
// the main thread.
|
||||
mutable rtc::CriticalSection crit_;
|
||||
rtc::CriticalSection crit_;
|
||||
// Protects |audio_callback_| that is accessed from process_thread_ and
|
||||
// the main thread.
|
||||
rtc::CriticalSection crit_callback_;
|
||||
|
|
|
@ -126,7 +126,7 @@ class FakeAdmTest : public testing::Test,
|
|||
return min_buffer_size;
|
||||
}
|
||||
|
||||
mutable rtc::CriticalSection crit_;
|
||||
rtc::CriticalSection crit_;
|
||||
|
||||
int push_iterations_;
|
||||
int pull_iterations_;
|
||||
|
|
|
@ -69,7 +69,7 @@ class CaptureRenderAdapter : public sigslot::has_slots<> {
|
|||
VideoRenderers video_renderers_;
|
||||
VideoCapturer* video_capturer_;
|
||||
// Critical section synchronizing the capture thread.
|
||||
mutable rtc::CriticalSection capture_crit_;
|
||||
rtc::CriticalSection capture_crit_;
|
||||
};
|
||||
|
||||
} // namespace cricket
|
||||
|
|
|
@ -142,7 +142,7 @@ class FakeVideoRenderer : public VideoRenderer {
|
|||
int height_;
|
||||
int num_rendered_frames_;
|
||||
bool black_frame_;
|
||||
mutable rtc::CriticalSection crit_;
|
||||
rtc::CriticalSection crit_;
|
||||
};
|
||||
|
||||
} // namespace cricket
|
||||
|
|
|
@ -149,7 +149,7 @@ class FileVideoCapturer::FileReadThread
|
|||
|
||||
private:
|
||||
FileVideoCapturer* capturer_;
|
||||
mutable rtc::CriticalSection crit_;
|
||||
rtc::CriticalSection crit_;
|
||||
bool finished_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(FileReadThread);
|
||||
|
|
|
@ -85,7 +85,7 @@ class YuvFramesCapturer::YuvFramesThread
|
|||
|
||||
private:
|
||||
YuvFramesCapturer* capturer_;
|
||||
mutable rtc::CriticalSection crit_;
|
||||
rtc::CriticalSection crit_;
|
||||
bool finished_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(YuvFramesThread);
|
||||
|
|
|
@ -47,7 +47,7 @@ class AudioState final : public webrtc::AudioState,
|
|||
|
||||
// The critical section isn't strictly needed in this case, but xSAN bots may
|
||||
// trigger on unprotected cross-thread access.
|
||||
mutable rtc::CriticalSection crit_sect_;
|
||||
rtc::CriticalSection crit_sect_;
|
||||
bool typing_noise_detected_ GUARDED_BY(crit_sect_) = false;
|
||||
|
||||
// Reference count; implementation copied from rtc::RefCountedObject.
|
||||
|
|
|
@ -45,7 +45,7 @@ class BufferQueue {
|
|||
private:
|
||||
size_t capacity_;
|
||||
size_t default_size_;
|
||||
mutable CriticalSection crit_;
|
||||
CriticalSection crit_;
|
||||
std::deque<Buffer*> queue_ GUARDED_BY(crit_);
|
||||
std::vector<Buffer*> free_list_ GUARDED_BY(crit_);
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ class MessageQueue {
|
|||
MessageList msgq_;
|
||||
PriorityQueue dmsgq_;
|
||||
uint32_t dmsgq_next_num_;
|
||||
mutable CriticalSection crit_;
|
||||
CriticalSection crit_;
|
||||
|
||||
private:
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(MessageQueue);
|
||||
|
|
|
@ -172,7 +172,7 @@ class PhysicalSocket : public AsyncSocket, public sigslot::has_slots<> {
|
|||
SOCKET s_;
|
||||
uint8_t enabled_events_;
|
||||
bool udp_;
|
||||
mutable CriticalSection crit_;
|
||||
CriticalSection crit_;
|
||||
int error_ GUARDED_BY(crit_);
|
||||
ConnState state_;
|
||||
AsyncResolver* resolver_;
|
||||
|
|
|
@ -555,7 +555,7 @@ class FifoBuffer : public StreamInterface {
|
|||
size_t data_length_; // amount of readable data in the buffer
|
||||
size_t read_position_; // offset to the readable data
|
||||
Thread* owner_; // stream callbacks are dispatched on this thread
|
||||
mutable CriticalSection crit_; // object lock
|
||||
CriticalSection crit_; // object lock
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(FifoBuffer);
|
||||
};
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class ThreadCheckerImpl {
|
|||
void DetachFromThread();
|
||||
|
||||
private:
|
||||
mutable CriticalSection lock_;
|
||||
CriticalSection lock_;
|
||||
// This is mutable so that CalledOnValidThread can set it.
|
||||
// It's guarded by |lock_|.
|
||||
mutable PlatformThreadRef valid_thread_;
|
||||
|
|
|
@ -164,7 +164,7 @@ class AtomicBool {
|
|||
}
|
||||
|
||||
private:
|
||||
mutable CriticalSection cs_;
|
||||
CriticalSection cs_;
|
||||
bool flag_;
|
||||
};
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ class BitrateAllocator {
|
|||
ObserverBitrateMap LowRateAllocation(uint32_t bitrate)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
||||
|
||||
mutable rtc::CriticalSection crit_sect_;
|
||||
rtc::CriticalSection crit_sect_;
|
||||
// Stored in a list to keep track of the insertion order.
|
||||
BitrateObserverConfList bitrate_observers_ GUARDED_BY(crit_sect_);
|
||||
bool bitrate_observers_modified_ GUARDED_BY(crit_sect_);
|
||||
|
|
|
@ -113,7 +113,7 @@ class SyncRtcpObserver : public test::RtpRtcpObserver {
|
|||
ntp_rtp_pairs_.push_front(ntp_rtp_pair);
|
||||
}
|
||||
|
||||
mutable rtc::CriticalSection crit_;
|
||||
rtc::CriticalSection crit_;
|
||||
RtcpList ntp_rtp_pairs_ GUARDED_BY(crit_);
|
||||
};
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ class CongestionController {
|
|||
rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_;
|
||||
rtc::scoped_ptr<RemoteEstimatorProxy> remote_estimator_proxy_;
|
||||
|
||||
mutable rtc::CriticalSection encoder_crit_;
|
||||
rtc::CriticalSection encoder_crit_;
|
||||
std::vector<ViEEncoder*> encoders_ GUARDED_BY(encoder_crit_);
|
||||
|
||||
// Registered at construct time and assumed to outlive this class.
|
||||
|
|
|
@ -77,9 +77,9 @@ class IncomingVideoStream : public VideoRenderCallback {
|
|||
uint32_t const stream_id_;
|
||||
const bool disable_prerenderer_smoothing_;
|
||||
// Critsects in allowed to enter order.
|
||||
mutable rtc::CriticalSection stream_critsect_;
|
||||
mutable rtc::CriticalSection thread_critsect_;
|
||||
mutable rtc::CriticalSection buffer_critsect_;
|
||||
rtc::CriticalSection stream_critsect_;
|
||||
rtc::CriticalSection thread_critsect_;
|
||||
rtc::CriticalSection buffer_critsect_;
|
||||
// TODO(pbos): Make plain member and stop resetting this thread, just
|
||||
// start/stoping it is enough.
|
||||
rtc::scoped_ptr<rtc::PlatformThread> incoming_render_thread_
|
||||
|
|
|
@ -281,7 +281,7 @@ class AcmReceiver {
|
|||
|
||||
uint32_t NowInTimestamp(int decoder_sampling_rate) const;
|
||||
|
||||
mutable rtc::CriticalSection crit_sect_;
|
||||
rtc::CriticalSection crit_sect_;
|
||||
int id_; // TODO(henrik.lundin) Make const.
|
||||
const Decoder* last_audio_decoder_ GUARDED_BY(crit_sect_);
|
||||
AudioFrame::VADActivity previous_audio_activity_ GUARDED_BY(crit_sect_);
|
||||
|
|
|
@ -240,7 +240,7 @@ class AudioCodingModuleImpl final : public AudioCodingModule {
|
|||
// to |index|.
|
||||
int UpdateUponReceivingCodec(int index);
|
||||
|
||||
mutable rtc::CriticalSection acm_crit_sect_;
|
||||
rtc::CriticalSection acm_crit_sect_;
|
||||
rtc::Buffer encode_buffer_ GUARDED_BY(acm_crit_sect_);
|
||||
int id_; // TODO(henrik.lundin) Make const.
|
||||
uint32_t expected_codec_ts_ GUARDED_BY(acm_crit_sect_);
|
||||
|
@ -274,7 +274,7 @@ class AudioCodingModuleImpl final : public AudioCodingModule {
|
|||
uint32_t last_timestamp_ GUARDED_BY(acm_crit_sect_);
|
||||
uint32_t last_rtp_timestamp_ GUARDED_BY(acm_crit_sect_);
|
||||
|
||||
mutable rtc::CriticalSection callback_crit_sect_;
|
||||
rtc::CriticalSection callback_crit_sect_;
|
||||
AudioPacketizationCallback* packetization_callback_
|
||||
GUARDED_BY(callback_crit_sect_);
|
||||
ACMVADCallback* vad_callback_ GUARDED_BY(callback_crit_sect_);
|
||||
|
|
|
@ -147,7 +147,7 @@ class PacketizationCallbackStubOldApi : public AudioPacketizationCallback {
|
|||
int last_payload_type_ GUARDED_BY(crit_sect_);
|
||||
uint32_t last_timestamp_ GUARDED_BY(crit_sect_);
|
||||
std::vector<uint8_t> last_payload_vec_ GUARDED_BY(crit_sect_);
|
||||
mutable rtc::CriticalSection crit_sect_;
|
||||
rtc::CriticalSection crit_sect_;
|
||||
};
|
||||
|
||||
class AudioCodingModuleTestOldApi : public ::testing::Test {
|
||||
|
@ -579,7 +579,7 @@ class AudioCodingModuleMtTestOldApi : public AudioCodingModuleTestOldApi {
|
|||
int send_count_;
|
||||
int insert_packet_count_;
|
||||
int pull_audio_count_ GUARDED_BY(crit_sect_);
|
||||
mutable rtc::CriticalSection crit_sect_;
|
||||
rtc::CriticalSection crit_sect_;
|
||||
int64_t next_insert_packet_time_ms_ GUARDED_BY(crit_sect_);
|
||||
rtc::scoped_ptr<SimulatedClock> fake_clock_;
|
||||
};
|
||||
|
@ -842,7 +842,7 @@ class AcmReRegisterIsacMtTestOldApi : public AudioCodingModuleTestOldApi {
|
|||
rtc::PlatformThread receive_thread_;
|
||||
rtc::PlatformThread codec_registration_thread_;
|
||||
const rtc::scoped_ptr<EventWrapper> test_complete_;
|
||||
mutable rtc::CriticalSection crit_sect_;
|
||||
rtc::CriticalSection crit_sect_;
|
||||
bool codec_registered_ GUARDED_BY(crit_sect_);
|
||||
int receive_packet_count_ GUARDED_BY(crit_sect_);
|
||||
int64_t next_insert_packet_time_ms_ GUARDED_BY(crit_sect_);
|
||||
|
|
|
@ -36,7 +36,7 @@ class LockedIsacBandwidthInfo final {
|
|||
}
|
||||
|
||||
private:
|
||||
mutable rtc::CriticalSection lock_;
|
||||
rtc::CriticalSection lock_;
|
||||
IsacBandwidthInfo bwinfo_ GUARDED_BY(lock_);
|
||||
};
|
||||
|
||||
|
|
|
@ -338,7 +338,7 @@ class NetEqImpl : public webrtc::NetEq {
|
|||
// Creates DecisionLogic object with the mode given by |playout_mode_|.
|
||||
virtual void CreateDecisionLogic() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
||||
|
||||
mutable rtc::CriticalSection crit_sect_;
|
||||
rtc::CriticalSection crit_sect_;
|
||||
const rtc::scoped_ptr<BufferLevelFilter> buffer_level_filter_
|
||||
GUARDED_BY(crit_sect_);
|
||||
const rtc::scoped_ptr<DecoderDatabase> decoder_database_
|
||||
|
|
|
@ -100,7 +100,7 @@ class Channel : public AudioPacketizationCallback {
|
|||
// 60msec * 32 sample(max)/msec * 2 description (maybe) * 2 bytes/sample
|
||||
uint8_t _payloadData[60 * 32 * 2 * 2];
|
||||
|
||||
mutable rtc::CriticalSection _channelCritSect;
|
||||
rtc::CriticalSection _channelCritSect;
|
||||
FILE* _bitStreamFile;
|
||||
bool _saveBitStream;
|
||||
int16_t _lastPayloadType;
|
||||
|
|
|
@ -239,15 +239,15 @@ class AudioProcessingImpl : public AudioProcessing {
|
|||
EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
|
||||
|
||||
// Critical section.
|
||||
mutable rtc::CriticalSection crit_debug_;
|
||||
rtc::CriticalSection crit_debug_;
|
||||
|
||||
// Debug dump state.
|
||||
ApmDebugDumpState debug_dump_;
|
||||
#endif
|
||||
|
||||
// Critical sections.
|
||||
mutable rtc::CriticalSection crit_render_ ACQUIRED_BEFORE(crit_capture_);
|
||||
mutable rtc::CriticalSection crit_capture_;
|
||||
rtc::CriticalSection crit_render_ ACQUIRED_BEFORE(crit_capture_);
|
||||
rtc::CriticalSection crit_capture_;
|
||||
|
||||
// Structs containing the pointers to the submodules.
|
||||
rtc::scoped_ptr<ApmPublicSubmodules> public_submodules_;
|
||||
|
|
|
@ -298,7 +298,7 @@ class FrameCounters {
|
|||
}
|
||||
|
||||
private:
|
||||
mutable rtc::CriticalSection crit_;
|
||||
rtc::CriticalSection crit_;
|
||||
int render_count GUARDED_BY(crit_) = 0;
|
||||
int capture_count GUARDED_BY(crit_) = 0;
|
||||
};
|
||||
|
|
|
@ -202,7 +202,7 @@ class FrameCounters {
|
|||
}
|
||||
|
||||
private:
|
||||
mutable rtc::CriticalSection crit_;
|
||||
rtc::CriticalSection crit_;
|
||||
int render_count_ GUARDED_BY(crit_) = 0;
|
||||
int capture_count_ GUARDED_BY(crit_) = 0;
|
||||
};
|
||||
|
@ -221,7 +221,7 @@ class LockedFlag {
|
|||
}
|
||||
|
||||
private:
|
||||
mutable rtc::CriticalSection crit_;
|
||||
rtc::CriticalSection crit_;
|
||||
bool flag_ GUARDED_BY(crit_) = false;
|
||||
};
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ class BitrateControllerImpl : public BitrateController {
|
|||
BitrateObserver* observer_;
|
||||
int64_t last_bitrate_update_ms_;
|
||||
|
||||
mutable rtc::CriticalSection critsect_;
|
||||
rtc::CriticalSection critsect_;
|
||||
SendSideBandwidthEstimation bandwidth_estimation_ GUARDED_BY(critsect_);
|
||||
uint32_t reserved_bitrate_bps_ GUARDED_BY(critsect_);
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_FRAME_BUFFER_POOL_H_
|
||||
#define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_FRAME_BUFFER_POOL_H_
|
||||
#ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_VP9_FRAME_BUFFER_POOL_H_
|
||||
#define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_VP9_FRAME_BUFFER_POOL_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -103,7 +103,7 @@ class Vp9FrameBufferPool {
|
|||
|
||||
private:
|
||||
// Protects |allocated_buffers_|.
|
||||
mutable rtc::CriticalSection buffers_lock_;
|
||||
rtc::CriticalSection buffers_lock_;
|
||||
// All buffers, in use or ready to be recycled.
|
||||
std::vector<rtc::scoped_refptr<Vp9FrameBuffer>> allocated_buffers_
|
||||
GUARDED_BY(buffers_lock_);
|
||||
|
@ -114,4 +114,4 @@ class Vp9FrameBufferPool {
|
|||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_FRAME_BUFFER_POOL_H_
|
||||
#endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_VP9_FRAME_BUFFER_POOL_H_
|
||||
|
|
|
@ -138,7 +138,7 @@ class VCMGenericEncoder {
|
|||
VideoEncoderRateObserver* const rate_observer_;
|
||||
VCMEncodedFrameCallback* const vcm_encoded_frame_callback_;
|
||||
const bool internal_source_;
|
||||
mutable rtc::CriticalSection params_lock_;
|
||||
rtc::CriticalSection params_lock_;
|
||||
EncoderParameters encoder_params_ GUARDED_BY(params_lock_);
|
||||
VideoRotation rotation_;
|
||||
bool is_screenshare_;
|
||||
|
|
|
@ -104,7 +104,7 @@ class VideoSender {
|
|||
Clock* const clock_;
|
||||
|
||||
rtc::scoped_ptr<CriticalSectionWrapper> process_crit_sect_;
|
||||
mutable rtc::CriticalSection encoder_crit_;
|
||||
rtc::CriticalSection encoder_crit_;
|
||||
VCMGenericEncoder* _encoder;
|
||||
VCMEncodedFrameCallback _encodedFrameCallback GUARDED_BY(encoder_crit_);
|
||||
media_optimization::MediaOptimization _mediaOpt;
|
||||
|
|
|
@ -44,7 +44,7 @@ class VideoProcessingImpl : public VideoProcessing {
|
|||
VideoContentMetrics* GetContentMetrics() const override;
|
||||
|
||||
private:
|
||||
mutable rtc::CriticalSection mutex_;
|
||||
rtc::CriticalSection mutex_;
|
||||
VPMDeflickering deflickering_ GUARDED_BY(mutex_);
|
||||
VPMBrightnessDetection brightness_detection_;
|
||||
VPMFramePreprocessor frame_pre_processor_;
|
||||
|
|
|
@ -179,7 +179,7 @@ class WindowsRealTimeClock : public RealTimeClock {
|
|||
}
|
||||
|
||||
// mutable as time-accessing functions are const.
|
||||
mutable rtc::CriticalSection crit_;
|
||||
rtc::CriticalSection crit_;
|
||||
mutable DWORD last_time_ms_;
|
||||
mutable LONG num_timer_wraps_;
|
||||
const ReferencePoint ref_point_;
|
||||
|
|
|
@ -58,7 +58,7 @@ class FakeAudioDevice : public FakeAudioDeviceModule {
|
|||
|
||||
Clock* clock_;
|
||||
rtc::scoped_ptr<EventTimerWrapper> tick_;
|
||||
mutable rtc::CriticalSection lock_;
|
||||
rtc::CriticalSection lock_;
|
||||
rtc::PlatformThread thread_;
|
||||
rtc::scoped_ptr<ModuleFileUtility> file_utility_;
|
||||
rtc::scoped_ptr<FileWrapper> input_stream_;
|
||||
|
|
|
@ -71,7 +71,7 @@ class FakeNetworkPipe {
|
|||
|
||||
private:
|
||||
Clock* const clock_;
|
||||
mutable rtc::CriticalSection lock_;
|
||||
rtc::CriticalSection lock_;
|
||||
PacketReceiver* packet_receiver_;
|
||||
std::queue<NetworkPacket*> capacity_link_;
|
||||
std::queue<NetworkPacket*> delay_link_;
|
||||
|
|
|
@ -119,7 +119,7 @@ class OveruseFrameDetector : public Module {
|
|||
// processing thread.
|
||||
// TODO(asapersson): See if we can reduce locking. As is, video frame
|
||||
// processing contends with reading stats and the processing thread.
|
||||
mutable rtc::CriticalSection crit_;
|
||||
rtc::CriticalSection crit_;
|
||||
|
||||
const CpuOveruseOptions options_;
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ class ReceiveStatisticsProxy : public VCMReceiveStatisticsCallback,
|
|||
|
||||
Clock* const clock_;
|
||||
|
||||
mutable rtc::CriticalSection crit_;
|
||||
rtc::CriticalSection crit_;
|
||||
VideoReceiveStream::Stats stats_ GUARDED_BY(crit_);
|
||||
RateStatistics decode_fps_estimator_ GUARDED_BY(crit_);
|
||||
RateStatistics renders_fps_estimator_ GUARDED_BY(crit_);
|
||||
|
|
|
@ -131,7 +131,7 @@ class SendStatisticsProxy : public CpuOveruseMetricsObserver,
|
|||
|
||||
Clock* const clock_;
|
||||
const VideoSendStream::Config config_;
|
||||
mutable rtc::CriticalSection crit_;
|
||||
rtc::CriticalSection crit_;
|
||||
VideoEncoderConfig::ContentType content_type_ GUARDED_BY(crit_);
|
||||
VideoSendStream::Stats stats_ GUARDED_BY(crit_);
|
||||
uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_);
|
||||
|
|
|
@ -1079,7 +1079,7 @@ TEST_F(VideoSendStreamTest, CanReconfigureToUseStartBitrateAbovePreviousMax) {
|
|||
}
|
||||
|
||||
private:
|
||||
mutable rtc::CriticalSection crit_;
|
||||
rtc::CriticalSection crit_;
|
||||
int start_bitrate_kbps_ GUARDED_BY(crit_);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue