Added a much needed Windows random function.
git-svn-id: http://yate.null.ro/svn/yate/trunk@648 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
b5e98980db
commit
0006294f42
|
@ -224,6 +224,7 @@ bool RTPTransport::localAddr(SocketAddr& addr)
|
|||
m_localAddr = addr;
|
||||
return true;
|
||||
}
|
||||
DDebug(DebugMild,"RTP Socket failed with code %d",m_rtpSock.error());
|
||||
m_rtpSock.terminate();
|
||||
m_rtcpSock.terminate();
|
||||
return false;
|
||||
|
@ -236,7 +237,11 @@ bool RTPTransport::localAddr(SocketAddr& addr)
|
|||
m_localAddr = addr;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
DDebug(DebugMild,"RTCP Socket failed with code %d",m_rtcpSock.error());
|
||||
}
|
||||
else
|
||||
DDebug(DebugMild,"RTP Socket failed with code %d",m_rtpSock.error());
|
||||
m_rtpSock.terminate();
|
||||
m_rtcpSock.terminate();
|
||||
return false;
|
||||
|
|
|
@ -219,6 +219,7 @@ void DataSource::Forward(const DataBlock& data, unsigned long tStamp)
|
|||
c->Consume(data,tStamp,this);
|
||||
}
|
||||
m_timestamp = tStamp;
|
||||
lock.drop();
|
||||
deref();
|
||||
}
|
||||
|
||||
|
@ -241,7 +242,7 @@ bool DataSource::attach(DataConsumer* consumer, bool override)
|
|||
if (consumer->m_override)
|
||||
consumer->m_override->detach(consumer);
|
||||
consumer->m_override = this;
|
||||
consumer->m_overrideTsDelta = consumer->m_timestamp - m_timestamp + dt;
|
||||
consumer->m_overrideTsDelta = (long)(consumer->m_timestamp - m_timestamp + dt);
|
||||
}
|
||||
else {
|
||||
if (consumer->m_source)
|
||||
|
|
|
@ -27,6 +27,22 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifdef _WINDOWS
|
||||
extern "C" {
|
||||
|
||||
static u_int32_t s_randSeed = (u_int32_t)(TelEngine::Time::now() & 0xffffffff);
|
||||
|
||||
long int random()
|
||||
{ return (s_randSeed = (s_randSeed + 1) * 0x8088405) % RAND_MAX; }
|
||||
|
||||
void srandom(unsigned int seed)
|
||||
{ s_randSeed = seed % RAND_MAX; }
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
namespace TelEngine {
|
||||
|
||||
#define DebugMin DebugFail
|
||||
|
@ -328,6 +344,7 @@ void Debugger::enableOutput(bool enable)
|
|||
s_debugging = enable;
|
||||
}
|
||||
|
||||
|
||||
u_int64_t Time::now()
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
|
|
|
@ -128,6 +128,10 @@ SOURCE=..\engine\HashList.cpp
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\engine\Iterator.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\engine\Message.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
12
yateclass.h
12
yateclass.h
|
@ -82,7 +82,6 @@ typedef unsigned long in_addr_t;
|
|||
#define vsnprintf _vsnprintf
|
||||
#define snprintf _snprintf
|
||||
#define strdup _strdup
|
||||
#define random rand
|
||||
#define open _open
|
||||
#define dup2 _dup2
|
||||
#define read _read
|
||||
|
@ -163,6 +162,15 @@ typedef int HANDLE;
|
|||
#define YATE_API
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#undef RAND_MAX
|
||||
#define RAND_MAX 2147483647
|
||||
extern "C" {
|
||||
YATE_API long int random();
|
||||
YATE_API void srandom(unsigned int seed);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Holds all Telephony Engine related classes.
|
||||
*/
|
||||
|
@ -189,7 +197,7 @@ YATE_API bool abortOnBug(bool doAbort);
|
|||
/**
|
||||
* Enable timestamping of output messages and set the time start reference
|
||||
*/
|
||||
void setDebugTimestamp();
|
||||
YATE_API void setDebugTimestamp();
|
||||
|
||||
/**
|
||||
* Standard debugging levels.
|
||||
|
|
Loading…
Reference in New Issue