linphone-developers
[Top][All Lists]
Advanced

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

[Linphone-developers] RTCP packet loss percentage error in calculation


From: Julien Chavanton
Subject: [Linphone-developers] RTCP packet loss percentage error in calculation
Date: Tue, 28 Jan 2014 10:49:33 +0100

We have found an error in packet loss percentage calculation in oRTP


this line :

loss_fraction=(int)( 256 * packet_loss) / stream->hwrcv_since_last_SR ;

should be :

int expected_packets_count = tream->hwrcv_extseq - stream->hwrcv_seq_at_last_SR;
loss_fraction=(int)( 256 * packet_loss) / expected_packets_count;


---------------------------------------------------------
code context : report_block_init
---------------------------------------------------------

        /* compute the statistics */
        if (stream->hwrcv_since_last_SR!=0){
                if ( session->flags & RTCP_OVERRIDE_LOST_PACKETS ) {
                        /* If the test mode is enabled, replace the
lost packet field with the test vector value set by
rtp_session_rtcp_set_lost_packet_value() */
                        packet_loss = session->lost_packets_test_vector;
                        if ( packet_loss < 0 )
                                packet_loss = 0;
                        /* The test value is the definite cumulative
one, no need to increment it each time a packet is sent */
                        stream->stats.cum_packet_loss = packet_loss;
                }else {
                        /* Normal mode */
                        packet_loss = ( stream->hwrcv_extseq -
stream->hwrcv_seq_at_last_SR ) - stream->hwrcv_since_last_SR;
                        if ( packet_loss < 0 )
                                packet_loss = 0;
                        stream->stats.cum_packet_loss += packet_loss;
                }
                loss_fraction=(int)( 256 * packet_loss) /
stream->hwrcv_since_last_SR ;
        }
        ortp_message("compute RTCP statistics: loss_fraction=%i/256
cum_packet_loss %" PRIu64 "/%" PRIu64 ", duplicate= %" PRIu64 ",
unique duplicate=%" PRIu64 ", fec=%" PRIu64
"\n",loss_fraction,stream->stats.cum_packet_loss,stream->stats.packet_recv,stream->stats.on_cum_packet_dup,
stream->stats.on_cum_unique_packet_dup,
stream->stats.on_cum_packet_fec);
-----------------------------------------------------------------------------------------------------



reply via email to

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