[PATCH 8/9] Fixed (nanoBTS) delay problems, if RTP stream jitters too much

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Jacob Erlbeck jerlbeck at sysmocom.de
Thu Jan 30 10:58:55 UTC 2014


Dear Andreas,

On 23.01.2014 11:53, Andreas Eversberg wrote:
> 
> 0008-Fixed-nanoBTS-delay-problems-if-RTP-stream-jitters-t.patch
> 
> @@ -244,13 +250,62 @@ static void tv_difference(struct timeval *diff, const struct timeval *from,
...

Is there a reason why you are not using the BSD macros timersub and
timeradd (beside the new support for denormalized usec values)?

>  
> +/* add sec,usec to tv */
> +static void tv_add(struct timeval *tv, int sec, int usec)
> +{
> +
> +	while (usec < 0) {
> +		usec += USEC_1S;
> +		sec--;
> +	}
> +	tv->tv_sec += sec;
> +	tv->tv_usec += usec;
> +	while (tv->tv_usec >= USEC_1S) {
> +		tv->tv_sec++;
> +		tv->tv_usec -= USEC_1S;
> +	}
> +}

I'm not sure whether it is a good idea to use while loops in this case
since CPU usage is O(N) of the usec value.

Wouldn't it be more convenient to have a function tv_add_us(tv, usec)
instead that does the div/mod stuff to a temporary timeval and then just
calls timeradd()?

Cheers

Jacob




More information about the OpenBSC mailing list