forked from ProgrammerAndHacker/media-server
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaudiostream.h
executable file
·65 lines (53 loc) · 1.67 KB
/
audiostream.h
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef _AUDIOSTREAM_H_
#define _AUDIOSTREAM_H_
#include <pthread.h>
#include "config.h"
#include "codecs.h"
#include "rtpsession.h"
#include "audio.h"
class AudioStream
{
public:
AudioStream(RTPSession::Listener* listener);
~AudioStream();
int Init(AudioInput *input,AudioOutput *output);
int SetAudioCodec(AudioCodec::Type codec,const Properties& properties);
int StartSending(char* sendAudioIp,int sendAudioPort,const RTPMap& rtpMap,const RTPMap& aptMap);
int StopSending();
int StartReceiving(const RTPMap& rtpMap,const RTPMap& aptMap);
int StopReceiving();
int SetMute(bool isMuted);
int SetLocalCryptoSDES(const char* suite, const char* key64);
int SetRemoteCryptoSDES(const char* suite, const char* key64);
int SetRemoteCryptoDTLS(const char *setup,const char *hash,const char *fingerprint);
int SetLocalSTUNCredentials(const char* username, const char* pwd);
int SetRemoteSTUNCredentials(const char* username, const char* pwd);
int SetRTPProperties(const Properties& properties);
int End();
int IsSending() { return sendingAudio; }
int IsReceiving() { return receivingAudio;}
MediaStatistics GetStatistics();
protected:
int SendAudio();
int RecAudio();
private:
//Funciones propias
static void *startSendingAudio(void *par);
static void *startReceivingAudio(void *par);
//Los objectos gordos
RTPSession rtp;
AudioInput *audioInput;
AudioOutput *audioOutput;
//Parametros del audio
AudioCodec::Type audioCodec;
Properties audioProperties;
//Las threads
pthread_t recAudioThread;
pthread_t sendAudioThread;
//Controlamos si estamos mandando o no
volatile int sendingAudio;
volatile int receivingAudio;
bool muted;
timeval ini;
};
#endif