diff --git a/libs/jrtplib/src/rtppacketbuilder.cpp b/libs/jrtplib/src/rtppacketbuilder.cpp index 5d2a259401..b1f787a95b 100644 --- a/libs/jrtplib/src/rtppacketbuilder.cpp +++ b/libs/jrtplib/src/rtppacketbuilder.cpp @@ -208,6 +208,14 @@ int RTPPacketBuilder::BuildPacket(const void *data,size_t len, return PrivateBuildPacket(data,len,pt,mark,timestampinc,false); } +int RTPPacketBuilder::BuildPacket(const void *data,size_t len, + u_int8_t pt,bool mark,u_int32_t timestampinc, u_int32_t mseq) +{ + if (!init) + return ERR_RTP_PACKBUILD_NOTINIT; + return PrivateBuildPacket(data,len,pt,mark,timestampinc,false,0,0,0,mseq); +} + int RTPPacketBuilder::BuildPacketEx(const void *data,size_t len, u_int16_t hdrextID,const void *hdrextdata,size_t numhdrextwords) { @@ -234,9 +242,9 @@ int RTPPacketBuilder::BuildPacketEx(const void *data,size_t len, int RTPPacketBuilder::PrivateBuildPacket(const void *data,size_t len, u_int8_t pt,bool mark,u_int32_t timestampinc,bool gotextension, - u_int16_t hdrextID,const void *hdrextdata,size_t numhdrextwords) + u_int16_t hdrextID,const void *hdrextdata,size_t numhdrextwords, u_int32_t mseq) { - RTPPacket p(pt,data,len,seqnr,timestamp,ssrc,mark,numcsrcs,csrcs,gotextension,hdrextID, + RTPPacket p(pt,data,len, mseq ? mseq : seqnr,timestamp,ssrc,mark,numcsrcs,csrcs,gotextension,hdrextID, (u_int16_t)numhdrextwords,hdrextdata,buffer,maxpacksize); int status = p.GetCreationError(); @@ -260,7 +268,9 @@ int RTPPacketBuilder::PrivateBuildPacket(const void *data,size_t len, numpayloadbytes += (u_int32_t)p.GetPayloadLength(); numpackets++; timestamp += timestampinc; - seqnr++; + if (mseq) { + seqnr++; + } return 0; diff --git a/libs/jrtplib/src/rtppacketbuilder.h b/libs/jrtplib/src/rtppacketbuilder.h index 5f60d3c163..1129d8095b 100644 --- a/libs/jrtplib/src/rtppacketbuilder.h +++ b/libs/jrtplib/src/rtppacketbuilder.h @@ -61,6 +61,8 @@ public: int BuildPacket(const void *data,size_t len); int BuildPacket(const void *data,size_t len, u_int8_t pt,bool mark,u_int32_t timestampinc); + int BuildPacket(const void *data,size_t len, + u_int8_t pt,bool mark,u_int32_t timestampinc, u_int32_t mseq); int BuildPacketEx(const void *data,size_t len, u_int16_t hdrextID,const void *hdrextdata,size_t numhdrextwords); int BuildPacketEx(const void *data,size_t len, @@ -87,7 +89,7 @@ public: private: int PrivateBuildPacket(const void *data,size_t len, u_int8_t pt,bool mark,u_int32_t timestampinc,bool gotextension, - u_int16_t hdrextID = 0,const void *hdrextdata = 0,size_t numhdrextwords = 0); + u_int16_t hdrextID = 0,const void *hdrextdata = 0,size_t numhdrextwords = 0, u_int32_t mseq = 0); RTPRandom rtprnd; size_t maxpacksize; diff --git a/libs/jrtplib/src/rtpsession.cpp b/libs/jrtplib/src/rtpsession.cpp index 6cdd63ae1e..ec9645317a 100644 --- a/libs/jrtplib/src/rtpsession.cpp +++ b/libs/jrtplib/src/rtpsession.cpp @@ -508,7 +508,7 @@ int RTPSession::SendPacket(const void *data,size_t len) } int RTPSession::SendPacket(const void *data,size_t len, - u_int8_t pt,bool mark,u_int32_t timestampinc) + u_int8_t pt,bool mark,u_int32_t timestampinc, u_int32_t mseq) { int status; @@ -516,7 +516,7 @@ int RTPSession::SendPacket(const void *data,size_t len, return ERR_RTP_SESSION_NOTCREATED; BUILDER_LOCK - if ((status = packetbuilder.BuildPacket(data,len,pt,mark,timestampinc)) < 0) + if ((status = packetbuilder.BuildPacket(data,len,pt,mark,timestampinc, mseq)) < 0) { BUILDER_UNLOCK return status; diff --git a/libs/jrtplib/src/rtpsession.h b/libs/jrtplib/src/rtpsession.h index 07e1f6197e..274bb73c3e 100644 --- a/libs/jrtplib/src/rtpsession.h +++ b/libs/jrtplib/src/rtpsession.h @@ -85,7 +85,7 @@ public: int SendPacket(const void *data,size_t len); int SendPacket(const void *data,size_t len, - u_int8_t pt,bool mark,u_int32_t timestampinc); + u_int8_t pt,bool mark,u_int32_t timestampinc, u_int32_t mseq = 0); int SendPacketEx(const void *data,size_t len, u_int16_t hdrextID,const void *hdrextdata,size_t numhdrextwords); int SendPacketEx(const void *data,size_t len,