MCPcopy Create free account
hub / github.com/RangeNetworks/openbts / txFrame

Method txFrame

SIP/SIPBase.cpp:1119–1156  ·  view source on GitHub ↗

send frame in the uplink direction. The gsm bit rate is 13500 and clock rate is 8000. Time is 20ms or 50 packets/sec. The 160 that we send is divided by payload->clock_rate in rtp_session_ts_to_time to yield 20ms.

Source from the content-addressed store, hash-verified

1117// The gsm bit rate is 13500 and clock rate is 8000. Time is 20ms or 50 packets/sec.
1118// The 160 that we send is divided by payload->clock_rate in rtp_session_ts_to_time to yield 20ms.
1119void SipRtp::txFrame(GSM::AudioFrame* frame, unsigned numFlushed)
1120{
1121 if(getSipState()!=Active) return;
1122 ScopedLock lock(mRtpLock);
1123
1124 // HACK -- Hardcoded for GSM/8000.
1125 // FIXME: Make this work for multiple vocoder types. (pat) fixed, but codec is still hard-coded in initRTP1.
1126 int nbytes = frame->sizeBytes();
1127 // (pat 8-2013) Our send stream is discontinous. After a discontinuity, the sound degrades.
1128 // I think this is caused by bugs in the RTP library.
1129
1130 mTxTime += (numFlushed+1)*160;
1131 int result = rtp_session_send_with_ts(mSession, frame->begin(), nbytes, mTxTime);
1132 LOG(DEBUG) << LOGVAR(mTxTime) <<LOGVAR(result);
1133
1134 // (pat) The result is the number of bytes sent over the network, which includes nbytes data + 12 bytes of RTP header.
1135 if (result < nbytes || result != 33+12) {
1136 LOG(DEBUG) << "rtp_session_send_with_ts("<<nbytes<<") returned "<<result <<sbText();
1137 }
1138
1139 if (mDTMF) {
1140 //false means not start
1141 /*****
1142 mblk_t *m = rtp_session_create_telephone_event_packet(mSession,false);
1143 //volume 10 for some magic reason, false means not end
1144 int code = rtp_session_add_telephone_event(mSession,m,get_rtp_tev_type(mDTMF),false,10,mDTMFDuration);
1145 int bytes = rtp_session_sendm_with_ts(mSession,m,mDTMFStartTime);
1146 mDTMFDuration += 160;
1147 //LOG (DEBUG) << "DTMF RFC-2833 sending " << mDTMF << " " << mDTMFDuration <<sbText();
1148 if (code || bytes <=0)
1149 ***/
1150 if (! txDtmf())
1151 {
1152 LOG(ERR) << "DTMF RFC-2833 failed after start." <<sbText();
1153 mDTMF=0; // Turn it off if there's an error.
1154 }
1155 }
1156}
1157
1158
1159GSM::AudioFrame *SipRtp::rxFrame()

Callers

nothing calls this directly

Calls 2

sizeBytesMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected