Suspicious code in rtp_send_frame ( libtrau/rtp_proxy.c )

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/.

Sylvain Munaut 246tnt at gmail.com
Thu Aug 8 13:19:31 UTC 2013


Hi,


At each event since like 27c3 (or maybe even 26c3), we comment out a
part of the rtp_send_frame method to solve some audio issues (glitch
and sometime progressively increasing delay).


This is the piece of code in question:

        {
                struct timeval tv, tv_diff;
                long int usec_diff, frame_diff;

                gettimeofday(&tv, NULL);
                tv_difference(&tv_diff, &rs->transmit.last_tv, &tv);
                rs->transmit.last_tv = tv;

                usec_diff = tv_diff.tv_sec * 1000000 + tv_diff.tv_usec;
                frame_diff = (usec_diff / 20000);

                if (abs(frame_diff) > 1) {
                        long int frame_diff_excess = frame_diff - 1;

                        LOGP(DLMUX, LOGL_NOTICE,
                                "Correcting frame difference of %ld
frames\n", frame_diff_excess);
                        rs->transmit.sequence += frame_diff_excess;
                        rs->transmit.timestamp += frame_diff_excess * duration;
                }
        }

 introduced by :

commit 392736d38bf9dae29800bde630c9ceee8a3914f3
Author: Harald Welte <laforge at netfilter.org>
Date:   Sun Dec 20 13:16:14 2009 +0100

    RTP Proxy: Fix RTP sequence number and timestamp in case of dropped frames

    During handover, we will not send RTP frames for quite some time.  However,
    the way the rtp_send code is structured, it will increment the timestamp
    with a fixed amount every time we send a frame, independent how
much wallclock
    time has actually passed.

    This code is a hack to update the sequence number and timestamp in case it
    seems to be wrong.  It makes handover much more reliable.



Does this speak to anyone ?


Cheers,

    Sylvain




More information about the OpenBSC mailing list