[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-developers] [PATCH] zrtp: use session's seq_number for zrtp pa

From: Dmitry Monakhov
Subject: [Linphone-developers] [PATCH] zrtp: use session's seq_number for zrtp packets
Date: Tue, 06 Nov 2012 00:53:04 +0400
User-agent: Notmuch/0.6.1 ( Emacs/23.3.1 (x86_64-redhat-linux-gnu)

Currently seq_number for zrtp initiated to random value so
seq_numbers for rtp and zrtp packets will have different base
which is incorrect because other parts expect to receive packets
with monolithic seq_numbers.
Let's use common session.rtp.snd_seq counter. ASAIU it is safe to
modify counter w/o locking from zrtp callback because it is called
from sender context.

Signed-off-by: Dmitry Monakhov <address@hidden>
 src/zrtp.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/zrtp.c b/src/zrtp.c
index bb653cd..3a35876 100644
--- a/src/zrtp.c
+++ b/src/zrtp.c
@@ -50,7 +50,6 @@ struct _OrtpZrtpContext{
        RtpSession *session;
        uint32_t timerWillTriggerAt;
        uint16_t last_recv_zrtp_seq_number;
-       uint16_t last_sent_zrtp_seq_number;
        srtp_t srtpSend;
        srtp_t srtpRecv;
        zrtp_Callbacks zrtp_cb;
@@ -197,7 +196,7 @@ static int32_t ozrtp_sendDataZRTP (ZrtpContext* ctx, const 
uint8_t* data, const
        uint8_t *buffer8=(uint8_t*)buffer32;
        uint16_t *buffer16=(uint16_t*)buffer32;
-       uint16_t seqNumber=userData->last_sent_zrtp_seq_number++;
+       uint16_t seqNumber=session->rtp.snd_seq++;
        *buffer8 = 0x10;
@@ -769,7 +768,6 @@ static OrtpZrtpContext* createUserData(ZrtpContext 
*context) {
-       userData->last_sent_zrtp_seq_number=rand()+1; // INT_MAX+1 (signed)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]