ghy
Alejandro Acuña
2025-03-12 26319e4c5bfbee722c15b8e7ccca9b6127bb1cb8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// RTPJitterBuffer.h: interface for the RTPJitterBuffer class.
//
//////////////////////////////////////////////////////////////////////
 
#ifndef AFX_RTPJITTERBUFFER_H__6EA27482_0A63_473E_9EBD_03F510481719__INCLUDED_
#define AFX_RTPJITTERBUFFER_H__6EA27482_0A63_473E_9EBD_03F510481719__INCLUDED_
 
#pragma warning(disable:4786)
 
#include <map>
#include "AudioTransformer.h"
 
#define DEFAULT_SILENCE_THRESHOLD 15
 
class RTPAudioStream;
 
class RTPJitterBuffer : public AudioTransformer
{
public:
    RTPJitterBuffer();
    ~RTPJitterBuffer();
    int SetTraceLevel();
    int SetJitterBufferDepth(int depth);
    int SetOutputDuration(int outputDuration);
    virtual int TransformStarted();
    virtual int TransformStopped();
protected:
    virtual int RenderAudioSamples(std::vector<std::pair<AudioSample *, AudioSource *> > &data);
    virtual int GenerateData(AudioSample **ppAudioSample);
    virtual int TransformAudioSamples(std::vector<std::pair<AudioSample *, AudioSource *> > &data, AudioSample **ppAudioSample);
private:
    int ChooseNewActiveAudioStream();
    int Clear();
private:
    typedef std::map<unsigned long, RTPAudioStream *> AUDIO_STREAM_MAP;
    RTPAudioStream *activeAudioStream;
    int jitterBufferDepth;
    int outputDuration;
    bool bRunning;
    CRITICAL_SECTION rtpAudioStreamsMutex;
    CRITICAL_SECTION stateMutex;
    AUDIO_STREAM_MAP rtpAudioStreams;
    int numActiveStreamNULLs;
};
 
#endif // !defined(AFX_RTPJITTERBUFFER_H__6EA27482_0A63_473E_9EBD_03F510481719__INCLUDED_)