Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] RTP Stream Analyses and dynamic payload clock rates

From: "Michael Lum" <michael.lum@xxxxxxxxxxxxxxxxx>
Date: Thu, 13 Nov 2008 09:45:59 -0800
Hello,

(Source is from 1.0.4)

I was looking through tap-rtp-common.c because I wanted
to add some CODECs when I noticed what I think is a bug.

In this function:

static guint32
get_dyn_pt_clock_rate(gchar *payload_type_str)
{
    size_t i;

    for (i = 0; i < NUM_DYN_CLOCK_VALUES; i++) {
        if
(g_ascii_strncasecmp(mimetype_and_clock_map[i].pt_mime_name_str,payload_
type_str,(strlen(mimetype_and_clock_map[i].pt_mime_name_str))) == 0)
            return mimetype_and_clock_map[i].value;
    }

    return 1;
}

Here's the first 2 entries in the array:

static const mimetype_and_clock mimetype_and_clock_map[] = {
        {"AMR",         8000},                  /* [RFC3267] */
        {"AMR-WB",      16000},                 /* [RFC3267] */

So if 'payload_type_str' is equal to 'AMR-WB' I believe the first match
will be 'AMR' and the
returned clock rate of 8000 will be incorrect.

Wouldn't my example be the equivalent to

	strncasecmp("AMR", "AMR-WB", 3)

?

Thanks.

--
Michael Lum                   Principal Software Engineer
4600 Jacombs Road             +1.604.276.0055
Richmond, B.C.
Canada V6V 3B1
Star Solutions