Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

clSoundSrv2 Class Reference

SoundServer2. More...

#include <SoundSrv2.hh>

Collaboration diagram for clSoundSrv2:

Collaboration graph
[legend]
List of all members.

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

Detailed Description

SoundServer2.

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.


Constructor & Destructor Documentation

clSoundSrv2::clSoundSrv2  ) 
 

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.

clSoundSrv2::~clSoundSrv2  ) 
 

Definition at line 282 of file SoundSrv2.cc.

References clLogFile::Add(), and Log.


Member Function Documentation

bool clSoundSrv2::GetAudioCfg char *  ,
int *  ,
int *  ,
int *  ,
int * 
[private]
 

Definition at line 112 of file SoundSrv2.cc.

References clLogFile::Add(), Cfg, clCfgFile::GetInt(), clCfgFile::GetStr(), and Log.

Referenced by AudioInThread().

bool clSoundSrv2::InitCompress int  ,
int  ,
int  ,
int  ,
int 
[private]
 

Definition at line 144 of file SoundSrv2.cc.

References clLogFile::Add(), Cfg, FLACFrame, clCfgFile::GetInt(), Log, and MSG_SOUND_COMPRESS_FLAC.

Referenced by AudioInThread().

int clSoundSrv2::Main int  ,
char ** 
 

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().

void * clSoundSrv2::AudioInThread void *   ) 
 

Definition at line 371 of file SoundSrv2.cc.

References clLogFile::Add(), AUDIO_READ, AudioBuf, bRun, Cfg, CndAudio, _stSoundStart::dSampleRate, FLACFrame, GDT, GetAudioCfg(), clAudio::GetFragmentSize(), clCfgFile::GetInt(), clAudio::GetVersion(), iAudioBufSize, iBlockCntr, _stSoundStart::iChannels, _stSoundStart::iCompress, _stSoundStart::iFragmentSize, InitCompress(), Log, MSG_SOUND_COMPRESS_FLAC, MSG_SOUND_COMPRESS_NONE, MtxAudio, clAudio::Open(), clAudio::Read(), clSoundMsg::SetData(), clAudio::SetFragment(), sHdr, SS2_FRAG_SIZE_DEFAULT, SS2_INTHREAD_PRIORITY, SS2_LOGENTRY_SIZE, SS2_OSS_MAJOR, SS2_OSS_MINOR, SS2_OSS_PL, and Stop().

Referenced by WrapAudioInThread().

void * clSoundSrv2::ServeClientThread void *   ) 
 

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().

void clSoundSrv2::Stop  )  [inline]
 

Definition at line 97 of file SoundSrv2.hh.

References bRun.

Referenced by AudioInThread(), Main(), and SigHandler().


Member Data Documentation

volatile bool clSoundSrv2::bRun [private]
 

Definition at line 69 of file SoundSrv2.hh.

Referenced by AudioInThread(), clSoundSrv2(), Main(), ServeClientThread(), and Stop().

volatile int clSoundSrv2::iAudioBufSize [private]
 

Definition at line 70 of file SoundSrv2.hh.

Referenced by AudioInThread(), clSoundSrv2(), and ServeClientThread().

volatile int clSoundSrv2::iBlockCntr [private]
 

Definition at line 71 of file SoundSrv2.hh.

Referenced by AudioInThread(), clSoundSrv2(), and ServeClientThread().

stSoundStart clSoundSrv2::sHdr [private]
 

Definition at line 72 of file SoundSrv2.hh.

Referenced by AudioInThread(), and ServeClientThread().

clAlloc clSoundSrv2::AudioBuf [private]
 

Definition at line 76 of file SoundSrv2.hh.

Referenced by AudioInThread(), and ServeClientThread().

clAlloc clSoundSrv2::CompHead [private]
 

Definition at line 77 of file SoundSrv2.hh.

Referenced by ServeClientThread().

clAlloc clSoundSrv2::FLACFrame [private]
 

Definition at line 78 of file SoundSrv2.hh.

Referenced by AudioInThread(), and InitCompress().

clMutex clSoundSrv2::MtxAudio [private]
 

Definition at line 79 of file SoundSrv2.hh.

Referenced by AudioInThread(), and ServeClientThread().

clCondition clSoundSrv2::CndAudio [private]
 

Definition at line 83 of file SoundSrv2.hh.

Referenced by AudioInThread(), and ServeClientThread().

clCfgFile clSoundSrv2::Cfg [private]
 

Definition at line 84 of file SoundSrv2.hh.

Referenced by AudioInThread(), clSoundSrv2(), GetAudioCfg(), InitCompress(), Main(), and ServeClientThread().

clLogFile clSoundSrv2::Log
 

Definition at line 91 of file SoundSrv2.hh.

Referenced by AudioInThread(), clSoundSrv2(), GetAudioCfg(), InitCompress(), Main(), ServeClientThread(), SigHandler(), and ~clSoundSrv2().


The documentation for this class was generated from the following files:
Generated on Sun Oct 26 19:12:24 2003 for HASAS by doxygen 1.3.3