- Timestamp:
- Jun 24, 2009 3:20:39 PM (15 years ago)
- Location:
- pjproject/branches/1.0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/1.0
- Property svn:mergeinfo changed
/pjproject/trunk merged: 2582
- Property svn:mergeinfo changed
-
pjproject/branches/1.0/pjmedia/src/pjmedia/conference.c
r2394 r2789 887 887 PJ_ASSERT_RETURN(conf && slot<conf->max_ports, PJ_EINVAL); 888 888 889 pj_mutex_lock(conf->mutex); 890 889 891 /* Port must be valid. */ 890 PJ_ASSERT_RETURN(conf->ports[slot] != NULL, PJ_EINVAL); 892 conf_port = conf->ports[slot]; 893 if (conf_port == NULL) { 894 pj_mutex_unlock(conf->mutex); 895 return PJ_EINVAL; 896 } 891 897 892 898 conf_port = conf->ports[slot]; … … 897 903 if (rx != PJMEDIA_PORT_NO_CHANGE) 898 904 conf_port->rx_setting = rx; 905 906 pj_mutex_unlock(conf->mutex); 899 907 900 908 return PJ_SUCCESS; … … 918 926 sink_slot<conf->max_ports, PJ_EINVAL); 919 927 920 /* Ports must be valid. */921 PJ_ASSERT_RETURN(conf->ports[src_slot] != NULL, PJ_EINVAL);922 PJ_ASSERT_RETURN(conf->ports[sink_slot] != NULL, PJ_EINVAL);923 924 928 /* For now, level MUST be zero. */ 925 929 PJ_ASSERT_RETURN(level == 0, PJ_EINVAL); … … 927 931 pj_mutex_lock(conf->mutex); 928 932 933 /* Ports must be valid. */ 929 934 src_port = conf->ports[src_slot]; 930 935 dst_port = conf->ports[sink_slot]; 936 if (!src_port || !dst_port) { 937 pj_mutex_unlock(conf->mutex); 938 return PJ_EINVAL; 939 } 931 940 932 941 /* Check if connection has been made */ … … 980 989 sink_slot<conf->max_ports, PJ_EINVAL); 981 990 991 pj_mutex_lock(conf->mutex); 992 982 993 /* Ports must be valid. */ 983 PJ_ASSERT_RETURN(conf->ports[src_slot] != NULL, PJ_EINVAL);984 PJ_ASSERT_RETURN(conf->ports[sink_slot] != NULL, PJ_EINVAL);985 986 pj_mutex_lock(conf->mutex);987 988 994 src_port = conf->ports[src_slot]; 989 995 dst_port = conf->ports[sink_slot]; 996 if (!src_port || !dst_port) { 997 pj_mutex_unlock(conf->mutex); 998 return PJ_EINVAL; 999 } 990 1000 991 1001 /* Check if connection has been made */ … … 1058 1068 PJ_ASSERT_RETURN(conf && port < conf->max_ports, PJ_EINVAL); 1059 1069 1060 /* Port must be valid. */1061 PJ_ASSERT_RETURN(conf->ports[port] != NULL, PJ_EINVAL);1062 1063 1070 /* Suspend the sound devices. 1064 1071 * Don't want to remove port while port is being accessed by sound … … 1068 1075 pj_mutex_lock(conf->mutex); 1069 1076 1077 /* Port must be valid. */ 1070 1078 conf_port = conf->ports[port]; 1079 if (conf_port == NULL) { 1080 pj_mutex_unlock(conf->mutex); 1081 return PJ_EINVAL; 1082 } 1083 1071 1084 conf_port->tx_setting = PJMEDIA_PORT_DISABLE; 1072 1085 conf_port->rx_setting = PJMEDIA_PORT_DISABLE; … … 1137 1150 PJ_ASSERT_RETURN(conf && p_count && ports, PJ_EINVAL); 1138 1151 1152 /* Lock mutex */ 1153 pj_mutex_lock(conf->mutex); 1154 1139 1155 for (i=0; i<conf->max_ports && count<*p_count; ++i) { 1140 1156 if (!conf->ports[i]) … … 1144 1160 } 1145 1161 1162 /* Unlock mutex */ 1163 pj_mutex_unlock(conf->mutex); 1164 1146 1165 *p_count = count; 1147 1166 return PJ_SUCCESS; … … 1160 1179 PJ_ASSERT_RETURN(conf && slot<conf->max_ports, PJ_EINVAL); 1161 1180 1181 /* Lock mutex */ 1182 pj_mutex_lock(conf->mutex); 1183 1162 1184 /* Port must be valid. */ 1163 PJ_ASSERT_RETURN(conf->ports[slot] != NULL, PJ_EINVAL);1164 1165 1185 conf_port = conf->ports[slot]; 1186 if (conf_port == NULL) { 1187 pj_mutex_unlock(conf->mutex); 1188 return PJ_EINVAL; 1189 } 1166 1190 1167 1191 info->slot = slot; … … 1178 1202 info->rx_adj_level = conf_port->rx_adj_level - NORMAL_LEVEL; 1179 1203 1204 /* Unlock mutex */ 1205 pj_mutex_unlock(conf->mutex); 1206 1180 1207 return PJ_SUCCESS; 1181 1208 } … … 1190 1217 PJ_ASSERT_RETURN(conf && size && info, PJ_EINVAL); 1191 1218 1219 /* Lock mutex */ 1220 pj_mutex_lock(conf->mutex); 1221 1192 1222 for (i=0; i<conf->max_ports && count<*size; ++i) { 1193 1223 if (!conf->ports[i]) … … 1197 1227 ++count; 1198 1228 } 1229 1230 /* Unlock mutex */ 1231 pj_mutex_unlock(conf->mutex); 1199 1232 1200 1233 *size = count; … … 1216 1249 PJ_ASSERT_RETURN(conf && slot<conf->max_ports, PJ_EINVAL); 1217 1250 1251 /* Lock mutex */ 1252 pj_mutex_lock(conf->mutex); 1253 1218 1254 /* Port must be valid. */ 1219 PJ_ASSERT_RETURN(conf->ports[slot] != NULL, PJ_EINVAL);1220 1221 1255 conf_port = conf->ports[slot]; 1256 if (conf_port == NULL) { 1257 pj_mutex_unlock(conf->mutex); 1258 return PJ_EINVAL; 1259 } 1222 1260 1223 1261 if (tx_level != NULL) { … … 1227 1265 if (rx_level != NULL) 1228 1266 *rx_level = conf_port->rx_level; 1267 1268 /* Unlock mutex */ 1269 pj_mutex_unlock(conf->mutex); 1229 1270 1230 1271 return PJ_SUCCESS; … … 1244 1285 PJ_ASSERT_RETURN(conf && slot<conf->max_ports, PJ_EINVAL); 1245 1286 1246 /* Port must be valid. */1247 PJ_ASSERT_RETURN(conf->ports[slot] != NULL, PJ_EINVAL);1248 1249 1287 /* Value must be from -128 to +127 */ 1250 1288 /* Disabled, you can put more than +127, at your own risk: … … 1253 1291 PJ_ASSERT_RETURN(adj_level >= -128, PJ_EINVAL); 1254 1292 1293 /* Lock mutex */ 1294 pj_mutex_lock(conf->mutex); 1295 1296 /* Port must be valid. */ 1255 1297 conf_port = conf->ports[slot]; 1298 if (conf_port == NULL) { 1299 pj_mutex_unlock(conf->mutex); 1300 return PJ_EINVAL; 1301 } 1256 1302 1257 1303 /* Set normalized adjustment level. */ 1258 1304 conf_port->rx_adj_level = adj_level + NORMAL_LEVEL; 1305 1306 /* Unlock mutex */ 1307 pj_mutex_unlock(conf->mutex); 1259 1308 1260 1309 return PJ_SUCCESS; … … 1274 1323 PJ_ASSERT_RETURN(conf && slot<conf->max_ports, PJ_EINVAL); 1275 1324 1276 /* Port must be valid. */1277 PJ_ASSERT_RETURN(conf->ports[slot] != NULL, PJ_EINVAL);1278 1279 1325 /* Value must be from -128 to +127 */ 1280 1326 /* Disabled, you can put more than +127,, at your own risk: … … 1283 1329 PJ_ASSERT_RETURN(adj_level >= -128, PJ_EINVAL); 1284 1330 1331 /* Lock mutex */ 1332 pj_mutex_lock(conf->mutex); 1333 1334 /* Port must be valid. */ 1285 1335 conf_port = conf->ports[slot]; 1336 if (conf_port == NULL) { 1337 pj_mutex_unlock(conf->mutex); 1338 return PJ_EINVAL; 1339 } 1286 1340 1287 1341 /* Set normalized adjustment level. */ 1288 1342 conf_port->tx_adj_level = adj_level + NORMAL_LEVEL; 1343 1344 /* Unlock mutex */ 1345 pj_mutex_unlock(conf->mutex); 1289 1346 1290 1347 return PJ_SUCCESS;
Note: See TracChangeset
for help on using the changeset viewer.