- Timestamp:
- Mar 31, 2011 5:29:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/sdp_neg.c
r3347 r3493 53 53 }; 54 54 55 #define GET_FMTP_IVAL (ival, fmtp, param, default_val) \55 #define GET_FMTP_IVAL_BASE(ival, base, fmtp, param, default_val) \ 56 56 do { \ 57 57 pj_str_t s; \ … … 64 64 pj_strset(&s, p + param.slen, fmtp.fmt_param.slen - \ 65 65 (p - fmtp.fmt_param.ptr) - param.slen); \ 66 ival = pj_strtoul (&s); \66 ival = pj_strtoul2(&s, NULL, base); \ 67 67 } while (0) 68 69 #define GET_FMTP_IVAL(ival, fmtp, param, default_val) \ 70 GET_FMTP_IVAL_BASE(ival, 10, fmtp, param, default_val) 71 68 72 69 73 /* … … 679 683 680 684 685 /* Matching H.264 between offer and answer. */ 686 static pj_bool_t match_h264( const pjmedia_sdp_media *offer, 687 unsigned o_fmt_idx, 688 const pjmedia_sdp_media *answer, 689 unsigned a_fmt_idx) 690 { 691 const pjmedia_sdp_attr *attr_ans; 692 const pjmedia_sdp_attr *attr_ofr; 693 pjmedia_sdp_fmtp fmtp; 694 pj_uint32_t profile1, profile2; 695 unsigned pack_mode1, pack_mode2; 696 const pj_str_t STR_PROFILE = {"profile-level-id=", 17}; 697 const pj_str_t STR_PACK_MODE = {"packetization-mode=", 19}; 698 699 /* Parse offer */ 700 attr_ofr = pjmedia_sdp_media_find_attr2(offer, "fmtp", 701 &offer->desc.fmt[o_fmt_idx]); 702 if (!attr_ofr) 703 return PJ_FALSE; 704 705 if (pjmedia_sdp_attr_get_fmtp(attr_ofr, &fmtp) != PJ_SUCCESS) 706 return PJ_FALSE; 707 708 GET_FMTP_IVAL_BASE(profile1, 16, fmtp, STR_PROFILE, 0x42000A); 709 GET_FMTP_IVAL(pack_mode1, fmtp, STR_PACK_MODE, 0); 710 711 /* Parse answer */ 712 attr_ans = pjmedia_sdp_media_find_attr2(answer, "fmtp", 713 &answer->desc.fmt[a_fmt_idx]); 714 if (!attr_ans) 715 return PJ_FALSE; 716 717 if (pjmedia_sdp_attr_get_fmtp(attr_ans, &fmtp) != PJ_SUCCESS) 718 return PJ_FALSE; 719 720 GET_FMTP_IVAL_BASE(profile2, 16, fmtp, STR_PROFILE, 0x42000A); 721 GET_FMTP_IVAL(pack_mode2, fmtp, STR_PACK_MODE, 0); 722 723 /* Compare bitrate in answer and offer. */ 724 return ((profile1 == profile2) && (pack_mode1 == pack_mode2)); 725 } 726 727 681 728 /* Toggle AMR octet-align setting in the fmtp. 682 729 */ … … 877 924 { 878 925 /* Further check for G7221, negotiate bitrate. */ 879 if (pj_stricmp2(&or_.enc_name, "G7221") == 0) { 926 if (pj_stricmp2(&or_.enc_name, "G7221") == 0) 927 { 880 928 if (match_g7221(offer, i, answer, j)) 881 929 break; … … 887 935 if (match_amr(offer, i, answer, j, PJ_FALSE, 888 936 NULL)) 937 break; 938 } else 939 /* Further check for H264, negotiate fmtp. */ 940 if (pj_stricmp2(&or_.enc_name, "H264") == 0) 941 { 942 if (match_h264(offer, i, answer, j)) 889 943 break; 890 944 } else { … … 1200 1254 PJ_TRUE, &pt_amr_need_adapt)) 1201 1255 continue; 1256 } else 1257 if (pj_stricmp2(&or_.enc_name, "H264") == 0 && 1258 !match_h264(master, i, slave, j)) 1259 { 1260 continue; 1202 1261 } 1203 1262 found_matching_codec = 1;
Note: See TracChangeset
for help on using the changeset viewer.