mirror of
https://github.com/ShaYmez/NXDNClients.git
synced 2024-11-22 15:28:36 -05:00
Change the way the timestamp is calculated.
This commit is contained in:
parent
0a7d9ef22b
commit
df6db324fa
@ -36,7 +36,6 @@ const unsigned int BUFFER_LENGTH = 200U;
|
||||
CKenwoodNetwork::CKenwoodNetwork(unsigned int localPort, const std::string& rptAddress, unsigned int rptPort, bool debug) :
|
||||
m_rtcpSocket(localPort + 1U),
|
||||
m_rtpSocket(localPort + 0U),
|
||||
m_stopWatch(),
|
||||
m_address(),
|
||||
m_rtcpPort(rptPort + 1U),
|
||||
m_rtpPort(rptPort + 0U),
|
||||
@ -240,6 +239,30 @@ bool CKenwoodNetwork::writeRTPVoiceHeader(const unsigned char* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
SYSTEMTIME st;
|
||||
::GetSystemTime(&st);
|
||||
|
||||
unsigned int hh = st.wHour;
|
||||
unsigned int mm = st.wMinute;
|
||||
unsigned int ss = st.wSecond;
|
||||
unsigned int ms = st.wMilliseconds;
|
||||
|
||||
m_timeStamp = hh * 3600U * 1000U * 80U;
|
||||
m_timeStamp += mm * 60U * 1000U * 80U;
|
||||
m_timeStamp += ss * 1000U * 80U;
|
||||
m_timeStamp += ms * 80U;
|
||||
#else
|
||||
struct timeval tod;
|
||||
::gettimeofday(&tod, NULL);
|
||||
|
||||
unsigned int ss = tod.tv_sec;
|
||||
unsigned int ms = tod.tv_usec / 1000U;
|
||||
|
||||
m_timeStamp = ss * 1000U * 80U;
|
||||
m_timeStamp += ms * 80U;
|
||||
#endif
|
||||
|
||||
unsigned char buffer[50U];
|
||||
::memset(buffer, 0x00U, 50U);
|
||||
|
||||
@ -250,8 +273,6 @@ bool CKenwoodNetwork::writeRTPVoiceHeader(const unsigned char* data)
|
||||
buffer[2U] = (m_seqNo >> 8) & 0xFFU;
|
||||
buffer[3U] = (m_seqNo >> 0) & 0xFFU;
|
||||
|
||||
m_timeStamp = (unsigned long)m_stopWatch.time();
|
||||
|
||||
buffer[4U] = (m_timeStamp >> 24) & 0xFFU;
|
||||
buffer[5U] = (m_timeStamp >> 16) & 0xFFU;
|
||||
buffer[6U] = (m_timeStamp >> 8) & 0xFFU;
|
||||
|
@ -20,7 +20,6 @@
|
||||
#define KenwoodNetwork_H
|
||||
|
||||
#include "RptNetwork.h"
|
||||
#include "StopWatch.h"
|
||||
#include "UDPSocket.h"
|
||||
#include "Timer.h"
|
||||
|
||||
@ -45,7 +44,6 @@ public:
|
||||
private:
|
||||
CUDPSocket m_rtpSocket;
|
||||
CUDPSocket m_rtcpSocket;
|
||||
CStopWatch m_stopWatch;
|
||||
in_addr m_address;
|
||||
unsigned int m_rtcpPort;
|
||||
unsigned int m_rtpPort;
|
||||
|
Loading…
Reference in New Issue
Block a user