Remove std:: prefixes from C functions in webrtc/.
std::memcpy -> memcpy for instance. This change was motivated by a compile report complaining that std::rand() was used instead of rand(), probably with a stdlib.h include instead of cstdlib. Use of C functions without the std:: prefix is a lot more common, so removing std:: to address this. BUG= R=tommi@webrtc.org Review URL: https://webrtc-codereview.appspot.com/9549004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5658 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -90,7 +90,7 @@ inline double PacketManipulatorImpl::RandomUniform() {
|
||||
// get the same behavior as long as we're using a fixed initial seed.
|
||||
critsect_->Enter();
|
||||
srand(random_seed_);
|
||||
random_seed_ = std::rand();
|
||||
random_seed_ = rand();
|
||||
critsect_->Leave();
|
||||
return (random_seed_ + 1.0)/(RAND_MAX + 1.0);
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ protected:
|
||||
virtual void Teardown();
|
||||
double ActualBitRate(int nFrames);
|
||||
virtual bool PacketLoss(double lossRate, int /*thrown*/);
|
||||
static double RandUniform() { return (std::rand() + 1.0)/(RAND_MAX + 1.0); }
|
||||
static double RandUniform() { return (rand() + 1.0)/(RAND_MAX + 1.0); }
|
||||
static void VideoEncodedBufferToEncodedImage(
|
||||
webrtc::VideoFrame& videoBuffer,
|
||||
webrtc::EncodedImage &image);
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
double const pi = 4*std::atan(1.0);
|
||||
double const pi = 4 * atan(1.0);
|
||||
|
||||
class GaussDist
|
||||
{
|
||||
@ -26,9 +26,10 @@ public:
|
||||
|
||||
double RandValue() // returns a single normally distributed number
|
||||
{
|
||||
double r1 = (std::rand() + 1.0)/(RAND_MAX + 1.0); // gives equal distribution in (0, 1]
|
||||
double r2 = (std::rand() + 1.0)/(RAND_MAX + 1.0);
|
||||
return _mu + _sigma * sqrt(-2*std::log(r1))*std::cos(2*pi*r2);
|
||||
double r1 = (rand() + 1.0) /
|
||||
(RAND_MAX + 1.0); // gives equal distribution in (0, 1]
|
||||
double r2 = (rand() + 1.0) / (RAND_MAX + 1.0);
|
||||
return _mu + _sigma * sqrt(-2 * log(r1)) * cos(2 * pi * r2);
|
||||
}
|
||||
|
||||
double GetAverage()
|
||||
@ -86,7 +87,7 @@ public:
|
||||
void SetLossRate(double rate);
|
||||
|
||||
private:
|
||||
double RandUniform() { return (std::rand() + 1.0)/(RAND_MAX + 1.0); }
|
||||
double RandUniform() { return (rand() + 1.0)/(RAND_MAX + 1.0); }
|
||||
unsigned int _frameRate;
|
||||
unsigned int _capacity;
|
||||
unsigned int _rate;
|
||||
|
||||
@ -406,7 +406,7 @@ RTPSendCompleteCallback::PacketLoss()
|
||||
bool
|
||||
RTPSendCompleteCallback::UnifomLoss(double lossPct)
|
||||
{
|
||||
double randVal = (std::rand() + 1.0)/(RAND_MAX + 1.0);
|
||||
double randVal = (rand() + 1.0) / (RAND_MAX + 1.0);
|
||||
return randVal < lossPct/100;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user