- Timestamp:
- Jul 14, 2009 2:33:39 PM (15 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/include/pj/config_site_sample.h
r2821 r2833 223 223 #define PJMEDIA_CONF_USE_SWITCH_BOARD 1 224 224 225 /* Enable APS sound device backend and disable MDA */225 /* Enable APS sound device backend and disable MDA & VAS */ 226 226 #define PJMEDIA_AUDIO_DEV_HAS_SYMB_MDA 0 227 227 #define PJMEDIA_AUDIO_DEV_HAS_SYMB_APS 1 228 #define PJMEDIA_AUDIO_DEV_HAS_SYMB_VAS 0 228 229 229 230 /* Enable passthrough codec framework */ … … 251 252 #define PJMEDIA_CONF_USE_SWITCH_BOARD 1 252 253 253 /* Enable APS sound device backend and disable MDA*/254 /* Enable VAS sound device backend and disable MDA & APS */ 254 255 #define PJMEDIA_AUDIO_DEV_HAS_SYMB_MDA 0 256 #define PJMEDIA_AUDIO_DEV_HAS_SYMB_APS 0 255 257 #define PJMEDIA_AUDIO_DEV_HAS_SYMB_VAS 1 256 258 -
pjproject/trunk/pjmedia/include/pjmedia-audiodev/config.h
r2821 r2833 72 72 #ifndef PJMEDIA_AUDIO_DEV_HAS_SYMB_VAS 73 73 # define PJMEDIA_AUDIO_DEV_HAS_SYMB_VAS 0 74 #endif 75 76 /** 77 * This setting controls Symbian VAS version to be used. Currently, valid 78 * values are only 1 (for VAS 1.0) and 2 (for VAS 2.0). 79 * 80 * Default: 1 (VAS version 1.0) 81 */ 82 #ifndef PJMEDIA_AUDIO_DEV_SYMB_VAS_VERSION 83 # define PJMEDIA_AUDIO_DEV_SYMB_VAS_VERSION 1 74 84 #endif 75 85 -
pjproject/trunk/pjmedia/src/pjmedia-audiodev/symb_vas_dev.cpp
r2821 r2833 313 313 { 314 314 TInt err; 315 const TVersion ver(1, 0, 0); 315 const TVersion ver(1, 0, 0); /* Not really used at this time */ 316 316 317 317 err = CVoIPUtilityFactory::CreateFactory(iFactory); … … 396 396 if (err != KErrNone) 397 397 return err; 398 398 399 err = enc_fmt_if->SetObserver(*this); 400 if (err != KErrNone) 401 return err; 402 399 403 return iVoIPUplink->Open(*this); 400 404 } … … 402 406 TInt CPjAudioEngine::StartPlay() 403 407 { 408 TInt err; 409 404 410 pj_assert(iVoIPDnlink); 405 411 pj_assert(dn_state_ == STATE_READY); … … 408 414 switch (setting_.format) { 409 415 case EG711: 410 //case EG711_10MS:411 416 { 412 417 CVoIPG711DecoderIntfc *g711dec_if = (CVoIPG711DecoderIntfc*) 413 418 dec_fmt_if; 414 g711dec_if->SetMode((CVoIPFormatIntfc::TG711CodecMode) 415 setting_.mode); 419 err = g711dec_if->SetMode((CVoIPFormatIntfc::TG711CodecMode) 420 setting_.mode); 421 pj_assert(err == KErrNone); 416 422 } 417 423 break; … … 421 427 CVoIPILBCDecoderIntfc *ilbcdec_if = (CVoIPILBCDecoderIntfc*) 422 428 dec_fmt_if; 423 ilbcdec_if->SetMode((CVoIPFormatIntfc::TILBCCodecMode) 424 setting_.mode); 429 err = ilbcdec_if->SetMode((CVoIPFormatIntfc::TILBCCodecMode) 430 setting_.mode); 431 pj_assert(err == KErrNone); 425 432 } 426 433 break; … … 434 441 435 442 /* Start player */ 436 TInterr = iVoIPDnlink->Start();443 err = iVoIPDnlink->Start(); 437 444 438 445 if (err == KErrNone) { … … 448 455 TInt CPjAudioEngine::StartRec() 449 456 { 457 TInt err; 458 450 459 pj_assert(iVoIPUplink); 451 460 pj_assert(up_state_ == STATE_READY); 452 461 453 /* Configure general codec setting */454 enc_fmt_if->SetVAD(setting_.vad);455 456 462 /* Configure specific codec setting */ 457 463 switch (setting_.format) { 458 464 case EG711: 459 //case EG711_10MS:460 465 { 461 466 CVoIPG711EncoderIntfc *g711enc_if = (CVoIPG711EncoderIntfc*) 462 467 enc_fmt_if; 463 g711enc_if->SetMode((CVoIPFormatIntfc::TG711CodecMode) 464 setting_.mode); 468 err = g711enc_if->SetMode((CVoIPFormatIntfc::TG711CodecMode) 469 setting_.mode); 470 pj_assert(err == KErrNone); 465 471 } 466 472 break; … … 470 476 CVoIPILBCEncoderIntfc *ilbcenc_if = (CVoIPILBCEncoderIntfc*) 471 477 enc_fmt_if; 472 ilbcenc_if->SetMode((CVoIPFormatIntfc::TILBCCodecMode) 473 setting_.mode); 478 err = ilbcenc_if->SetMode((CVoIPFormatIntfc::TILBCCodecMode) 479 setting_.mode); 480 pj_assert(err == KErrNone); 474 481 } 475 482 break; … … 479 486 } 480 487 488 /* Configure general codec setting */ 489 enc_fmt_if->SetVAD(setting_.vad); 490 481 491 /* Start recorder */ 482 TInterr = iVoIPUplink->Start();492 err = iVoIPUplink->Start(); 483 493 484 494 if (err == KErrNone) { … … 601 611 case MVoIPDownlinkObserver::KOpenComplete: 602 612 if (aError == KErrNone) { 603 State last_state = up_state_;613 State last_state = dn_state_; 604 614 605 615 dn_state_ = STATE_READY; … … 944 954 { 945 955 /* Check if we got a normal or SID frame. */ 946 if (buffer[0] != 0 || buffer[1] != 0) {956 if (buffer[0] != 0) { 947 957 enum { NORMAL_LEN = 22, SID_LEN = 8 }; 948 958 TBitStream *bitstream = (TBitStream*)strm->strm_data; … … 950 960 951 961 pj_assert(src_len == NORMAL_LEN || src_len == SID_LEN); 952 962 953 963 const TDesC8& p = bitstream->CompressG729Frame( 954 964 buffer.Right(src_len), … … 976 986 samples_got = strm->param.ext_fmt.bitrate == 15200? 160 : 240; 977 987 978 /* Check if we got a normal frame. */979 if (buffer[0] == 1 && buffer[1] == 0) {988 /* Check if we got a normal or SID frame. */ 989 if (buffer[0] != 0) { 980 990 const pj_uint8_t *p = (const pj_uint8_t*)buffer.Ptr() + 2; 981 991 unsigned len = buffer.Length() - 2; … … 1126 1136 sid_frame); 1127 1137 if (sid_frame) { 1138 buffer.Append(2); 1128 1139 buffer.Append(0); 1129 buffer.Append(1);1130 1140 } else { 1131 1141 buffer.Append(1); … … 1134 1144 buffer.Append(dst); 1135 1145 } else { 1146 buffer.Append(2); 1136 1147 buffer.Append(0); 1137 buffer.Append(0); 1148 1149 buffer.AppendFill(0, 22); 1138 1150 } 1139 1151 … … 1141 1153 1142 1154 } else { /* PJMEDIA_FRAME_TYPE_NONE */ 1155 buffer.Append(2); 1143 1156 buffer.Append(0); 1144 buffer.Append(0); 1145 1146 frame->samples_cnt = 0; 1147 frame->subframe_cnt = 0; 1157 1158 buffer.AppendFill(0, 22); 1148 1159 } 1149 1160 } … … 1176 1187 buffer.Append((TUint8*)sf->data, sf->bitlen>>3); 1177 1188 } else { 1189 unsigned frame_len; 1190 1191 buffer.Append(1); 1178 1192 buffer.Append(0); 1179 buffer.Append(0); 1193 1194 /* VAS iLBC frame is 20ms or 30ms */ 1195 frame_len = strm->param.ext_fmt.bitrate == 15200? 38 : 50; 1196 buffer.AppendFill(0, frame_len); 1180 1197 } 1181 1198 … … 1183 1200 1184 1201 } else { /* PJMEDIA_FRAME_TYPE_NONE */ 1202 1203 unsigned frame_len; 1204 1205 buffer.Append(1); 1185 1206 buffer.Append(0); 1186 buffer.Append(0); 1187 1188 frame->samples_cnt = 0; 1189 frame->subframe_cnt = 0; 1207 1208 /* VAS iLBC frame is 20ms or 30ms */ 1209 frame_len = strm->param.ext_fmt.bitrate == 15200? 38 : 50; 1210 buffer.AppendFill(0, frame_len); 1211 1190 1212 } 1191 1213 } … … 1289 1311 struct vas_factory *af = (struct vas_factory*)f; 1290 1312 CVoIPUtilityFactory *vas_factory; 1313 CVoIPAudioUplinkStream *vas_uplink; 1314 CVoIPAudioDownlinkStream *vas_dnlink; 1291 1315 RArray<TVoIPCodecFormat> uplink_formats, dnlink_formats; 1292 1316 unsigned ext_fmt_cnt = 0; 1317 TVersion vas_version(1, 0, 0); /* Not really used at this time */ 1293 1318 TInt err; 1294 1319 … … 1312 1337 goto on_error; 1313 1338 1339 /* On VAS 2.0, uplink & downlink stream should be instantiated before 1340 * querying formats. 1341 */ 1342 err = vas_factory->CreateUplinkStream(vas_version, 1343 CVoIPUtilityFactory::EVoIPCall, 1344 vas_uplink); 1345 if (err != KErrNone) 1346 goto on_error; 1347 1348 err = vas_factory->CreateDownlinkStream(vas_version, 1349 CVoIPUtilityFactory::EVoIPCall, 1350 vas_dnlink); 1351 if (err != KErrNone) 1352 goto on_error; 1353 1314 1354 uplink_formats.Reset(); 1315 1355 err = vas_factory->GetSupportedUplinkFormats(uplink_formats); … … 1322 1362 goto on_error; 1323 1363 1364 /* Free the streams, they are just used for querying formats */ 1365 delete vas_uplink; 1366 vas_uplink = NULL; 1367 delete vas_dnlink; 1368 vas_dnlink = NULL; 1369 1324 1370 for (TInt i = 0; i < dnlink_formats.Count(); i++) { 1325 1371 /* Format must be supported by both downlink & uplink. */ … … 1347 1393 1348 1394 case EG711: 1395 #if PJMEDIA_AUDIO_DEV_SYMB_VAS_VERSION==2 1396 case EG711_10MS: 1397 #endif 1349 1398 af->dev_info.ext_fmt[ext_fmt_cnt].id = PJMEDIA_FORMAT_PCMU; 1350 1399 af->dev_info.ext_fmt[ext_fmt_cnt].bitrate = 64000; … … 1541 1590 } 1542 1591 1543 /* Disable VAD on L16, G711, and also G729 (G729's VAD potentially1544 * causesnoise?).1592 /* Disable VAD on L16, G711, iLBC, and also G729 (G729's SID 1593 * potentially cause noise?). 1545 1594 */ 1546 1595 if (strm->param.ext_fmt.id == PJMEDIA_FORMAT_PCMU || 1547 1596 strm->param.ext_fmt.id == PJMEDIA_FORMAT_PCMA || 1548 1597 strm->param.ext_fmt.id == PJMEDIA_FORMAT_L16 || 1598 strm->param.ext_fmt.id == PJMEDIA_FORMAT_ILBC || 1549 1599 strm->param.ext_fmt.id == PJMEDIA_FORMAT_G729) 1550 1600 {
Note: See TracChangeset
for help on using the changeset viewer.