as
Alejandro Acuña
2025-01-21 61cdfc6ee7f013c4533add51d797c1886b312883
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
47
// RTPAudioSource.h: interface for the RTPAudioSource class.
//
//////////////////////////////////////////////////////////////////////
 
#ifndef AFX_RTPAUDIOSOURCE_H__9A0DE2C0_90A9_4F86_B13C_58D1181EB505__INCLUDED_
#define AFX_RTPAUDIOSOURCE_H__9A0DE2C0_90A9_4F86_B13C_58D1181EB505__INCLUDED_
 
#include "AudioSource.h"
#include "Parameters.h"
 
enum Modes {ACTIVE_MODE=0, PASSIVE_MODE};
 
class RTPAudioSource : public AudioSource
{
public:
    RTPAudioSource();
    virtual ~RTPAudioSource();
    int SetReceivePort(unsigned short receivePort);
    int GetReceivePort(unsigned short *receivePort);    // returns the currently bound receive port
    int SourceStarted();
    int SourceStopped();
    int SourceThreadStarted(HANDLE sourceThreadHandle, DWORD sourceThreadID);
    int SourceThreadStopped(HANDLE sourceThreadHandle, DWORD sourceThreadID);
    int UnprepareSource();  // if the filter is in ACTIVE_MODE, then it waits on a socket
                            // so user needs to call UnprepareSource (which closes the socket)
                            // before the SourceThreadProc can end. Hence this method is public
protected:
    int GenerateData(AudioSample **ppAudioSample);
    int SetTraceLevel();
private:
    int CreateSockets();
    int CloseSockets();
    int PrepareSource();
    int ReceiveUDPPacket();
    int BindSocketToPort(SOCKET socket, unsigned short port);
private:
    SOCKET rtpSocket;
    SOCKET rtcpSocket;
    unsigned short receivePort;
    unsigned short boundReceivePort;
    char receiveBuffer[RTPAUDIOSOURCE_RECEIVEBUFFER_SIZE];
    int mode;
    bool bRunning;
    CRITICAL_SECTION filterMutex;
};
 
#endif // !defined(AFX_RTPAUDIOSOURCE_H__9A0DE2C0_90A9_4F86_B13C_58D1181EB505__INCLUDED_)