i'm sometimes seeing sdp parsing errors like this:
Apr 11 12:55:11 localhost sems[1262]: Debug: (AmSdp.cpp)(parse_sdp_media)(605):
parse_sdp_line_ex: parse_sdp_media: parsing media description, audio 16386
RTP/AVP 0 8 101^M a=rtpmap:0 PCMU/8000^M a=rtpmap:8 PCMA/8000^M a=rtpmap:101
telephone-event/8000^M a=fmtp:101 0-15^M a=ptime:30^M a=sendrecv^M
a=direction:active^M
Apr 11 12:55:11 localhost sems[1262]: Debug: (AmSdp.cpp)(parse_sdp_media)(694):
parse_sdp_line_ex: parse_sdp_media: done parsing media description
Apr 11 12:55:11 localhost sems[1262]: Debug: (AmSdp.cpp)(parse_sdp_attr)(799):
found media attr 'rtpmap' type '0'
Apr 11 12:55:11 localhost sems[1262]: Debug: (AmSdp.cpp)(parse_sdp_attr)(799):
found media attr 'rtpmap' type '8'
Apr 11 12:55:11 localhost sems[1262]: Debug: (AmSdp.cpp)(parse_sdp_attr)(799):
found media attr 'rtpmap' type '101'
Apr 11 12:55:11 localhost sems[1262]: Debug: (AmSdp.cpp)(parse_sdp_attr)(848):
found media attr 'fmtp' type '101'
Apr 11 12:55:11 localhost sems[1262]: Debug: (AmSdp.cpp)(parse_sdp_attr)(881):
found media attr 'ptime' value '30'
Apr 11 12:55:11 localhost sems[1262]: Debug: (AmSdp.cpp)(parse_sdp_attr)(897):
found media attr 'sendrecv'
Apr 11 12:55:11 localhost sems[1262]: Debug: (AmSdp.cpp)(parse_sdp_attr)(857):
found media attr 'direction' value 'active'
Apr 11 12:55:11 localhost sems[1262]: Debug:
(AmSdp.cpp)(parse_sdp_line_ex)(500): parse_sdp_line: skipping unknown Media
description '6 G726-40/8000'
that is, after parsing the last media attribute (in this case
direction), sdp parser goes on and tries to continue parsing although
there is nothing left. obviously parsing garbage is not a good idea.
one reason for this could be a bug in get_next_line function:
inline char* get_next_line(char* s)
{
char* next_line=s;
//search for next line
while( *next_line != '\0') {
if(*next_line == 13){
next_line +=2;
break;
}
else if(*next_line == 10){
next_line +=1;
break;
}
next_line++;
}
if(*next_line == '\0')
next_line +=1;
return next_line;
}
i cannot understand why there is this code?
if(*next_line == '\0')
next_line +=1;
if there are no more lines, why is next_line pointer advanced beyond the
sdp body?
-- juha
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev