Packet-amr Register as "AMR" not "amr".

Add Dynamic PT:s mimestring  to rtp_info if avalable.
Use Dynamic PT:s mime string to find clock rate.

svn path=/trunk/; revision=16397
This commit is contained in:
Anders Broman 2005-11-05 21:38:22 +00:00
parent 4a92dc0bc9
commit 2916d12d76
4 changed files with 68 additions and 3 deletions

View File

@ -307,7 +307,7 @@ proto_reg_handoff_amr(void)
if ( dynamic_payload_type > 95 ){
dissector_add("rtp.pt", dynamic_payload_type, amr_handle);
}
dissector_add_string("rtp_dyn_payload_type","amr", amr_handle);
dissector_add_string("rtp_dyn_payload_type","AMR", amr_handle);
}

View File

@ -492,6 +492,7 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
rtp_info->info_timestamp = timestamp;
rtp_info->info_sync_src = sync_src;
rtp_info->info_setup_frame_num = 0;
rtp_info->info_payload_type_str = NULL;
/*
* Do we have all the data?
@ -537,8 +538,10 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
if ( (payload_type>95) && (payload_type<128) ) {
/* Use existing packet info if available */
p_conv_data = p_get_proto_data(pinfo->fd, proto_rtp);
if (p_conv_data && p_conv_data->rtp_dyn_payload)
if (p_conv_data && p_conv_data->rtp_dyn_payload){
payload_type_str = g_hash_table_lookup(p_conv_data->rtp_dyn_payload, &payload_type);
rtp_info->info_payload_type_str = payload_type_str;
}
}
if ( check_col( pinfo->cinfo, COL_INFO) ) {

View File

@ -42,6 +42,7 @@ struct _rtp_info {
guint info_payload_len; /* length of payload (incl padding) */
guint32 info_setup_frame_num; /* the frame num of the packet that set this RTP connection */
const guint8* info_data; /* pointer to raw rtp data */
gchar *info_payload_type_str;
/*
* info_data: pointer to raw rtp data = header + payload incl. padding.
* That should be safe because the "epan_dissect_t" constructed for the packet

View File

@ -239,6 +239,62 @@ get_clock_rate(guint32 key)
return 1;
}
typedef struct _mimetype_and_clock {
const gchar *pt_mime_name_str;
guint32 value;
} mimetype_and_clock;
/* RTP sampling clock rates for
"In addition to the RTP payload formats (encodings) listed in the RTP
Payload Types table, there are additional payload formats that do not
have static RTP payload types assigned but instead use dynamic payload
type number assignment. Each payload format is named by a registered
MIME subtype"
http://www.iana.org/assignments/rtp-parameters.
*/
static const mimetype_and_clock mimetype_and_clock_map[] = {
{"AMR", 8000}, /* [RFC3267] */
{"AMR-WB", 16000}, /* [RFC3267] */
{"EVRC", 8000}, /* [RFC3558] */
{"EVRC0", 8000}, /* [RFC3558] */
{"G7221", 16000}, /* [RFC3047] */
{"G726-16", 8000}, /* [RFC3551] */
{"G726-24", 8000}, /* [RFC3551] */
{"G726-32", 8000}, /* [RFC3551] */
{"G726-40", 8000}, /* [RFC3551] */
{"G729D", 8000}, /* [RFC3551] */
{"G729E", 8000}, /* [RFC3551] */
{"GSM-EFR", 8000}, /* [RFC3551] */
{"mpa-robust", 90000}, /* [RFC3119] */
{"SMV", 8000}, /* [RFC3558] */
{"SMV0", 8000}, /* [RFC3558] */
{"red", 1000}, /* [RFC4102] */
{"t140", 1000}, /* [RFC4103] */
{"BMPEG", 90000}, /* [RFC2343],[RFC3555] */
{"BT656", 90000}, /* [RFC2431],[RFC3555] */
{"DV", 90000}, /* [RFC3189] */
{"H263-1998", 90000}, /* [RFC2429],[RFC3555] */
{"H263-2000", 90000}, /* [RFC2429],[RFC3555] */
{"MP1S", 90000}, /* [RFC2250],[RFC3555] */
{"MP2P", 90000}, /* [RFC2250],[RFC3555] */
{"MP4V-ES", 90000}, /* [RFC3016] */
{"pointer", 90000}, /* [RFC2862] */
{"raw", 90000}, /* [RFC4175] */
};
#define NUM_DYN_CLOCK_VALUES (sizeof mimetype_and_clock_map / sizeof mimetype_and_clock_map[0])
static guint32
get_dyn_pt_clock_rate(gchar *payload_type_str)
{
size_t i;
for (i = 0; i < NUM_DYN_CLOCK_VALUES; i++) {
if (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 clock_map[i].value;
}
return 1;
}
/* type of error when saving voice in a file didn't succeed */
typedef enum {
@ -592,7 +648,12 @@ int rtp_packet_analyse(tap_rtp_stat_t *statinfo,
* payload types, presumably meaning that we should
* just ignore this packet?
*/
clock_rate = get_clock_rate(statinfo->pt);
if (statinfo->pt < 96 ){
clock_rate = get_clock_rate(statinfo->pt);
}else{ /* dynamic PT */
if ( rtpinfo->info_payload_type_str != NULL )
clock_rate = get_dyn_pt_clock_rate(rtpinfo-> info_payload_type_str);
}
/* store the current time and calculate the current jitter */
current_time = nstime_to_sec(&pinfo->fd->rel_ts);