diff --git a/tools/isotest.c b/tools/isotest.c
index 68154b1..c1bb6ab 100644
--- a/tools/isotest.c
+++ b/tools/isotest.c
#define NSEC_USEC(_t) (_t / 1000L)
#define SEC_USEC(_t) (_t * 1000000L)
#define TS_USEC(_ts) (SEC_USEC((_ts)->tv_sec) + NSEC_USEC((_ts)->tv_nsec))
+#define ROUND_CLOSEST(_x, _y) (((_x) + (_y / 2)) / (_y))
#define DEFAULT_BIG_ID 0x01
#define DEFAULT_BIS_ID 0x01
}
/* num of packets = latency (ms) / interval (us) */
- num = (out->latency * 1000 / out->interval);
+ num = ROUND_CLOSEST(out->latency * 1000, out->interval);
+ if (!num)
+ num = 1;
syslog(LOG_INFO, "Number of packets: %d", num);
* latency:
* jitter buffer = 2 * (SDU * subevents)
*/
- sndbuf = 2 * ((out->latency * 1000 / out->interval) *
- out->sdu);
+ sndbuf = 2 * (num * out->sdu);
len = sizeof(sndbuf);
if (setsockopt(sk, SOL_SOCKET, SO_SNDBUF, &sndbuf, len) < 0) {