Remove ALL usage of CriticalSectionWrapper.

Finally we are able to remove this class entirely, along with the last
vestiges of it's use. I've also removed some legacy files that were only
used for windows XP support.

BUG=webrtc:7035

Review-Url: https://codereview.webrtc.org/2790533002
Cr-Commit-Position: refs/heads/master@{#17480}
This commit is contained in:
kthelgason
2017-03-31 02:03:55 -07:00
committed by Commit bot
parent 5533bd36fe
commit ff046c74c5
30 changed files with 132 additions and 949 deletions

View File

@ -24,16 +24,11 @@ PacketManipulatorImpl::PacketManipulatorImpl(PacketReader* packet_reader,
: packet_reader_(packet_reader),
config_(config),
active_burst_packets_(0),
critsect_(CriticalSectionWrapper::CreateCriticalSection()),
random_seed_(1),
verbose_(verbose) {
assert(packet_reader);
}
PacketManipulatorImpl::~PacketManipulatorImpl() {
delete critsect_;
}
int PacketManipulatorImpl::ManipulatePackets(
webrtc::EncodedImage* encoded_image) {
int nbr_packets_dropped = 0;
@ -89,10 +84,10 @@ inline double PacketManipulatorImpl::RandomUniform() {
// Use the previous result as new seed before each rand() call. Doing this
// it doesn't matter if other threads are calling rand() since we'll always
// get the same behavior as long as we're using a fixed initial seed.
critsect_->Enter();
critsect_.Enter();
srand(random_seed_);
random_seed_ = rand(); // NOLINT (rand_r instead of rand)
critsect_->Leave();
critsect_.Leave();
return (random_seed_ + 1.0) / (RAND_MAX + 1.0);
}

View File

@ -13,8 +13,8 @@
#include <stdlib.h>
#include "webrtc/base/criticalsection.h"
#include "webrtc/modules/video_coding/include/video_codec_interface.h"
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
#include "webrtc/test/testsupport/packet_reader.h"
namespace webrtc {
@ -91,7 +91,7 @@ class PacketManipulatorImpl : public PacketManipulator {
PacketManipulatorImpl(PacketReader* packet_reader,
const NetworkingConfig& config,
bool verbose);
virtual ~PacketManipulatorImpl();
~PacketManipulatorImpl() = default;
int ManipulatePackets(webrtc::EncodedImage* encoded_image) override;
virtual void InitializeRandomSeed(unsigned int seed);
@ -104,7 +104,7 @@ class PacketManipulatorImpl : public PacketManipulator {
const NetworkingConfig& config_;
// Used to simulate a burst over several frames.
int active_burst_packets_;
CriticalSectionWrapper* critsect_;
rtc::CriticalSection critsect_;
unsigned int random_seed_;
bool verbose_;
};