- Timestamp:
- Apr 7, 2009 12:56:02 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/conference.c
r2506 r2582 888 888 PJ_ASSERT_RETURN(conf && slot<conf->max_ports, PJ_EINVAL); 889 889 890 pj_mutex_lock(conf->mutex); 891 890 892 /* Port must be valid. */ 891 PJ_ASSERT_RETURN(conf->ports[slot] != NULL, PJ_EINVAL); 893 conf_port = conf->ports[slot]; 894 if (conf_port == NULL) { 895 pj_mutex_unlock(conf->mutex); 896 return PJ_EINVAL; 897 } 892 898 893 899 conf_port = conf->ports[slot]; … … 898 904 if (rx != PJMEDIA_PORT_NO_CHANGE) 899 905 conf_port->rx_setting = rx; 906 907 pj_mutex_unlock(conf->mutex); 900 908 901 909 return PJ_SUCCESS; … … 919 927 sink_slot<conf->max_ports, PJ_EINVAL); 920 928 921 /* Ports must be valid. */922 PJ_ASSERT_RETURN(conf->ports[src_slot] != NULL, PJ_EINVAL);923 PJ_ASSERT_RETURN(conf->ports[sink_slot] != NULL, PJ_EINVAL);924 925 929 /* For now, level MUST be zero. */ 926 930 PJ_ASSERT_RETURN(level == 0, PJ_EINVAL); … … 928 932 pj_mutex_lock(conf->mutex); 929 933 934 /* Ports must be valid. */ 930 935 src_port = conf->ports[src_slot]; 931 936 dst_port = conf->ports[sink_slot]; 937 if (!src_port || !dst_port) { 938 pj_mutex_unlock(conf->mutex); 939 return PJ_EINVAL; 940 } 932 941 933 942 /* Check if connection has been made */ … … 981 990 sink_slot<conf->max_ports, PJ_EINVAL); 982 991 992 pj_mutex_lock(conf->mutex); 993 983 994 /* Ports must be valid. */ 984 PJ_ASSERT_RETURN(conf->ports[src_slot] != NULL, PJ_EINVAL);985 PJ_ASSERT_RETURN(conf->ports[sink_slot] != NULL, PJ_EINVAL);986 987 pj_mutex_lock(conf->mutex);988 989 995 src_port = conf->ports[src_slot]; 990 996 dst_port = conf->ports[sink_slot]; 997 if (!src_port || !dst_port) { 998 pj_mutex_unlock(conf->mutex); 999 return PJ_EINVAL; 1000 } 991 1001 992 1002 /* Check if connection has been made */ … … 1059 1069 PJ_ASSERT_RETURN(conf && port < conf->max_ports, PJ_EINVAL); 1060 1070 1061 /* Port must be valid. */1062 PJ_ASSERT_RETURN(conf->ports[port] != NULL, PJ_EINVAL);1063 1064 1071 /* Suspend the sound devices. 1065 1072 * Don't want to remove port while port is being accessed by sound … … 1069 1076 pj_mutex_lock(conf->mutex); 1070 1077 1078 /* Port must be valid. */ 1071 1079 conf_port = conf->ports[port]; 1080 if (conf_port == NULL) { 1081 pj_mutex_unlock(conf->mutex); 1082 return PJ_EINVAL; 1083 } 1084 1072 1085 conf_port->tx_setting = PJMEDIA_PORT_DISABLE; 1073 1086 conf_port->rx_setting = PJMEDIA_PORT_DISABLE; … … 1138 1151 PJ_ASSERT_RETURN(conf && p_count && ports, PJ_EINVAL); 1139 1152 1153 /* Lock mutex */ 1154 pj_mutex_lock(conf->mutex); 1155 1140 1156 for (i=0; i<conf->max_ports && count<*p_count; ++i) { 1141 1157 if (!conf->ports[i]) … … 1145 1161 } 1146 1162 1163 /* Unlock mutex */ 1164 pj_mutex_unlock(conf->mutex); 1165 1147 1166 *p_count = count; 1148 1167 return PJ_SUCCESS; … … 1161 1180 PJ_ASSERT_RETURN(conf && slot<conf->max_ports, PJ_EINVAL); 1162 1181 1182 /* Lock mutex */ 1183 pj_mutex_lock(conf->mutex); 1184 1163 1185 /* Port must be valid. */ 1164 PJ_ASSERT_RETURN(conf->ports[slot] != NULL, PJ_EINVAL);1165 1166 1186 conf_port = conf->ports[slot]; 1187 if (conf_port == NULL) { 1188 pj_mutex_unlock(conf->mutex); 1189 return PJ_EINVAL; 1190 } 1167 1191 1168 1192 info->slot = slot; … … 1180 1204 info->rx_adj_level = conf_port->rx_adj_level - NORMAL_LEVEL; 1181 1205 1206 /* Unlock mutex */ 1207 pj_mutex_unlock(conf->mutex); 1208 1182 1209 return PJ_SUCCESS; 1183 1210 } … … 1192 1219 PJ_ASSERT_RETURN(conf && size && info, PJ_EINVAL); 1193 1220 1221 /* Lock mutex */ 1222 pj_mutex_lock(conf->mutex); 1223 1194 1224 for (i=0; i<conf->max_ports && count<*size; ++i) { 1195 1225 if (!conf->ports[i]) … … 1199 1229 ++count; 1200 1230 } 1231 1232 /* Unlock mutex */ 1233 pj_mutex_unlock(conf->mutex); 1201 1234 1202 1235 *size = count; … … 1218 1251 PJ_ASSERT_RETURN(conf && slot<conf->max_ports, PJ_EINVAL); 1219 1252 1253 /* Lock mutex */ 1254 pj_mutex_lock(conf->mutex); 1255 1220 1256 /* Port must be valid. */ 1221 PJ_ASSERT_RETURN(conf->ports[slot] != NULL, PJ_EINVAL);1222 1223 1257 conf_port = conf->ports[slot]; 1258 if (conf_port == NULL) { 1259 pj_mutex_unlock(conf->mutex); 1260 return PJ_EINVAL; 1261 } 1224 1262 1225 1263 if (tx_level != NULL) { … … 1229 1267 if (rx_level != NULL) 1230 1268 *rx_level = conf_port->rx_level; 1269 1270 /* Unlock mutex */ 1271 pj_mutex_unlock(conf->mutex); 1231 1272 1232 1273 return PJ_SUCCESS; … … 1246 1287 PJ_ASSERT_RETURN(conf && slot<conf->max_ports, PJ_EINVAL); 1247 1288 1248 /* Port must be valid. */1249 PJ_ASSERT_RETURN(conf->ports[slot] != NULL, PJ_EINVAL);1250 1251 1289 /* Value must be from -128 to +127 */ 1252 1290 /* Disabled, you can put more than +127, at your own risk: … … 1255 1293 PJ_ASSERT_RETURN(adj_level >= -128, PJ_EINVAL); 1256 1294 1295 /* Lock mutex */ 1296 pj_mutex_lock(conf->mutex); 1297 1298 /* Port must be valid. */ 1257 1299 conf_port = conf->ports[slot]; 1300 if (conf_port == NULL) { 1301 pj_mutex_unlock(conf->mutex); 1302 return PJ_EINVAL; 1303 } 1258 1304 1259 1305 /* Set normalized adjustment level. */ 1260 1306 conf_port->rx_adj_level = adj_level + NORMAL_LEVEL; 1307 1308 /* Unlock mutex */ 1309 pj_mutex_unlock(conf->mutex); 1261 1310 1262 1311 return PJ_SUCCESS; … … 1276 1325 PJ_ASSERT_RETURN(conf && slot<conf->max_ports, PJ_EINVAL); 1277 1326 1278 /* Port must be valid. */1279 PJ_ASSERT_RETURN(conf->ports[slot] != NULL, PJ_EINVAL);1280 1281 1327 /* Value must be from -128 to +127 */ 1282 1328 /* Disabled, you can put more than +127,, at your own risk: … … 1285 1331 PJ_ASSERT_RETURN(adj_level >= -128, PJ_EINVAL); 1286 1332 1333 /* Lock mutex */ 1334 pj_mutex_lock(conf->mutex); 1335 1336 /* Port must be valid. */ 1287 1337 conf_port = conf->ports[slot]; 1338 if (conf_port == NULL) { 1339 pj_mutex_unlock(conf->mutex); 1340 return PJ_EINVAL; 1341 } 1288 1342 1289 1343 /* Set normalized adjustment level. */ 1290 1344 conf_port->tx_adj_level = adj_level + NORMAL_LEVEL; 1345 1346 /* Unlock mutex */ 1347 pj_mutex_unlock(conf->mutex); 1291 1348 1292 1349 return PJ_SUCCESS;
Note: See TracChangeset
for help on using the changeset viewer.