Changeset 1950 for pjproject/trunk/pjmedia/src/test/sdp_neg_test.c
- Timestamp:
- May 7, 2008 3:30:34 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/test/sdp_neg_test.c
r974 r1950 321 321 }, 322 322 323 #if 0 324 // this test is commented, this causes error: 325 // No suitable codec for remote offer (PJMEDIA_SDPNEG_NOANSCODEC), 326 // since currently the negotiator always answer with one codec, 327 // PCMU in this case, while PCMU is not included in the second offer. 328 323 329 /* test 3: */ 324 330 { … … 394 400 } 395 401 }, 402 #endif 396 403 397 404 /* test 4: */ … … 752 759 "m=audio 49172 RTP/AVP 97 8 99\r\n" 753 760 "a=rtpmap:97 iLBC/8000\r\n" 754 "a=rtpmap:99 telephone-event/8000\r\n" 755 "a=recvonly\r\n", 761 "a=rtpmap:99 telephone-event/8000\r\n", 756 762 /* Bob's answer should be: */ 757 763 "v=0\r\n" … … 868 874 "a=rtpmap:97 iLBC/8000\r\n" 869 875 "a=rtpmap:101 telephone-event/8000\r\n", 876 } 877 } 878 }, 879 880 /* test 12: */ 881 { 882 /********************************************************************* 883 * Ticket #527: More lenient SDP negotiator. 884 */ 885 886 "Ticket #527 scenario #1: Partial answer", 887 1, 888 { 889 { 890 LOCAL_OFFER, 891 /* Alice sends offer audio and video: */ 892 "v=0\r\n" 893 "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n" 894 "s=alice\r\n" 895 "c=IN IP4 host.atlanta.example.com\r\n" 896 "t=0 0\r\n" 897 "m=audio 49170 RTP/AVP 0\r\n" 898 "a=rtpmap:0 PCMU/8000\r\n" 899 "m=video 4000 RTP/AVP 31\r\n" 900 "a=rtpmap:31 H261/90000\r\n", 901 /* Receive Bob's answer only audio: */ 902 "v=0\r\n" 903 "o=bob 2808844564 2808844563 IN IP4 host.biloxi.example.com\r\n" 904 "s=bob\r\n" 905 "c=IN IP4 host.biloxi.example.com\r\n" 906 "t=0 0\r\n" 907 "m=audio 49170 RTP/AVP 0\r\n" 908 "a=rtpmap:0 PCMU/8000\r\n", 909 /* Alice's local SDP should be: */ 910 "v=0\r\n" 911 "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n" 912 "s=alice\r\n" 913 "c=IN IP4 host.atlanta.example.com\r\n" 914 "t=0 0\r\n" 915 "m=audio 49170 RTP/AVP 0\r\n" 916 "a=rtpmap:0 PCMU/8000\r\n" 917 "m=video 0 RTP/AVP 31\r\n" 918 "a=rtpmap:31 H261/90000\r\n" 919 "", 920 } 921 } 922 }, 923 924 /* test 13: */ 925 { 926 /********************************************************************* 927 * Ticket #527: More lenient SDP negotiator. 928 */ 929 930 "Ticket #527 scenario #1: Media mismatch in answer", 931 1, 932 { 933 { 934 LOCAL_OFFER, 935 /* Alice sends offer audio and video: */ 936 "v=0\r\n" 937 "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n" 938 "s=alice\r\n" 939 "c=IN IP4 host.atlanta.example.com\r\n" 940 "t=0 0\r\n" 941 "m=audio 3000 RTP/AVP 0\r\n" 942 "a=rtpmap:0 PCMU/8000\r\n" 943 "m=video 4000 RTP/AVP 31\r\n" 944 "a=rtpmap:31 H261/90000\r\n", 945 /* Receive Bob's answer two audio: */ 946 "v=0\r\n" 947 "o=bob 2808844564 2808844563 IN IP4 host.biloxi.example.com\r\n" 948 "s=bob\r\n" 949 "c=IN IP4 host.biloxi.example.com\r\n" 950 "t=0 0\r\n" 951 "m=audio 49170 RTP/AVP 0\r\n" 952 "a=rtpmap:0 PCMU/8000\r\n" 953 "m=audio 49172 RTP/AVP 0\r\n" 954 "a=rtpmap:0 PCMU/8000\r\n", 955 /* Alice's local SDP should be: */ 956 "v=0\r\n" 957 "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n" 958 "s=alice\r\n" 959 "c=IN IP4 host.atlanta.example.com\r\n" 960 "t=0 0\r\n" 961 "m=audio 3000 RTP/AVP 0\r\n" 962 "a=rtpmap:0 PCMU/8000\r\n" 963 "m=video 0 RTP/AVP 31\r\n" 964 "a=rtpmap:31 H261/90000\r\n" 965 "", 966 } 967 } 968 }, 969 970 /* test 14: */ 971 { 972 /********************************************************************* 973 * Ticket #527: More lenient SDP negotiator. 974 */ 975 976 "Ticket #527 scenario #2: Modify offer - partial streams", 977 2, 978 { 979 { 980 LOCAL_OFFER, 981 /* Alice sends offer: */ 982 "v=0\r\n" 983 "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n" 984 "s=alice\r\n" 985 "c=IN IP4 host.atlanta.example.com\r\n" 986 "t=0 0\r\n" 987 "m=audio 3000 RTP/AVP 0\r\n" 988 "a=rtpmap:0 PCMU/8000\r\n" 989 "m=audio 3100 RTP/AVP 0\r\n" 990 "a=rtpmap:0 PCMU/8000\r\n" 991 "m=video 3200 RTP/AVP 31\r\n" 992 "a=rtpmap:31 H261/90000\r\n" 993 "", 994 /* Receive Bob's answer: */ 995 "v=0\r\n" 996 "o=bob 2808844564 2808844563 IN IP4 host.biloxi.example.com\r\n" 997 "s=bob\r\n" 998 "c=IN IP4 host.biloxi.example.com\r\n" 999 "t=0 0\r\n" 1000 "m=audio 4000 RTP/AVP 0\r\n" 1001 "a=rtpmap:0 PCMU/8000\r\n" 1002 "m=audio 4100 RTP/AVP 0\r\n" 1003 "a=rtpmap:0 PCMU/8000\r\n" 1004 "m=video 4200 RTP/AVP 31\r\n" 1005 "a=rtpmap:31 H261/90000\r\n" 1006 "", 1007 /* Alice's local SDP should be: */ 1008 "v=0\r\n" 1009 "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n" 1010 "s=alice\r\n" 1011 "c=IN IP4 host.atlanta.example.com\r\n" 1012 "t=0 0\r\n" 1013 "m=audio 3000 RTP/AVP 0\r\n" 1014 "a=rtpmap:0 PCMU/8000\r\n" 1015 "m=audio 3100 RTP/AVP 0\r\n" 1016 "a=rtpmap:0 PCMU/8000\r\n" 1017 "m=video 3200 RTP/AVP 31\r\n" 1018 "a=rtpmap:31 H261/90000\r\n" 1019 "", 1020 }, 1021 { 1022 LOCAL_OFFER, 1023 /* Alice modifies offer with only specify one audio: */ 1024 "v=0\r\n" 1025 "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n" 1026 "s=alice\r\n" 1027 "c=IN IP4 host.atlanta.example.com\r\n" 1028 "t=0 0\r\n" 1029 "m=audio 5200 RTP/AVP 0\r\n" 1030 "a=rtpmap:0 PCMU/8000\r\n" 1031 "", 1032 /* Receive Bob's answer: */ 1033 "v=0\r\n" 1034 "o=bob 2808844564 2808844563 IN IP4 host.biloxi.example.com\r\n" 1035 "s=bob\r\n" 1036 "c=IN IP4 host.biloxi.example.com\r\n" 1037 "t=0 0\r\n" 1038 "m=audio 7000 RTP/AVP 0\r\n" 1039 "a=rtpmap:0 PCMU/8000\r\n" 1040 "m=audio 0 RTP/AVP 0\r\n" 1041 "a=rtpmap:0 PCMU/8000\r\n" 1042 "m=video 0 RTP/AVP 31\r\n" 1043 "a=rtpmap:31 H261/90000\r\n" 1044 "", 1045 /* Alice's local SDP should be: */ 1046 "v=0\r\n" 1047 "o=alice 2890844526 2890844527 IN IP4 host.atlanta.example.com\r\n" 1048 "s=alice\r\n" 1049 "c=IN IP4 host.atlanta.example.com\r\n" 1050 "t=0 0\r\n" 1051 "m=audio 5200 RTP/AVP 0\r\n" 1052 "a=rtpmap:0 PCMU/8000\r\n" 1053 "m=audio 0 RTP/AVP 0\r\n" 1054 "a=rtpmap:0 PCMU/8000\r\n" 1055 "m=video 0 RTP/AVP 31\r\n" 1056 "a=rtpmap:31 H261/90000\r\n" 1057 "", 1058 } 1059 } 1060 }, 1061 1062 /* test 15: */ 1063 { 1064 /********************************************************************* 1065 * Ticket #527: More lenient SDP negotiator. 1066 */ 1067 1068 "Ticket #527 scenario #2: Modify offer - unordered m= lines", 1069 2, 1070 { 1071 { 1072 LOCAL_OFFER, 1073 /* Alice sends offer: */ 1074 "v=0\r\n" 1075 "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n" 1076 "s=alice\r\n" 1077 "c=IN IP4 host.atlanta.example.com\r\n" 1078 "t=0 0\r\n" 1079 "m=audio 3000 RTP/AVP 0\r\n" 1080 "a=rtpmap:0 PCMU/8000\r\n" 1081 "m=video 3200 RTP/AVP 31\r\n" 1082 "a=rtpmap:31 H261/90000\r\n" 1083 "", 1084 /* Receive Bob's answer: */ 1085 "v=0\r\n" 1086 "o=bob 2808844564 2808844563 IN IP4 host.biloxi.example.com\r\n" 1087 "s=bob\r\n" 1088 "c=IN IP4 host.biloxi.example.com\r\n" 1089 "t=0 0\r\n" 1090 "m=audio 4000 RTP/AVP 0\r\n" 1091 "a=rtpmap:0 PCMU/8000\r\n" 1092 "m=video 4200 RTP/AVP 31\r\n" 1093 "a=rtpmap:31 H261/90000\r\n" 1094 "", 1095 /* Alice's local SDP should be: */ 1096 "v=0\r\n" 1097 "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n" 1098 "s=alice\r\n" 1099 "c=IN IP4 host.atlanta.example.com\r\n" 1100 "t=0 0\r\n" 1101 "m=audio 3000 RTP/AVP 0\r\n" 1102 "a=rtpmap:0 PCMU/8000\r\n" 1103 "m=video 3200 RTP/AVP 31\r\n" 1104 "a=rtpmap:31 H261/90000\r\n" 1105 "", 1106 }, 1107 { 1108 LOCAL_OFFER, 1109 /* Alice modifies offer with unordered m= lines: */ 1110 "v=0\r\n" 1111 "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n" 1112 "s=alice\r\n" 1113 "c=IN IP4 host.atlanta.example.com\r\n" 1114 "t=0 0\r\n" 1115 "m=video 5000 RTP/AVP 31\r\n" 1116 "a=rtpmap:31 H261/90000\r\n" 1117 "m=audio 5200 RTP/AVP 0\r\n" 1118 "a=rtpmap:0 PCMU/8000\r\n" 1119 "", 1120 /* Receive Bob's answer: */ 1121 "v=0\r\n" 1122 "o=bob 2808844564 2808844563 IN IP4 host.biloxi.example.com\r\n" 1123 "s=bob\r\n" 1124 "c=IN IP4 host.biloxi.example.com\r\n" 1125 "t=0 0\r\n" 1126 "m=audio 7000 RTP/AVP 0\r\n" 1127 "a=rtpmap:0 PCMU/8000\r\n" 1128 "m=video 2000 RTP/AVP 31\r\n" 1129 "a=rtpmap:31 H261/90000\r\n" 1130 "", 1131 /* Alice's local SDP should be: */ 1132 "v=0\r\n" 1133 "o=alice 2890844526 2890844527 IN IP4 host.atlanta.example.com\r\n" 1134 "s=alice\r\n" 1135 "c=IN IP4 host.atlanta.example.com\r\n" 1136 "t=0 0\r\n" 1137 "m=audio 5200 RTP/AVP 0\r\n" 1138 "a=rtpmap:0 PCMU/8000\r\n" 1139 "m=video 5000 RTP/AVP 31\r\n" 1140 "a=rtpmap:31 H261/90000\r\n" 1141 "", 1142 } 1143 } 1144 }, 1145 1146 /* test 16: */ 1147 { 1148 /********************************************************************* 1149 * Ticket #527: More lenient SDP negotiator. 1150 */ 1151 1152 "Ticket #527 scenario #2: Modify offer - partial & unordered streams", 1153 2, 1154 { 1155 { 1156 LOCAL_OFFER, 1157 /* Alice sends offer: */ 1158 "v=0\r\n" 1159 "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n" 1160 "s=alice\r\n" 1161 "c=IN IP4 host.atlanta.example.com\r\n" 1162 "t=0 0\r\n" 1163 "m=audio 3000 RTP/AVP 0\r\n" 1164 "a=rtpmap:0 PCMU/8000\r\n" 1165 "m=audio 3200 RTP/AVP 0\r\n" 1166 "a=rtpmap:0 PCMU/8000\r\n" 1167 "m=video 3400 RTP/AVP 31\r\n" 1168 "a=rtpmap:31 H261/90000\r\n" 1169 "", 1170 /* Receive Bob's answer: */ 1171 "v=0\r\n" 1172 "o=bob 2808844564 2808844563 IN IP4 host.biloxi.example.com\r\n" 1173 "s=bob\r\n" 1174 "c=IN IP4 host.biloxi.example.com\r\n" 1175 "t=0 0\r\n" 1176 "m=audio 4000 RTP/AVP 0\r\n" 1177 "a=rtpmap:0 PCMU/8000\r\n" 1178 "m=audio 4200 RTP/AVP 0\r\n" 1179 "a=rtpmap:0 PCMU/8000\r\n" 1180 "m=video 4400 RTP/AVP 31\r\n" 1181 "a=rtpmap:31 H261/90000\r\n" 1182 "", 1183 /* Alice's local SDP should be: */ 1184 "v=0\r\n" 1185 "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n" 1186 "s=alice\r\n" 1187 "c=IN IP4 host.atlanta.example.com\r\n" 1188 "t=0 0\r\n" 1189 "m=audio 3000 RTP/AVP 0\r\n" 1190 "a=rtpmap:0 PCMU/8000\r\n" 1191 "m=audio 3200 RTP/AVP 0\r\n" 1192 "a=rtpmap:0 PCMU/8000\r\n" 1193 "m=video 3400 RTP/AVP 31\r\n" 1194 "a=rtpmap:31 H261/90000\r\n" 1195 "", 1196 }, 1197 { 1198 LOCAL_OFFER, 1199 /* Alice modifies offer by specifying partial and unordered media: */ 1200 "v=0\r\n" 1201 "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n" 1202 "s=alice\r\n" 1203 "c=IN IP4 host.atlanta.example.com\r\n" 1204 "t=0 0\r\n" 1205 "m=video 5000 RTP/AVP 31\r\n" 1206 "a=rtpmap:31 H261/90000\r\n" 1207 "m=audio 7000 RTP/AVP 0\r\n" 1208 "a=rtpmap:0 PCMU/8000\r\n" 1209 "", 1210 /* Receive Bob's answer: */ 1211 "v=0\r\n" 1212 "o=bob 2808844564 2808844563 IN IP4 host.biloxi.example.com\r\n" 1213 "s=bob\r\n" 1214 "c=IN IP4 host.biloxi.example.com\r\n" 1215 "t=0 0\r\n" 1216 "m=audio 4000 RTP/AVP 0\r\n" 1217 "a=rtpmap:0 PCMU/8000\r\n" 1218 "m=audio 0 RTP/AVP 0\r\n" 1219 "a=rtpmap:0 PCMU/8000\r\n" 1220 "m=video 4400 RTP/AVP 31\r\n" 1221 "a=rtpmap:31 H261/90000\r\n" 1222 "", 1223 /* Alice's local SDP should be: */ 1224 "v=0\r\n" 1225 "o=alice 2890844526 2890844527 IN IP4 host.atlanta.example.com\r\n" 1226 "s=alice\r\n" 1227 "c=IN IP4 host.atlanta.example.com\r\n" 1228 "t=0 0\r\n" 1229 "m=audio 7000 RTP/AVP 0\r\n" 1230 "a=rtpmap:0 PCMU/8000\r\n" 1231 "m=audio 0 RTP/AVP 0\r\n" 1232 "a=rtpmap:0 PCMU/8000\r\n" 1233 "m=video 5000 RTP/AVP 31\r\n" 1234 "a=rtpmap:31 H261/90000\r\n" 1235 "", 870 1236 } 871 1237 } … … 1076 1442 */ 1077 1443 1078 pjmedia_sdp_session *sdp2 , *sdp3;1444 pjmedia_sdp_session *sdp2 = NULL, *sdp3; 1079 1445 const pjmedia_sdp_session *answer; 1080 1446 1081 if ( neg == NULL) {1447 if (oa->sdp2) { 1082 1448 /* Parse and validate initial local capability */ 1083 1449 status = pjmedia_sdp_parse(pool, oa->sdp2, pj_native_strlen(oa->sdp2), … … 1093 1459 return -210; 1094 1460 } 1095 1461 } else if (neg) { 1462 status = pjmedia_sdp_neg_get_active_local(neg, &sdp2); 1463 if (status != PJ_SUCCESS) { 1464 app_perror(status, 1465 " error: pjmedia_sdp_neg_get_active_local"); 1466 return -215; 1467 } 1468 } 1469 1470 if (neg == NULL) { 1096 1471 /* Create negotiator with remote offer. */ 1097 1472 status = pjmedia_sdp_neg_create_w_remote_offer(pool, sdp2, sdp1, &neg); … … 1109 1484 return -230; 1110 1485 } 1486 1487 status = pjmedia_sdp_neg_set_local_answer(pool, neg, sdp2); 1488 if (status != PJ_SUCCESS) { 1489 app_perror(status, " error: pjmedia_sdp_neg_set_local_answer"); 1490 return -235; 1491 } 1111 1492 } 1112 1493
Note: See TracChangeset
for help on using the changeset viewer.