Author: sayer
Date: 2008-09-24 00:25:38 +0200 (Wed, 24 Sep 2008)
New Revision: 1090
Modified:
trunk/core/AmRtpStream.cpp
trunk/core/AmRtpStream.h
Log:
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
Modified: trunk/core/AmRtpStream.cpp
===================================================================
--- trunk/core/AmRtpStream.cpp 2008-09-23 19:07:31 UTC (rev 1089)
+++ trunk/core/AmRtpStream.cpp 2008-09-23 22:25:38 UTC (rev 1090)
@@ -512,8 +512,12 @@
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 @@
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 @@
}
} 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 @@
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;
Modified: trunk/core/AmRtpStream.h
===================================================================
--- trunk/core/AmRtpStream.h 2008-09-23 19:07:31 UTC (rev 1089)
+++ trunk/core/AmRtpStream.h 2008-09-23 22:25:38 UTC (rev 1090)
@@ -39,6 +39,7 @@
#include <string>
#include <map>
+#include <queue>
#include <memory>
using std::string;
using std::auto_ptr;
@@ -58,8 +59,8 @@
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 @@
PacketMem mem;
ReceiveBuffer receive_buf;
+ RtpEventQueue rtp_ev_qu;
AmMutex receive_mut;
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev