Re #1208 (misc): bug in frame_size calculation in PJMEDIA_FSZ() causing results to be truncated
git-svn-id: https://svn.pjsip.org/repos/pjproject/branches/projects/2.0-dev@3449 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjmedia/include/pjmedia/format.h b/pjmedia/include/pjmedia/format.h
index fee2e6b..5b4aed2 100644
--- a/pjmedia/include/pjmedia/format.h
+++ b/pjmedia/include/pjmedia/format.h
@@ -462,9 +462,9 @@
PJ_INLINE(unsigned) PJMEDIA_FSZ(unsigned bps, unsigned usec_ptime)
{
#if PJ_HAS_INT64
- return ((unsigned)(bps * usec_ptime / PJ_UINT64(8000000)));
+ return ((unsigned)((pj_uint64_t)bps * usec_ptime / PJ_UINT64(8000000)));
#elif PJ_HAS_FLOATING_POINT
- return ((unsigned)(bps * usec_ptime / 8000000.0));
+ return ((unsigned)(1.0 * bps * usec_ptime / 8000000.0));
#else
return ((unsigned)(bps / 8L * usec_ptime / 1000000));
#endif