[asterisk-bugs] [JIRA] (ASTERISK-30120) RTP Timestamp issue causes clicks & pops on calls routed via alternate Call Platforms

Sean Bright (JIRA) noreply at issues.asterisk.org
Thu Jul 7 14:06:08 CDT 2022


     [ https://issues.asterisk.org/jira/browse/ASTERISK-30120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sean Bright updated ASTERISK-30120:
-----------------------------------

    Description: 
Asterisk version: 16.25.2
Problem description:
RTP Timestamp issue causes clicks & pops on calls routed via alternate Call Platforms.

Cause:
This means that a short frame following a typical frame should have a timestamp that is a typical frame offset in time, it is the frame after the short frame that should have a shorter timestamp offset. However this does not seem to be the case currently.

With a shortened packet, the wrong value will be written

{code:title=res_rtp_asterisk.c}
static int rtp_raw_write(struct ast_rtp_instance *instance, struct ast_frame *frame, int codec)
{
    struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
    int pred, mark = 0;
    unsigned int ms = calc_txstamp(rtp, &frame->delivery);
    struct ast_sockaddr remote_address = { {0,} };
    int rate = ast_rtp_get_rate(frame->subclass.format) / 1000;
    unsigned int seqno;
#ifdef TEST_FRAMEWORK
    struct ast_rtp_engine_test test = ast_rtp_instance_get_test(instance);
#endif
    if (ast_format_cmp(frame->subclass.format, ast_format_g722) == AST_FORMAT_CMP_EQUAL) {
        frame->samples /= 2;
    }
    if (rtp->sending_digit) {
        return 0;
    }
#ifdef TEST_FRAMEWORK
    if (test && test->send_report) {
        test->send_report = 0;
        ast_rtcp_write(instance);
        return 0;
    }
#endif
    if (frame->frametype == AST_FRAME_VOICE) {
        pred = rtp->lastts + frame->samples;
        /* Re-calculate last TS /
        rtp->lastts = rtp->lastts + ms * rate;
        if (ast_tvzero(frame->delivery)) {
            /* If this isn’t an absolute delivery time, Check if it is close to our prediction,
             * and if so, go with our prediction */
            if (abs((int)rtp->lastts - pred) < MAX_TIMESTAMP_SKEW) {
                rtp->lastts = pred;
            } else {
                ast_debug_rtp(3, “(%p) RTP audio difference is %d, ms is %u\n”,
                    instance, abs((int)rtp->lastts - pred), ms);
                mark = 1;
            }
{code}


  was:
Asterisk version: 16.25.2
Problem description:
RTP Timestamp issue causes clicks & pops on calls routed via alternate Call Platforms.

Cause:
This means that a short frame following a typical frame should have a timestamp that is a typical frame offset in time, it is the frame after the short frame that should have a shorter timestamp offset. However this does not seem to be the case currently.

With a shortened packet, the wrong value will be written
static int rtp_raw_write(struct ast_rtp_instance *instance, struct ast_frame *frame, int codec)
{
struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
int pred, mark = 0;
unsigned int ms = calc_txstamp(rtp, &frame->delivery);
struct ast_sockaddr remote_address = { {0,} };
int rate = ast_rtp_get_rate(frame->subclass.format) / 1000;
unsigned int seqno;
#ifdef TEST_FRAMEWORK
struct ast_rtp_engine_test test = ast_rtp_instance_get_test(instance);
#endif
if (ast_format_cmp(frame->subclass.format, ast_format_g722) == AST_FORMAT_CMP_EQUAL) {
frame->samples /= 2;
}
if (rtp->sending_digit) {
return 0;
}
#ifdef TEST_FRAMEWORK
if (test && test->send_report) {
test->send_report = 0;
ast_rtcp_write(instance);
return 0;
}
#endif
if (frame->frametype == AST_FRAME_VOICE) {
pred = rtp->lastts + frame->samples;
/ Re-calculate last TS /
rtp->lastts = rtp->lastts + ms * rate;
if (ast_tvzero(frame->delivery)) {
/ If this isn’t an absolute delivery time, Check if it is close to our prediction,
and if so, go with our prediction */
if (abs((int)rtp->lastts - pred) < MAX_TIMESTAMP_SKEW) {
rtp->lastts = pred;
} else {
ast_debug_rtp(3, “(%p) RTP audio difference is %d, ms is %u\n”,
instance, abs((int)rtp->lastts - pred), ms);
mark = 1;
}




> RTP Timestamp issue causes clicks & pops on calls routed via alternate Call Platforms
> -------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-30120
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-30120
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_rtp_asterisk
>    Affects Versions: 16.25.2
>         Environment: Centos 7; Centos 8 Streams
>            Reporter: Neeraj
>            Assignee: Neeraj
>
> Asterisk version: 16.25.2
> Problem description:
> RTP Timestamp issue causes clicks & pops on calls routed via alternate Call Platforms.
> Cause:
> This means that a short frame following a typical frame should have a timestamp that is a typical frame offset in time, it is the frame after the short frame that should have a shorter timestamp offset. However this does not seem to be the case currently.
> With a shortened packet, the wrong value will be written
> {code:title=res_rtp_asterisk.c}
> static int rtp_raw_write(struct ast_rtp_instance *instance, struct ast_frame *frame, int codec)
> {
>     struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
>     int pred, mark = 0;
>     unsigned int ms = calc_txstamp(rtp, &frame->delivery);
>     struct ast_sockaddr remote_address = { {0,} };
>     int rate = ast_rtp_get_rate(frame->subclass.format) / 1000;
>     unsigned int seqno;
> #ifdef TEST_FRAMEWORK
>     struct ast_rtp_engine_test test = ast_rtp_instance_get_test(instance);
> #endif
>     if (ast_format_cmp(frame->subclass.format, ast_format_g722) == AST_FORMAT_CMP_EQUAL) {
>         frame->samples /= 2;
>     }
>     if (rtp->sending_digit) {
>         return 0;
>     }
> #ifdef TEST_FRAMEWORK
>     if (test && test->send_report) {
>         test->send_report = 0;
>         ast_rtcp_write(instance);
>         return 0;
>     }
> #endif
>     if (frame->frametype == AST_FRAME_VOICE) {
>         pred = rtp->lastts + frame->samples;
>         /* Re-calculate last TS /
>         rtp->lastts = rtp->lastts + ms * rate;
>         if (ast_tvzero(frame->delivery)) {
>             /* If this isn’t an absolute delivery time, Check if it is close to our prediction,
>              * and if so, go with our prediction */
>             if (abs((int)rtp->lastts - pred) < MAX_TIMESTAMP_SKEW) {
>                 rtp->lastts = pred;
>             } else {
>                 ast_debug_rtp(3, “(%p) RTP audio difference is %d, ms is %u\n”,
>                     instance, abs((int)rtp->lastts - pred), ms);
>                 mark = 1;
>             }
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list