-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathThreadMode.h
60 lines (51 loc) · 1.14 KB
/
ThreadMode.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
#pragma once
#include "UtilTypes.h"
#include "Main.h"
class VoiceBuf {
public:
void *m_pBuf;
uint8_t *m_pOutBuf;
size_t m_nSize;
size_t m_nOutBufSize;
size_t m_nPlayerIndex;
size_t m_nUserID;
bool m_fIsNewCodec;
VoiceBuf *m_pNext;
};
class VoiceBufQueue {
public:
VoiceBuf *m_pFirst;
VoiceBuf *m_pLast;
VoiceBufQueue() {
m_pFirst = nullptr;
m_pLast = nullptr;
}
bool IsEmpty(void) {
if (m_pFirst == nullptr) {
return true;
}
return false;
}
void Push(VoiceBuf *pVoiceBuf) {
if (IsEmpty()) {
m_pFirst = m_pLast = pVoiceBuf;
} else {
pVoiceBuf->m_pNext = nullptr;
m_pLast->m_pNext = pVoiceBuf;
}
}
VoiceBuf *Pop(void) {
if (m_pFirst == m_pLast) {
m_pFirst = nullptr;
return m_pLast;
}
VoiceBuf *pVoiceBuf = m_pFirst;
m_pFirst = m_pFirst->m_pNext;
return pVoiceBuf;
}
};
extern void VTC_ThreadInit();
extern void VTC_ThreadDeinit();
extern void VTC_ThreadAddVoicePacket(client_t *pClient, size_t nClientIndex, clientData_t *pClientData, void *pData, size_t nDataSize);
extern void VTC_ThreadHandler(void);
extern void VTC_ThreadVoiceFlusher();