Changeset 3135
- Timestamp:
- Apr 7, 2010 1:21:31 PM (15 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/build.symbian/symsndtest.mmp
r3046 r3135 30 30 LIBRARY charconv.lib euser.lib estlib.lib 31 31 LIBRARY esock.lib insock.lib 32 STATICLIBRARY pjlib.lib pjmedia.lib33 32 STATICLIBRARY pjmedia_audiodev.lib 33 STATICLIBRARY pjmedia.lib 34 STATICLIBRARY pjlib.lib 34 35 STATICLIBRARY libresample.lib 35 36 -
pjproject/trunk/pjmedia/include/pjmedia-audiodev/config.h
r3102 r3135 88 88 #ifndef PJMEDIA_AUDIO_DEV_HAS_SYMB_APS 89 89 # define PJMEDIA_AUDIO_DEV_HAS_SYMB_APS 0 90 #endif 91 92 93 /** 94 * This setting controls whether Symbian APS should perform codec 95 * detection in its factory initalization. Note that codec detection 96 * may take few seconds and detecting more codecs will take more time. 97 * Possible values are: 98 * - 0: no codec detection, all APS codec (AMR-NB, G.711, G.729, and 99 * iLBC) will be assumed as supported. 100 * - 1: minimal codec detection, i.e: only detect for AMR-NB and G.711, 101 * (G.729 and iLBC are considered to be supported/unsupported when 102 * G.711 is supported/unsupported). 103 * - 2: full codec detection, i.e: detect AMR-NB, G.711, G.729, and iLBC. 104 * 105 * Default: 1 (minimal codec detection) 106 */ 107 #ifndef PJMEDIA_AUDIO_DEV_SYMB_APS_DETECTS_CODEC 108 # define PJMEDIA_AUDIO_DEV_SYMB_APS_DETECTS_CODEC 1 90 109 #endif 91 110 -
pjproject/trunk/pjmedia/src/pjmedia-audiodev/symb_aps_dev.cpp
r3134 r3135 1294 1294 af->dev_info.output_count = 1; 1295 1295 1296 af->dev_info.ext_fmt_cnt = 5; 1297 1298 af->dev_info.ext_fmt[0].id = PJMEDIA_FORMAT_AMR; 1299 af->dev_info.ext_fmt[0].bitrate = 7400; 1300 af->dev_info.ext_fmt[0].vad = PJ_TRUE; 1301 1302 af->dev_info.ext_fmt[1].id = PJMEDIA_FORMAT_G729; 1303 af->dev_info.ext_fmt[1].bitrate = 8000; 1304 af->dev_info.ext_fmt[1].vad = PJ_FALSE; 1305 1306 af->dev_info.ext_fmt[2].id = PJMEDIA_FORMAT_ILBC; 1307 af->dev_info.ext_fmt[2].bitrate = 13333; 1308 af->dev_info.ext_fmt[2].vad = PJ_TRUE; 1309 1310 af->dev_info.ext_fmt[3].id = PJMEDIA_FORMAT_PCMU; 1311 af->dev_info.ext_fmt[3].bitrate = 64000; 1312 af->dev_info.ext_fmt[3].vad = PJ_FALSE; 1313 1314 af->dev_info.ext_fmt[4].id = PJMEDIA_FORMAT_PCMA; 1315 af->dev_info.ext_fmt[4].bitrate = 64000; 1316 af->dev_info.ext_fmt[4].vad = PJ_FALSE; 1296 /* Enumerate codecs by trying to initialize each codec and examining 1297 * the error code. Consider the following: 1298 * - not possible to reinitialize the same APS session with 1299 * different settings, 1300 * - closing APS session and trying to immediately reconnect may fail, 1301 * clients should wait ~5s before attempting to reconnect. 1302 */ 1303 1304 unsigned i, fmt_cnt = 0; 1305 pj_bool_t g711_supported = PJ_FALSE; 1306 1307 /* Do not change the order! */ 1308 TFourCC fourcc[] = { 1309 TFourCC(KMCPFourCCIdAMRNB), 1310 TFourCC(KMCPFourCCIdG711), 1311 TFourCC(KMCPFourCCIdG729), 1312 TFourCC(KMCPFourCCIdILBC) 1313 }; 1314 1315 for (i = 0; i < PJ_ARRAY_SIZE(fourcc); ++i) { 1316 pj_bool_t supported = PJ_FALSE; 1317 unsigned retry_cnt = 0; 1318 enum { MAX_RETRY = 3 }; 1319 1320 #if (PJMEDIA_AUDIO_DEV_SYMB_APS_DETECTS_CODEC == 0) 1321 /* Codec detection is disabled */ 1322 supported = PJ_TRUE; 1323 #elif (PJMEDIA_AUDIO_DEV_SYMB_APS_DETECTS_CODEC == 1) 1324 /* Minimal codec detection, AMR-NB and G.711 only */ 1325 if (i > 1) { 1326 /* If G.711 has been checked, skip G.729 and iLBC checks */ 1327 retry_cnt = MAX_RETRY; 1328 supported = g711_supported; 1329 } 1330 #endif 1331 1332 while (!supported && ++retry_cnt <= MAX_RETRY) { 1333 RAPSSession iSession; 1334 TAPSInitSettings iPlaySettings; 1335 TAPSInitSettings iRecSettings; 1336 TInt err; 1337 1338 // Recorder settings 1339 iRecSettings.iGlobal = APP_UID; 1340 iRecSettings.iPriority = TMdaPriority(100); 1341 iRecSettings.iPreference = TMdaPriorityPreference(0x05210001); 1342 iRecSettings.iSettings.iChannels = EMMFMono; 1343 iRecSettings.iSettings.iSampleRate = EMMFSampleRate8000Hz; 1344 1345 // Player settings 1346 iPlaySettings.iGlobal = APP_UID; 1347 iPlaySettings.iPriority = TMdaPriority(100); 1348 iPlaySettings.iPreference = TMdaPriorityPreference(0x05220001); 1349 iPlaySettings.iSettings.iChannels = EMMFMono; 1350 iPlaySettings.iSettings.iSampleRate = EMMFSampleRate8000Hz; 1351 1352 iRecSettings.iFourCC = iPlaySettings.iFourCC = fourcc[i]; 1353 1354 err = iSession.Connect(); 1355 if (err == KErrNone) 1356 err = iSession.InitializePlayer(iPlaySettings); 1357 if (err == KErrNone) 1358 err = iSession.InitializeRecorder(iRecSettings); 1359 iSession.Close(); 1360 1361 if (err == KErrNone) { 1362 /* All fine, stop retyring */ 1363 supported = PJ_TRUE; 1364 } else if (err == KErrAlreadyExists && retry_cnt < MAX_RETRY) { 1365 /* Seems that the previous session is still arround, 1366 * let's wait before retrying. 1367 */ 1368 enum { RETRY_WAIT = 3000 }; /* in msecs */ 1369 TTime start, now; 1370 1371 start.UniversalTime(); 1372 do { 1373 pj_symbianos_poll(-1, RETRY_WAIT); 1374 now.UniversalTime(); 1375 } while (now.MicroSecondsFrom(start) < RETRY_WAIT * 1000); 1376 } else { 1377 /* Seems that this format is not supported */ 1378 retry_cnt = MAX_RETRY; 1379 } 1380 } 1381 1382 if (supported) { 1383 switch(i) { 1384 case 0: /* AMRNB */ 1385 af->dev_info.ext_fmt[fmt_cnt].id = PJMEDIA_FORMAT_AMR; 1386 af->dev_info.ext_fmt[fmt_cnt].bitrate = 7400; 1387 af->dev_info.ext_fmt[fmt_cnt].vad = PJ_TRUE; 1388 ++fmt_cnt; 1389 break; 1390 case 1: /* G.711 */ 1391 af->dev_info.ext_fmt[fmt_cnt].id = PJMEDIA_FORMAT_PCMU; 1392 af->dev_info.ext_fmt[fmt_cnt].bitrate = 64000; 1393 af->dev_info.ext_fmt[fmt_cnt].vad = PJ_FALSE; 1394 ++fmt_cnt; 1395 af->dev_info.ext_fmt[fmt_cnt].id = PJMEDIA_FORMAT_PCMA; 1396 af->dev_info.ext_fmt[fmt_cnt].bitrate = 64000; 1397 af->dev_info.ext_fmt[fmt_cnt].vad = PJ_FALSE; 1398 ++fmt_cnt; 1399 g711_supported = PJ_TRUE; 1400 break; 1401 case 2: /* G.729 */ 1402 af->dev_info.ext_fmt[fmt_cnt].id = PJMEDIA_FORMAT_G729; 1403 af->dev_info.ext_fmt[fmt_cnt].bitrate = 8000; 1404 af->dev_info.ext_fmt[fmt_cnt].vad = PJ_FALSE; 1405 ++fmt_cnt; 1406 break; 1407 case 3: /* iLBC */ 1408 af->dev_info.ext_fmt[fmt_cnt].id = PJMEDIA_FORMAT_ILBC; 1409 af->dev_info.ext_fmt[fmt_cnt].bitrate = 13333; 1410 af->dev_info.ext_fmt[fmt_cnt].vad = PJ_TRUE; 1411 ++fmt_cnt; 1412 break; 1413 } 1414 } 1415 } 1317 1416 1417 af->dev_info.ext_fmt_cnt = fmt_cnt; 1418 1318 1419 PJ_LOG(4, (THIS_FILE, "APS initialized")); 1319 1420 -
pjproject/trunk/pjsip-apps/src/symsndtest/app_main.cpp
r3116 r3135 124 124 i, info.name, info.input_count, info.output_count, 125 125 info.default_samples_per_sec)); 126 127 unsigned j; 128 129 /* Print extended formats supported by this audio device */ 130 PJ_LOG(3, (THIS_FILE, " Extended formats supported:")); 131 for (j = 0; j < info.ext_fmt_cnt; ++j) { 132 const char *fmt_name = NULL; 133 134 switch (info.ext_fmt[j].id) { 135 case PJMEDIA_FORMAT_PCMA: 136 fmt_name = "PCMA"; 137 break; 138 case PJMEDIA_FORMAT_PCMU: 139 fmt_name = "PCMU"; 140 break; 141 case PJMEDIA_FORMAT_AMR: 142 fmt_name = "AMR-NB"; 143 break; 144 case PJMEDIA_FORMAT_G729: 145 fmt_name = "G729"; 146 break; 147 case PJMEDIA_FORMAT_ILBC: 148 fmt_name = "ILBC"; 149 break; 150 case PJMEDIA_FORMAT_PCM: 151 fmt_name = "PCM"; 152 break; 153 default: 154 fmt_name = "Unknown"; 155 break; 156 } 157 PJ_LOG(3, (THIS_FILE, " - %s", fmt_name)); 158 } 126 159 } 127 160
Note: See TracChangeset
for help on using the changeset viewer.