- Timestamp:
- Jul 14, 2011 4:42:18 AM (13 years ago)
- Location:
- pjproject/branches/projects/2.0-dev/pjsip/src/pjsua-lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjsip/src/pjsua-lib/pjsua_call.c
r3629 r3639 1433 1433 *p_type = pjsua_var.calls[call_id].rem_nat_type; 1434 1434 return PJ_SUCCESS; 1435 } 1436 1437 1438 /* 1439 * Get media stream info for the specified media index. 1440 */ 1441 PJ_DEF(pj_status_t) pjsua_call_get_stream_info( pjsua_call_id call_id, 1442 unsigned med_idx, 1443 pjsua_stream_info *psi) 1444 { 1445 pjsua_call *call; 1446 pjsua_call_media *call_med; 1447 pj_status_t status; 1448 1449 PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls, 1450 PJ_EINVAL); 1451 PJ_ASSERT_RETURN(psi, PJ_EINVAL); 1452 1453 PJSUA_LOCK(); 1454 1455 call = &pjsua_var.calls[call_id]; 1456 1457 if (med_idx >= call->med_cnt) { 1458 PJSUA_UNLOCK(); 1459 return PJ_EINVAL; 1460 } 1461 1462 call_med = &call->media[med_idx]; 1463 psi->type = call_med->type; 1464 switch (call_med->type) { 1465 case PJMEDIA_TYPE_AUDIO: 1466 status = pjmedia_stream_get_info(call_med->strm.a.stream, 1467 &psi->info.aud); 1468 break; 1469 case PJMEDIA_TYPE_VIDEO: 1470 status = pjmedia_vid_stream_get_info(call_med->strm.v.stream, 1471 &psi->info.vid); 1472 break; 1473 default: 1474 status = PJMEDIA_EINVALIMEDIATYPE; 1475 break; 1476 } 1477 1478 PJSUA_UNLOCK(); 1479 return status; 1480 } 1481 1482 1483 /* 1484 * Get media stream statistic for the specified media index. 1485 */ 1486 PJ_DEF(pj_status_t) pjsua_call_get_stream_stat( pjsua_call_id call_id, 1487 unsigned med_idx, 1488 pjsua_stream_stat *stat) 1489 { 1490 pjsua_call *call; 1491 pjsua_call_media *call_med; 1492 pj_status_t status; 1493 1494 PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls, 1495 PJ_EINVAL); 1496 PJ_ASSERT_RETURN(stat, PJ_EINVAL); 1497 1498 PJSUA_LOCK(); 1499 1500 call = &pjsua_var.calls[call_id]; 1501 1502 if (med_idx >= call->med_cnt) { 1503 PJSUA_UNLOCK(); 1504 return PJ_EINVAL; 1505 } 1506 1507 call_med = &call->media[med_idx]; 1508 switch (call_med->type) { 1509 case PJMEDIA_TYPE_AUDIO: 1510 status = pjmedia_stream_get_stat(call_med->strm.a.stream, 1511 &stat->rtcp); 1512 if (status == PJ_SUCCESS) 1513 status = pjmedia_stream_get_stat_jbuf(call_med->strm.a.stream, 1514 &stat->jbuf); 1515 break; 1516 case PJMEDIA_TYPE_VIDEO: 1517 status = pjmedia_vid_stream_get_stat(call_med->strm.v.stream, 1518 &stat->rtcp); 1519 if (status == PJ_SUCCESS) 1520 status = pjmedia_vid_stream_get_stat_jbuf(call_med->strm.v.stream, 1521 &stat->jbuf); 1522 break; 1523 default: 1524 status = PJMEDIA_EINVALIMEDIATYPE; 1525 break; 1526 } 1527 1528 PJSUA_UNLOCK(); 1529 return status; 1530 } 1531 1532 1533 /* 1534 * Get media transport info for the specified media index. 1535 */ 1536 PJ_DEF(pj_status_t) pjsua_call_get_transport_info( pjsua_call_id call_id, 1537 unsigned med_idx, 1538 pjmedia_transport_info *t) 1539 { 1540 pjsua_call *call; 1541 pjsua_call_media *call_med; 1542 pj_status_t status; 1543 1544 PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls, 1545 PJ_EINVAL); 1546 PJ_ASSERT_RETURN(t, PJ_EINVAL); 1547 1548 PJSUA_LOCK(); 1549 1550 call = &pjsua_var.calls[call_id]; 1551 1552 if (med_idx >= call->med_cnt) { 1553 PJSUA_UNLOCK(); 1554 return PJ_EINVAL; 1555 } 1556 1557 call_med = &call->media[med_idx]; 1558 1559 pjmedia_transport_info_init(t); 1560 status = pjmedia_transport_get_info(call_med->tp, t); 1561 1562 PJSUA_UNLOCK(); 1563 return status; 1435 1564 } 1436 1565 -
pjproject/branches/projects/2.0-dev/pjsip/src/pjsua-lib/pjsua_vid.c
r3638 r3639 1589 1589 1590 1590 1591 /* 1592 * Get the media stream index of the default video stream in the call. 1593 */ 1594 PJ_DEF(int) pjsua_call_get_vid_stream_idx(pjsua_call_id call_id) 1595 { 1596 pjsua_call *call; 1597 int first_active, first_inactive; 1598 1599 PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls, 1600 PJ_EINVAL); 1601 1602 PJSUA_LOCK(); 1603 call = &pjsua_var.calls[call_id]; 1604 call_get_vid_strm_info(call, &first_active, &first_inactive, NULL, NULL); 1605 PJSUA_UNLOCK(); 1606 1607 if (first_active == -1) 1608 return first_inactive; 1609 1610 return first_active; 1611 } 1612 1613 1591 1614 #endif /* PJSUA_HAS_VIDEO */ 1592 1615
Note: See TracChangeset
for help on using the changeset viewer.