- Timestamp:
- Mar 13, 2007 1:07:37 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/pjproject-0.5-stable/pjmedia/src/pjmedia/sdp_neg.c
r974 r1057 369 369 pjmedia_sdp_media *local) 370 370 { 371 if (pjmedia_sdp_media_find_attr2(remote, "inactive", NULL) != NULL) { 371 pjmedia_dir old_dir = PJMEDIA_DIR_ENCODING_DECODING, 372 new_dir; 373 374 /* Get the media direction of local SDP */ 375 if (pjmedia_sdp_media_find_attr2(local, "sendonly", NULL)) 376 old_dir = PJMEDIA_DIR_ENCODING; 377 else if (pjmedia_sdp_media_find_attr2(local, "recvonly", NULL)) 378 old_dir = PJMEDIA_DIR_DECODING; 379 else if (pjmedia_sdp_media_find_attr2(local, "inactive", NULL)) 380 old_dir = PJMEDIA_DIR_NONE; 381 382 new_dir = old_dir; 383 384 /* Adjust local media direction based on remote media direction */ 385 if (pjmedia_sdp_media_find_attr2(remote, "inactive", NULL) != NULL) { 372 386 /* If remote has "a=inactive", then local is inactive too */ 373 387 374 pjmedia_sdp_attr *a; 375 376 remove_all_media_directions(local); 377 378 a = pjmedia_sdp_attr_create(pool, "inactive", NULL); 379 pjmedia_sdp_media_add_attr(local, a); 388 new_dir = PJMEDIA_DIR_NONE; 380 389 381 390 } else if(pjmedia_sdp_media_find_attr2(remote, "sendonly", NULL) != NULL) { 382 391 /* If remote has "a=sendonly", then set local to "recvonly" if 383 * it is currently "sendrecv". 392 * it is currently "sendrecv". Otherwise if local is NOT "recvonly", 393 * then set local direction to "inactive". 394 */ 395 switch (old_dir) { 396 case PJMEDIA_DIR_ENCODING_DECODING: 397 new_dir = PJMEDIA_DIR_DECODING; 398 break; 399 case PJMEDIA_DIR_DECODING: 400 /* No change */ 401 break; 402 default: 403 new_dir = PJMEDIA_DIR_NONE; 404 break; 405 } 406 407 } else if(pjmedia_sdp_media_find_attr2(remote, "recvonly", NULL) != NULL) { 408 /* If remote has "a=recvonly", then set local to "sendonly" if 409 * it is currently "sendrecv". Otherwise if local is NOT "sendonly", 410 * then set local direction to "inactive" 384 411 */ 385 412 386 pjmedia_sdp_attr *a; 413 switch (old_dir) { 414 case PJMEDIA_DIR_ENCODING_DECODING: 415 new_dir = PJMEDIA_DIR_ENCODING; 416 break; 417 case PJMEDIA_DIR_ENCODING: 418 /* No change */ 419 break; 420 default: 421 new_dir = PJMEDIA_DIR_NONE; 422 break; 423 } 424 425 } else { 426 /* Remote indicates "sendrecv" capability. No change to local 427 * direction 428 */ 429 } 430 431 if (new_dir != old_dir) { 432 pjmedia_sdp_attr *a = NULL; 387 433 388 434 remove_all_media_directions(local); 389 435 390 a = pjmedia_sdp_attr_create(pool, "recvonly", NULL); 391 pjmedia_sdp_media_add_attr(local, a); 392 393 } else if(pjmedia_sdp_media_find_attr2(remote, "recvonly", NULL) != NULL) { 394 /* If remote has "a=recvonly", then set local to "sendonly" if 395 * it is currently "sendrecv". 396 */ 397 398 pjmedia_sdp_attr *a; 399 400 remove_all_media_directions(local); 401 402 a = pjmedia_sdp_attr_create(pool, "sendonly", NULL); 403 pjmedia_sdp_media_add_attr(local, a); 404 405 } else if(pjmedia_sdp_media_find_attr2(remote, "sendrecv", NULL) != NULL) { 406 407 pjmedia_sdp_attr *a; 408 409 remove_all_media_directions(local); 410 411 a = pjmedia_sdp_attr_create(pool, "sendrecv", NULL); 412 pjmedia_sdp_media_add_attr(local, a); 413 414 } else { 415 /* Otherwise remote is set to "sendrecv". 416 */ 417 remove_all_media_directions(local); 436 switch (new_dir) { 437 case PJMEDIA_DIR_NONE: 438 a = pjmedia_sdp_attr_create(pool, "inactive", NULL); 439 break; 440 case PJMEDIA_DIR_ENCODING: 441 a = pjmedia_sdp_attr_create(pool, "sendonly", NULL); 442 break; 443 case PJMEDIA_DIR_DECODING: 444 a = pjmedia_sdp_attr_create(pool, "recvonly", NULL); 445 break; 446 default: 447 /* sendrecv */ 448 break; 449 } 450 451 if (a) { 452 pjmedia_sdp_media_add_attr(local, a); 453 } 418 454 } 419 455 }
Note: See TracChangeset
for help on using the changeset viewer.