forked from ProgrammerAndHacker/media-server
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaudiodecoder.h
50 lines (41 loc) · 1.04 KB
/
audiodecoder.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
/*
* File: audiodecoder.h
* Author: Sergio
*
* Created on 1 de agosto de 2012, 13:34
*/
#ifndef AUDIODECODER_H
#define AUDIODECODER_H
#include "codecs.h"
#include "audio.h"
#include "waitqueue.h"
#include "rtp.h"
class AudioDecoderWorker
: public RTPIncomingMediaStream::Listener
{
public:
AudioDecoderWorker() = default;
virtual ~AudioDecoderWorker();
int Start();
virtual void onRTP(RTPIncomingMediaStream* stream,const RTPPacket::shared& packet);
virtual void onEnded(RTPIncomingMediaStream* stream);
virtual void onBye(RTPIncomingMediaStream* stream);
int Stop();
void SetAACConfig(const uint8_t* data,const size_t size);
void AddAudioOuput(AudioOutput* ouput);
void RemoveAudioOutput(AudioOutput* ouput);
protected:
int Decode();
private:
static void *startDecoding(void *par);
private:
std::set<AudioOutput*> outputs;
WaitQueue<RTPPacket::shared> packets;
pthread_t thread;
Mutex mutex;
bool decoding = false;
DWORD rate = 0;
DWORD numChannels = 0;
std::unique_ptr<AudioDecoder> codec;
};
#endif /* AUDIODECODER_H */