21 #include "sdp/SdpCodec.h" 46 static const UtlContainableType
TYPE;
66 static OsStatus
selectCodecs(
const UtlString& namedResource,
68 SdpCodec* pPrimaryCodec,
69 SdpCodec* pDtmfCodec);
82 static OsStatus
startTone(
const UtlString& namedResource,
88 static OsStatus
stopTone(
const UtlString& namedResource,
92 static OsStatus
enableDtx(
const UtlString& namedResource,
102 unsigned int maxPacketTime);
220 unsigned char*& rpPacketPayload,
221 int& rPacketPayloadBytes);
264 #endif // _MprEncode_h_ static OsStatus stopTone(const UtlString &namedResource, OsMsgQ &fgQ)
Send "stop tone" DTMF RTP packet.
Definition: MprEncode.cpp:152
MpEncoderBase * mpPrimaryCodec
Definition: MprEncode.h:155
Message object used to communicate with the media processing task.
Definition: MpResourceMsg.h:30
unsigned int mLastDtmfSendTimestamp
Definition: MprEncode.h:197
MprToNet * mpToNet
Definition: MprEncode.h:211
unsigned char * mpPacket1Payload
Packet buffer for primary RTP stream.
Definition: MprEncode.h:156
MpResamplerBase * mpResampler
Definition: MprEncode.h:184
int mConsecutiveUnsentFrames1
Definition: MprEncode.h:168
void notifyStartTx()
Send notification about TX start.
Definition: MprEncode.cpp:814
UtlBoolean mNewTone
set when tone starts
Definition: MprEncode.h:202
MpAudioSample * mpResampleBuf
Definition: MprEncode.h:187
Generic audio resampler.
Definition: MpResampler.h:34
int mConsecutiveInactive1
Number of RTP packets with active voice data.
Definition: MprEncode.h:166
Definition: MpResourceMsg.h:56
MUST BE > 0.
Definition: MprEncode.h:147
unsigned int mCurrentTimestamp
Definition: MprEncode.h:208
void handleDeselectCodecs(void)
Definition: MprEncode.cpp:219
Definition: MprEncode.h:142
void handleStartTone(int toneId)
Handle message to send "begin tone" DTMF RTP packet.
Definition: MprEncode.cpp:364
int lookupTone(int toneId)
Translate our tone ID into RFC2833 values.
Definition: MprEncode.cpp:451
Base class for all media processing encoders.
Definition: MpEncoderBase.h:35
void handleStopTone(void)
Handle message to send "stop tone" DTMF RTP packet.
Definition: MprEncode.cpp:375
int mPayloadBytesUsed
Definition: MprEncode.h:159
static OsStatus deselectCodecs(const UtlString &namedResource, OsMsgQ &fgQ)
Free selected codecs.
Definition: MprEncode.cpp:133
static OsStatus enableDtx(const UtlString &namedResource, OsMsgQ &fgQ, UtlBoolean dtx)
Enable or disable internal DTX.
Definition: MprEncode.cpp:158
void notifyStopTx()
Send notification about TX stop.
Definition: MprEncode.cpp:829
void doDtmfCodec(int samplesPerFrame, int samplesPerSecond)
Encode and send DTMF tone.
Definition: MprEncode.cpp:692
unsigned int mResampleBufLen
Length of mpResampleBuf.
Definition: MprEncode.h:186
static const UtlContainableType TYPE
Class name, used for run-time checks.
Definition: MprEncode.h:46
MprEncode & operator=(const MprEncode &rhs)
Assignment operator (not implemented for this class)
UtlBoolean mNeedResample
Is resampling needed?
Definition: MprEncode.h:183
int16_t MpAudioSample
Definition: MpTypes.h:44
MprEncode(const UtlString &rName)
Definition: MprEncode.cpp:72
virtual UtlBoolean handleMessage(MpResourceMsg &rMsg)
Handle resource messages for this resource.
Definition: MprEncode.cpp:392
UtlContainableType getContainableType() const
Definition: MprEncode.cpp:178
AddlResMsgTypes
Definition: MprEncode.h:135
int mConsecutiveActive1
Definition: MprEncode.h:167
int mTotalTime
samples tone was active, set when tone stops
Definition: MprEncode.h:201
UtlBoolean mMarkNext1
Set Mark bit on next RTP packet.
Definition: MprEncode.h:165
int mNumToneStops
set to # of end packets to send when tone stops
Definition: MprEncode.h:200
Definition: MprEncode.h:137
int mDtmfSampleInterval
samples between AVT packets
Definition: MprEncode.h:198
UtlBoolean mEnableG722Hack
Definition: MprEncode.h:171
virtual UtlBoolean doProcessFrame(MpBufPtr inBufs[], MpBufPtr outBufs[], int inBufsSize, int outBufsSize, UtlBoolean isEnabled, int samplesPerFrame, int samplesPerSecond)
This method does the real work for the media processing resource and must be defined in each class de...
Definition: MprEncode.cpp:777
Smart pointer to MpAudioBuf.
Definition: MpAudioBuf.h:168
Abstract base class for all audio processing objects.
Definition: MpAudioResource.h:38
void doPrimaryCodec(MpAudioBufPtr in)
Encode audio buffer and send it.
Definition: MprEncode.cpp:496
virtual ~MprEncode()
Definition: MprEncode.cpp:111
static OsStatus setMaxPacketTime(const UtlString &namedResource, OsMsgQ &fgQ, unsigned int maxPacketTime)
Set maximum duration of one packet in milliseconds.
Definition: MprEncode.cpp:168
int mMaxPacketSamples
Maximum number of samples in RTP packet.
Definition: MprEncode.h:157
Definition: MprEncode.h:141
Definition: MprEncode.h:140
unsigned int mSamplesPacked
Definition: MprEncode.h:161
UtlBoolean mActiveAudio1
Does current RTP packet contain active voice?
Definition: MprEncode.h:164
int mPacket2PayloadBytes
4
Definition: MprEncode.h:195
At 20 ms each, 500 ms.
Definition: MprEncode.h:148
int mPacket1PayloadBytes
Size of mpPacket1Payload buffer.
Definition: MprEncode.h:158
MpEncoderBase * mpDtmfCodec
Definition: MprEncode.h:193
Definition: MprEncode.h:138
The "Encode" media processing resource.
Definition: MprEncode.h:41
void handleEnableDTX(UtlBoolean dtx)
Handle message to enable or disable internal DTX.
Definition: MprEncode.cpp:382
UtlBoolean mDoesVad1
Does codec its own VAD?
Definition: MprEncode.h:169
Smart pointer to MpBuf.
Definition: MpBuf.h:160
The RTP writer.
Definition: MprToNet.h:48
void setMyToNet(MprToNet *myToNet)
Set ToNet resource which will send generated RTP packets.
Definition: MprEncode.cpp:139
int mCurrentTone
AVT event code for current tone.
Definition: MprEncode.h:199
unsigned int mMaxPacketTime
Maximum duration of one packet in milliseconds.
Definition: MprEncode.h:209
static OsStatus startTone(const UtlString &namedResource, OsMsgQ &fgQ, int toneId)
Send "begin tone" DTMF RTP packet.
Definition: MprEncode.cpp:144
static OsStatus selectCodecs(const UtlString &namedResource, OsMsgQ &fgQ, SdpCodec *pPrimaryCodec, SdpCodec *pDtmfCodec)
Tell encoder which codecs to use.
Definition: MprEncode.cpp:123
UtlBoolean mDisableDTX
Disable internal DTX.
Definition: MprEncode.h:170
void handleSelectCodecs(int newCodecsCount, SdpCodec **newCodecs)
Definition: MprEncode.cpp:256
unsigned char * mpPacket2Payload
packet buffer for DTMF event RTP stream
Definition: MprEncode.h:194
OsStatus allocPacketBuffer(const MpEncoderBase &rEncoder, unsigned char *&rpPacketPayload, int &rPacketPayloadBytes)
Allocate memory for RTP packet.
Definition: MprEncode.cpp:191
void handleSetMaxPacketTime(unsigned maxPacketTime)
Handle message to set maximum duration of one packet.
Definition: MprEncode.cpp:387
Definition: MprEncode.h:139
UtlBoolean mDoG722Hack
Definition: MprEncode.h:176
unsigned int mStartTimestamp1
Timestamp of packets being encoded.
Definition: MprEncode.h:163
static const int RTP_KEEP_ALIVE_FRAME_INTERVAL
Definition: MprEncode.h:151
UtlBoolean isEnabled() const
Returns TRUE is this resource is currently enabled, FALSE otherwise.
Definition: MpResource.cpp:440
unsigned int mStartTimestamp2
sample time when tone starts
Definition: MprEncode.h:196