Fix incorrect handling of rtpevent packet. In AmRtpStream, rtpevent

packets are treated the same as other RTP packets, they are all put into
a map with timestamp as key. However, some UA may use the same timestamp
for all rtpevent packets that represents a digit.

patch by Rui Jin Zheng rjzheng at boronetworks dot com



git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1090 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Stefan Sayer 18 years ago
parent e78c899208
commit 218642decf

@ -512,8 +512,12 @@ void AmRtpStream::bufferPacket(AmRtpPacket* p)
receive_mut.lock();
// free packet on double packet for TS received
if (receive_buf.find(p->timestamp) != receive_buf.end())
mem.freePacket(receive_buf[p->timestamp]);
if(!(telephone_event_pt.get() &&
(p->payload == telephone_event_pt->payload_type))) {
if (receive_buf.find(p->timestamp) != receive_buf.end()) {
mem.freePacket(receive_buf[p->timestamp]);
}
}
#ifdef WITH_ZRTP
if (session->zrtp_audio) {
@ -531,7 +535,12 @@ void AmRtpStream::bufferPacket(AmRtpPacket* p)
ERROR("parsing decoded packet!\n");
mem.freePacket(p);
} else {
receive_buf[p->timestamp] = p;
if(telephone_event_pt.get() &&
(p->payload == telephone_event_pt->payload_type)) {
rtp_ev_qu.push(p);
} else {
receive_buf[p->timestamp] = p;
}
}
} break;
@ -555,7 +564,14 @@ void AmRtpStream::bufferPacket(AmRtpPacket* p)
}
} else {
#endif // WITH_ZRTP
receive_buf[p->timestamp] = p;
if(telephone_event_pt.get() &&
(p->payload == telephone_event_pt->payload_type)) {
rtp_ev_qu.push(p);
} else {
receive_buf[p->timestamp] = p;
}
#ifdef WITH_ZRTP
}
#endif
@ -587,6 +603,14 @@ int AmRtpStream::nextPacket(AmRtpPacket*& p)
return RTP_TIMEOUT;
}
if(!rtp_ev_qu.empty()) {
// first return RTP telephone event payloads
p = rtp_ev_qu.front();
rtp_ev_qu.pop();
receive_mut.unlock();
return 1;
}
if(receive_buf.empty()){
receive_mut.unlock();
return RTP_EMPTY;

@ -39,6 +39,7 @@
#include <string>
#include <map>
#include <queue>
#include <memory>
using std::string;
using std::auto_ptr;
@ -58,7 +59,7 @@ class AmAudio;
class AmSession;
class SdpPayload;
typedef std::map<unsigned int, AmRtpPacket*, ts_less> ReceiveBuffer;
typedef std::queue<AmRtpPacket*> RtpEventQueue;
/**
* This provides the memory for the receive buffer.
@ -131,6 +132,7 @@ protected:
PacketMem mem;
ReceiveBuffer receive_buf;
RtpEventQueue rtp_ev_qu;
AmMutex receive_mut;

Loading…
Cancel
Save