Skip to content

Commit

Permalink
add dummy audio channel
Browse files Browse the repository at this point in the history
  • Loading branch information
willamowius committed Jan 13, 2017
1 parent c8df08e commit 2211816
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
28 changes: 28 additions & 0 deletions MakeCall.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,31 @@ PBoolean MakeCallConnection::OnSendSignalSetup(H323SignalPDU & setupPDU)
return H323Connection::OnSendSignalSetup(setupPDU);
}

PBoolean MakeCallConnection::OpenAudioChannel(PBoolean isEncoding, unsigned bufferSize, H323AudioCodec & codec)
{
PIndirectChannel * channel = new SilentChannel();
codec.AttachChannel(channel);
return true;
}


PBoolean SilentChannel::Read(void * buf, PINDEX len)
{
memset(buf, 0, len);
lastReadCount = len;
readDelay.Delay(len/2/8); // assuming G.711 !
return true;
}

PBoolean SilentChannel::Write(const void *buf, PINDEX len)
{
lastWriteCount = len;
writeDelay.Delay(len/2/8); // assuming G.711 !
return true;
}

PBoolean SilentChannel::Close()
{
return true;
}

15 changes: 15 additions & 0 deletions MakeCall.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,26 @@ class MakeCallConnection : public H323Connection
virtual ~MakeCallConnection() { }

PBoolean OnSendSignalSetup(H323SignalPDU & setupPDU);
PBoolean OpenAudioChannel(PBoolean isEncoding, unsigned bufferSize, H323AudioCodec & codec);

protected:
MakeCallEndPoint & m_ep;
};


class SilentChannel : public PIndirectChannel
{
PCLASSINFO(SilentChannel, PIndirectChannel);
public:
SilentChannel() { }
virtual ~SilentChannel() { }
virtual PBoolean Read(void * buf, PINDEX len);
virtual PBoolean Write(const void *, PINDEX);
virtual PBoolean Close();
protected:
PAdaptiveDelay readDelay;
PAdaptiveDelay writeDelay;
};

#endif // _MakeCall_H

0 comments on commit 2211816

Please sign in to comment.