Overflow in pj_math_stat_update

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

 



Hi Benny,
   I don't have floating points so compiled off PJ_HAS_FLOATING_POINT & val(
Jitter ) = 91 & mean = (95), so its simply taking integer values of delta.
Its comes to be -4.
Did i done something wrong please let me know ?

Regards,
Ravi Inder Singh

On Tue, Jul 22, 2008 at 5:35 PM, Benny Prijono <bennylp at pjsip.org> wrote:

>   On Tue, Jul 22, 2008 at 12:41 PM, Ravi Inder Singh <raviinder at gmail.com>
> wrote:
>
>> Hi all,
>>  Inside fuction pj_math_stat_update,calling from pjmedia_rtcp_xr_rx_rtp is
>> leading to overflow in mean calculation, as jitter value is less than mean
>> value & delta comes out to be in minus value.
>>
>>    delta = val - stat->mean; {leads to minus value, coz while setting we
>> make it divide by 16 in this code
>>
>> #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)
>>         pjmedia_rtcp_xr_rx_rtp(&sess->xr_session, seq,
>>                    0,                /* lost    */
>>                    0,                /* dup     */
>>                    discarded,            /* discard */
>>                    (sess->jitter >> 4),        /* jitter  */
>>                    -1, 0);            /* toh     */
>> #endif
>>
>> }
>> This all leads to some overflow value in int variable, leading wrong
>> results.
>>
>
> Minus value in delta variable is perfectly fine, and unless you give
> negative "val" value, the "fmean_" and "mean" variable will never have
> negative value.
>
> Do you have sample data to prove your observation?
>
> Cheers
>  Benny
>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>


-- 
Thanks & Regards,
Ravi Inder Singh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080722/8ebc8400/attachment.html 


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux