#include <SoundSrv2.hh>
Collaboration diagram for clSoundSrv2:

Public Member Functions | |
| clSoundSrv2 () | |
| ~clSoundSrv2 () | |
| int | Main (int, char **) |
| void * | AudioInThread (void *) |
| void * | ServeClientThread (void *) |
| void | Stop () |
Public Attributes | |
| clLogFile | Log |
Private Member Functions | |
| bool | GetAudioCfg (char *, int *, int *, int *, int *) |
| bool | InitCompress (int, int, int, int, int) |
Private Attributes | |
| volatile bool | bRun |
| volatile int | iAudioBufSize |
| volatile int | iBlockCntr |
| stSoundStart | sHdr |
| clAlloc | AudioBuf |
| clAlloc | CompHead |
| clAlloc | FLACFrame |
| clMutex | MtxAudio |
| clCondition | CndAudio |
| clCfgFile | Cfg |
This uses freely spinning architecture based on condition variables. When thread gets buffer read from the soundcard it copies it's contents to shared buffer and broadcasts condition. Then all client servicing threads (which are waiting for condition) copy it's contents to private buffers and start sending out. Thus, if one of client servicing threads get stuck on blocking socket it doesn't take any CPU time and just misses n blocks of data.
Soundproxy and streamdist also use this architecture. This ensures, that one client can't affect others performance.
Definition at line 67 of file SoundSrv2.hh.
|
|
Definition at line 268 of file SoundSrv2.cc. References clLogFile::Add(), bRun, Cfg, iAudioBufSize, iBlockCntr, Log, clLogFile::Open(), clCfgFile::SetFileName(), SS2_CFGFILE, and SS2_LOGFILE. |
|
|
Definition at line 282 of file SoundSrv2.cc. References clLogFile::Add(), and Log. |
|
||||||||||||||||||||||||
|
Definition at line 112 of file SoundSrv2.cc. References clLogFile::Add(), Cfg, clCfgFile::GetInt(), clCfgFile::GetStr(), and Log. Referenced by AudioInThread(). |
|
||||||||||||||||||||||||
|
Definition at line 144 of file SoundSrv2.cc. References clLogFile::Add(), Cfg, FLACFrame, clCfgFile::GetInt(), Log, and MSG_SOUND_COMPRESS_FLAC. Referenced by AudioInThread(). |
|
||||||||||||
|
Definition at line 295 of file SoundSrv2.cc. References clLogFile::Add(), bDaemon, clSockServ::Bind(), bRun, Cfg, clCfgFile::GetInt(), GLOBAL_VERSMAJ, GLOBAL_VERSMIN, GLOBAL_VERSPL, Log, SigHandler(), SS2_CONNECT_TIMEOUT, SS2_SHUTDOWNFILE, Stop(), clSockServ::WaitForConnect(), WrapAudioInThread(), and WrapServeClientThread(). Referenced by main(). |
|
|
|
Definition at line 570 of file SoundSrv2.cc. References clLogFile::Add(), AudioBuf, bRun, Cfg, CndAudio, CompHead, clSockOp::DisableNagle(), clCfgFile::GetInt(), clSockOp::GetPeerName(), GLOBAL_HEADER_LEN, iAudioBufSize, iBlockCntr, _stSoundStart::iCompress, Log, MtxAudio, clSockOp::SetSendBufSize(), clSoundMsg::SetStart(), clSockOp::SetTypeOfService(), sHdr, SOp, SS2_LOGENTRY_SIZE, SS2_OUTTHREAD_PRIORITY, SS2_SOCKET_BUF_FRAGS, and clSockOp::WriteN(). Referenced by WrapServeClientThread(). |
|
|
Definition at line 97 of file SoundSrv2.hh. References bRun. Referenced by AudioInThread(), Main(), and SigHandler(). |
|
|
Definition at line 69 of file SoundSrv2.hh. Referenced by AudioInThread(), clSoundSrv2(), Main(), ServeClientThread(), and Stop(). |
|
|
Definition at line 70 of file SoundSrv2.hh. Referenced by AudioInThread(), clSoundSrv2(), and ServeClientThread(). |
|
|
Definition at line 71 of file SoundSrv2.hh. Referenced by AudioInThread(), clSoundSrv2(), and ServeClientThread(). |
|
|
Definition at line 72 of file SoundSrv2.hh. Referenced by AudioInThread(), and ServeClientThread(). |
|
|
Definition at line 76 of file SoundSrv2.hh. Referenced by AudioInThread(), and ServeClientThread(). |
|
|
Definition at line 77 of file SoundSrv2.hh. Referenced by ServeClientThread(). |
|
|
Definition at line 78 of file SoundSrv2.hh. Referenced by AudioInThread(), and InitCompress(). |
|
|
Definition at line 79 of file SoundSrv2.hh. Referenced by AudioInThread(), and ServeClientThread(). |
|
|
Definition at line 83 of file SoundSrv2.hh. Referenced by AudioInThread(), and ServeClientThread(). |
|
|
Definition at line 84 of file SoundSrv2.hh. Referenced by AudioInThread(), clSoundSrv2(), GetAudioCfg(), InitCompress(), Main(), and ServeClientThread(). |
|
|
Definition at line 91 of file SoundSrv2.hh. Referenced by AudioInThread(), clSoundSrv2(), GetAudioCfg(), InitCompress(), Main(), ServeClientThread(), SigHandler(), and ~clSoundSrv2(). |
1.3.3