📄 rtpaudiostream.h
字号:
// RTPAudioStream.h: interface for the RTPAudioStream class.
//
//////////////////////////////////////////////////////////////////////
#ifndef AFX_RTPAUDIOSTREAM_H__1CB0DE48_EADE_4C23_9C56_C8ECDE1A90AD__INCLUDED_
#define AFX_RTPAUDIOSTREAM_H__1CB0DE48_EADE_4C23_9C56_C8ECDE1A90AD__INCLUDED_
#include <queue>
#include <functional>
#include "AudioSample.h"
#ifndef WIN32
#include "linTypes.h"
#else
#include "../../Tracer/Tracer.h"
#endif
class RTPCompareLess
{
public:
bool operator() (AudioSample *sample1, AudioSample *sample2)
{
return *sample1 < *sample2;
}
};
class RTPCompareGreater
{
public:
bool operator() (AudioSample *sample1, AudioSample *sample2)
{
return *sample1 >= *sample2;
}
};
class RTPAudioStream
{
public:
RTPAudioStream(unsigned long ssrc);
virtual ~RTPAudioStream();
int SetRestartThreshold(int depthInMillisec);
int InsertRTPPacket(AudioSample *audioSample);
int GiveNextRTPPacket(AudioSample **pOutSample);
int NumQueuedPackets();
int JitterBufferDepth(); // Current depth of the jitter buffer in milliseconds
unsigned long SSRC();
int SetTracer(Tracer *tracer);
private:
int SetLastTransmittedPacket(AudioSample *);
int TimeDifference(unsigned long timestamp1, unsigned long timestamp2);
int TimeDifference(AudioSample *, AudioSample *);
int TimeDifferenceMillisec(AudioSample *, AudioSample *);
int Clear();
int AddPacket(AudioSample *);
int PopNextPacket(AudioSample **pAudioSample);
int PopNextPacketForTransmit(AudioSample **pOutSample);
private:
// typedef std::priority_queue<AudioSample *, std::vector<AudioSample * >, std::greater_equal<AudioSample *> > PACKET_QUEUE;
typedef std::priority_queue<AudioSample *, std::vector<AudioSample * >, RTPCompareGreater > PACKET_QUEUE;
PACKET_QUEUE packetQueue;
unsigned long ssrc;
int jitterBufferDepth;
int restartThreshold;
unsigned long lastOutputTimestamp;
unsigned long lastOutputDuration;
AudioSample *lastPacketTransmitted;
int lastPacketRepeatCount;
int numSIDPackets;
bool silenceIntervalInProgress;
bool dynamicJitterBuffer;
Tracer *tracer;
CRITICAL_SECTION packetQueueMutex;
CRITICAL_SECTION audioStreamMutex;
};
#endif // !defined(AFX_RTPAUDIOSTREAM_H__1CB0DE48_EADE_4C23_9C56_C8ECDE1A90AD__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -