Changeset 4243 for pjproject/trunk
- Timestamp:
- Aug 31, 2012 11:42:17 AM (12 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia-audiodev/audiodev.h
r3664 r4243 424 424 */ 425 425 pj_bool_t cng_enabled; 426 427 /** 428 * Enable/disable VAD. This setting is optional, and will only be used 429 * if PJMEDIA_AUD_DEV_CAP_VAD is set in the flags. 430 */ 431 pj_bool_t vad_enabled; 426 432 427 433 } pjmedia_aud_param; -
pjproject/trunk/pjmedia/src/pjmedia-audiodev/symb_aps_dev.cpp
r3841 r4243 974 974 unsigned samples_got; 975 975 976 samples_got = strm->param.ext_fmt.bitrate == 15200? 160 : 240; 976 samples_got = 977 strm->param.ext_fmt.det.aud.avg_bps == 15200? 160 : 240; 977 978 978 979 /* Check if we got a normal frame. */ … … 1172 1173 samples_cnt = frame->samples_cnt / frame->subframe_cnt; 1173 1174 1174 pj_assert((strm->param.ext_fmt. bitrate== 15200 &&1175 pj_assert((strm->param.ext_fmt.det.aud.avg_bps == 15200 && 1175 1176 samples_cnt == 160) || 1176 (strm->param.ext_fmt. bitrate!= 15200 &&1177 (strm->param.ext_fmt.det.aud.avg_bps != 15200 && 1177 1178 samples_cnt == 240)); 1178 1179 … … 1392 1393 1393 1394 if (supported) { 1395 pjmedia_format ext_fmt; 1396 1394 1397 switch(i) { 1395 1398 case 0: /* AMRNB */ 1396 af->dev_info.ext_fmt[fmt_cnt].id = PJMEDIA_FORMAT_AMR; 1397 af->dev_info.ext_fmt[fmt_cnt].bitrate = 7400; 1398 af->dev_info.ext_fmt[fmt_cnt].vad = PJ_TRUE; 1399 pjmedia_format_init_audio(&ext_fmt, PJMEDIA_FORMAT_AMR, 1400 8000, 1, 16, 20, 7400, 12200); 1401 af->dev_info.ext_fmt[fmt_cnt] = ext_fmt; 1402 //af->dev_info.ext_fmt[fmt_cnt].vad = PJ_TRUE; 1399 1403 ++fmt_cnt; 1400 1404 break; 1401 1405 case 1: /* G.711 */ 1402 af->dev_info.ext_fmt[fmt_cnt].id = PJMEDIA_FORMAT_PCMU; 1403 af->dev_info.ext_fmt[fmt_cnt].bitrate = 64000; 1404 af->dev_info.ext_fmt[fmt_cnt].vad = PJ_FALSE; 1406 pjmedia_format_init_audio(&ext_fmt, PJMEDIA_FORMAT_PCMU, 1407 8000, 1, 16, 20, 64000, 64000); 1408 af->dev_info.ext_fmt[fmt_cnt] = ext_fmt; 1409 //af->dev_info.ext_fmt[fmt_cnt].vad = PJ_FALSE; 1405 1410 ++fmt_cnt; 1406 af->dev_info.ext_fmt[fmt_cnt].id = PJMEDIA_FORMAT_PCMA; 1407 af->dev_info.ext_fmt[fmt_cnt].bitrate = 64000; 1408 af->dev_info.ext_fmt[fmt_cnt].vad = PJ_FALSE; 1411 pjmedia_format_init_audio(&ext_fmt, PJMEDIA_FORMAT_PCMA, 1412 8000, 1, 16, 20, 64000, 64000); 1413 af->dev_info.ext_fmt[fmt_cnt] = ext_fmt; 1414 //af->dev_info.ext_fmt[fmt_cnt].vad = PJ_FALSE; 1409 1415 ++fmt_cnt; 1410 1416 g711_supported = PJ_TRUE; 1411 1417 break; 1412 1418 case 2: /* G.729 */ 1413 af->dev_info.ext_fmt[fmt_cnt].id = PJMEDIA_FORMAT_G729; 1414 af->dev_info.ext_fmt[fmt_cnt].bitrate = 8000; 1415 af->dev_info.ext_fmt[fmt_cnt].vad = PJ_FALSE; 1419 pjmedia_format_init_audio(&ext_fmt, PJMEDIA_FORMAT_G729, 1420 8000, 1, 16, 20, 8000, 8000); 1421 af->dev_info.ext_fmt[fmt_cnt] = ext_fmt; 1422 //af->dev_info.ext_fmt[fmt_cnt].vad = PJ_FALSE; 1416 1423 ++fmt_cnt; 1417 1424 break; 1418 1425 case 3: /* iLBC */ 1419 af->dev_info.ext_fmt[fmt_cnt].id = PJMEDIA_FORMAT_ILBC; 1420 af->dev_info.ext_fmt[fmt_cnt].bitrate = 13333; 1421 af->dev_info.ext_fmt[fmt_cnt].vad = PJ_TRUE; 1426 pjmedia_format_init_audio(&ext_fmt, PJMEDIA_FORMAT_ILBC, 1427 8000, 1, 16, 30, 13333, 15200); 1428 af->dev_info.ext_fmt[fmt_cnt] = ext_fmt; 1429 //af->dev_info.ext_fmt[fmt_cnt].vad = PJ_TRUE; 1422 1430 ++fmt_cnt; 1423 1431 break; … … 1571 1579 if (strm->param.ext_fmt.id == PJMEDIA_FORMAT_AMR) 1572 1580 { 1573 aps_setting.mode = (TAPSCodecMode)strm->param.ext_fmt. bitrate;1581 aps_setting.mode = (TAPSCodecMode)strm->param.ext_fmt.det.aud.avg_bps; 1574 1582 } 1575 1583 else if (strm->param.ext_fmt.id == PJMEDIA_FORMAT_PCMU || 1576 1584 strm->param.ext_fmt.id == PJMEDIA_FORMAT_L16 || 1577 1585 (strm->param.ext_fmt.id == PJMEDIA_FORMAT_ILBC && 1578 strm->param.ext_fmt. bitrate!= 15200))1586 strm->param.ext_fmt.det.aud.avg_bps != 15200)) 1579 1587 { 1580 1588 aps_setting.mode = EULawOr30ms; … … 1582 1590 else if (strm->param.ext_fmt.id == PJMEDIA_FORMAT_PCMA || 1583 1591 (strm->param.ext_fmt.id == PJMEDIA_FORMAT_ILBC && 1584 strm->param.ext_fmt. bitrate== 15200))1592 strm->param.ext_fmt.det.aud.avg_bps == 15200)) 1585 1593 { 1586 1594 aps_setting.mode = EALawOr20ms; … … 1597 1605 aps_setting.vad = EFalse; 1598 1606 } else { 1599 aps_setting.vad = strm->param.ext_fmt.vad; 1607 aps_setting.vad = (strm->param.flags & PJMEDIA_AUD_DEV_CAP_VAD) && 1608 strm->param.vad_enabled; 1600 1609 } 1601 1610 1602 1611 /* Set other audio engine attributes. */ 1603 aps_setting.plc = strm->param.plc_enabled; 1612 aps_setting.plc = (strm->param.flags & PJMEDIA_AUD_DEV_CAP_PLC) && 1613 strm->param.plc_enabled; 1604 1614 aps_setting.cng = aps_setting.vad; 1605 1615 aps_setting.loudspk = -
pjproject/trunk/pjmedia/src/pjmedia-audiodev/symb_vas_dev.cpp
r3841 r4243 1016 1016 unsigned samples_got; 1017 1017 1018 samples_got = strm->param.ext_fmt.bitrate == 15200? 160 : 240; 1018 samples_got = 1019 strm->param.ext_fmt.det.aud.avg_bps == 15200? 160 : 240; 1019 1020 1020 1021 /* Check if we got a normal or SID frame. */ … … 1215 1216 samples_cnt = frame->samples_cnt / frame->subframe_cnt; 1216 1217 1217 pj_assert((strm->param.ext_fmt. bitrate== 15200 &&1218 pj_assert((strm->param.ext_fmt.det.aud.avg_bps == 15200 && 1218 1219 samples_cnt == 160) || 1219 (strm->param.ext_fmt. bitrate!= 15200 &&1220 (strm->param.ext_fmt.det.aud.avg_bps != 15200 && 1220 1221 samples_cnt == 240)); 1221 1222 … … 1231 1232 1232 1233 /* VAS iLBC frame is 20ms or 30ms */ 1233 frame_len = strm->param.ext_fmt.bitrate == 15200? 38 : 50; 1234 frame_len = 1235 strm->param.ext_fmt.det.aud.avg_bps == 15200? 38 : 50; 1234 1236 buffer.AppendFill(0, frame_len); 1235 1237 } … … 1245 1247 1246 1248 /* VAS iLBC frame is 20ms or 30ms */ 1247 frame_len = strm->param.ext_fmt.bitrate == 15200? 38 : 50; 1249 frame_len = 1250 strm->param.ext_fmt.det.aud.avg_bps == 15200? 38 : 50; 1248 1251 buffer.AppendFill(0, frame_len); 1249 1252 … … 1409 1412 1410 1413 for (TInt i = 0; i < dnlink_formats.Count(); i++) { 1414 pjmedia_format ext_fmt; 1415 1411 1416 /* Format must be supported by both downlink & uplink. */ 1412 1417 if (uplink_formats.Find(dnlink_formats[i]) == KErrNotFound) … … 1415 1420 switch (dnlink_formats[i]) { 1416 1421 case EAMR_NB: 1417 af->dev_info.ext_fmt[ext_fmt_cnt].id = PJMEDIA_FORMAT_AMR; 1418 af->dev_info.ext_fmt[ext_fmt_cnt].bitrate = 7400; 1419 af->dev_info.ext_fmt[ext_fmt_cnt].vad = PJ_TRUE; 1422 pjmedia_format_init_audio(&ext_fmt, PJMEDIA_FORMAT_AMR, 1423 8000, 1, 16, 20, 7400, 12200); 1424 af->dev_info.ext_fmt[ext_fmt_cnt] = ext_fmt; 1425 //af->dev_info.ext_fmt[ext_fmt_cnt].vad = PJ_TRUE; 1420 1426 break; 1421 1427 1422 1428 case EG729: 1423 af->dev_info.ext_fmt[ext_fmt_cnt].id = PJMEDIA_FORMAT_G729; 1424 af->dev_info.ext_fmt[ext_fmt_cnt].bitrate = 8000; 1425 af->dev_info.ext_fmt[ext_fmt_cnt].vad = PJ_FALSE; 1429 pjmedia_format_init_audio(&ext_fmt, PJMEDIA_FORMAT_G729, 1430 8000, 1, 16, 20, 8000, 8000); 1431 af->dev_info.ext_fmt[ext_fmt_cnt] = ext_fmt; 1432 //af->dev_info.ext_fmt[ext_fmt_cnt].vad = PJ_FALSE; 1426 1433 break; 1427 1434 1428 1435 case EILBC: 1429 af->dev_info.ext_fmt[ext_fmt_cnt].id = PJMEDIA_FORMAT_ILBC; 1430 af->dev_info.ext_fmt[ext_fmt_cnt].bitrate = 13333; 1431 af->dev_info.ext_fmt[ext_fmt_cnt].vad = PJ_TRUE; 1436 pjmedia_format_init_audio(&ext_fmt, PJMEDIA_FORMAT_ILBC, 1437 8000, 1, 16, 30, 13333, 15200); 1438 af->dev_info.ext_fmt[ext_fmt_cnt] = ext_fmt; 1439 //af->dev_info.ext_fmt[ext_fmt_cnt].vad = PJ_TRUE; 1432 1440 break; 1433 1441 … … 1436 1444 case EG711_10MS: 1437 1445 #endif 1438 af->dev_info.ext_fmt[ext_fmt_cnt].id = PJMEDIA_FORMAT_PCMU; 1439 af->dev_info.ext_fmt[ext_fmt_cnt].bitrate = 64000; 1440 af->dev_info.ext_fmt[ext_fmt_cnt].vad = PJ_FALSE; 1446 pjmedia_format_init_audio(&ext_fmt, PJMEDIA_FORMAT_PCMU, 1447 8000, 1, 16, 20, 64000, 64000); 1448 af->dev_info.ext_fmt[ext_fmt_cnt] = ext_fmt; 1449 //af->dev_info.ext_fmt[ext_fmt_cnt].vad = PJ_FALSE; 1441 1450 ++ext_fmt_cnt; 1442 af->dev_info.ext_fmt[ext_fmt_cnt].id = PJMEDIA_FORMAT_PCMA; 1443 af->dev_info.ext_fmt[ext_fmt_cnt].bitrate = 64000; 1444 af->dev_info.ext_fmt[ext_fmt_cnt].vad = PJ_FALSE; 1451 pjmedia_format_init_audio(&ext_fmt, PJMEDIA_FORMAT_PCMA, 1452 8000, 1, 16, 20, 64000, 64000); 1453 af->dev_info.ext_fmt[ext_fmt_cnt] = ext_fmt; 1454 //af->dev_info.ext_fmt[ext_fmt_cnt].vad = PJ_FALSE; 1445 1455 break; 1446 1456 … … 1617 1627 else if (strm->param.ext_fmt.id == PJMEDIA_FORMAT_AMR) 1618 1628 { 1619 vas_setting.mode = strm->param.ext_fmt. bitrate;1629 vas_setting.mode = strm->param.ext_fmt.det.aud.avg_bps; 1620 1630 } 1621 1631 else if (strm->param.ext_fmt.id == PJMEDIA_FORMAT_PCMU) … … 1629 1639 else if (strm->param.ext_fmt.id == PJMEDIA_FORMAT_ILBC) 1630 1640 { 1631 if (strm->param.ext_fmt. bitrate== 15200)1641 if (strm->param.ext_fmt.det.aud.avg_bps == 15200) 1632 1642 vas_setting.mode = CVoIPFormatIntfc::EiLBC20mSecFrame; 1633 1643 else … … 1648 1658 vas_setting.vad = EFalse; 1649 1659 } else { 1650 vas_setting.vad = strm->param.ext_fmt.vad; 1660 vas_setting.vad = (strm->param.flags & PJMEDIA_AUD_DEV_CAP_VAD) && 1661 strm->param.vad_enabled; 1651 1662 } 1652 1663 1653 1664 /* Set other audio engine attributes. */ 1654 vas_setting.plc = strm->param.plc_enabled; 1665 vas_setting.plc = (strm->param.flags & PJMEDIA_AUD_DEV_CAP_PLC) && 1666 strm->param.plc_enabled; 1655 1667 vas_setting.cng = vas_setting.vad; 1656 1668 vas_setting.loudspk = -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_aud.c
r4234 r4243 1573 1573 } 1574 1574 1575 /* VAD settings */ 1576 if (pjsua_var.media_cfg.no_vad) { 1577 param->flags &= ~PJMEDIA_AUD_DEV_CAP_VAD; 1578 } else { 1579 param->flags |= PJMEDIA_AUD_DEV_CAP_VAD; 1580 param->vad_enabled = PJ_TRUE; 1581 } 1582 1575 1583 return PJ_SUCCESS; 1576 1584 }
Note: See TracChangeset
for help on using the changeset viewer.