- Timestamp:
- Apr 9, 2007 7:06:08 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/split-3rd-party/pjmedia/src/pjmedia/g711.c
r974 r1177 33 33 #if defined(PJMEDIA_HAS_G711_CODEC) && PJMEDIA_HAS_G711_CODEC!=0 34 34 35 /* We removed PLC in 0.6 */ 36 #define PLC_DISABLED 1 37 35 38 36 39 #define G711_BPS 64000 … … 81 84 unsigned output_buf_len, 82 85 struct pjmedia_frame *output); 86 #if !PLC_DISABLED 83 87 static pj_status_t g711_recover( pjmedia_codec *codec, 84 88 unsigned output_buf_len, 85 89 struct pjmedia_frame *output); 90 #endif 86 91 87 92 /* Definition for G711 codec operations. */ … … 95 100 &g711_encode, 96 101 &g711_decode, 102 #if !PLC_DISABLED 97 103 &g711_recover 104 #else 105 NULL 106 #endif 98 107 }; 99 108 … … 122 131 { 123 132 unsigned pt; 133 #if !PLC_DISABLED 124 134 pj_bool_t plc_enabled; 125 135 pjmedia_plc *plc; 136 #endif 126 137 pj_bool_t vad_enabled; 127 138 pjmedia_silence_det *vad; … … 250 261 attr->setting.frm_per_pkt = 2; 251 262 263 #if !PLC_DISABLED 252 264 /* Enable plc by default. */ 253 265 attr->setting.plc = 1; 266 #endif 254 267 255 268 /* Enable VAD by default. */ … … 318 331 codec_priv->pt = id->pt; 319 332 333 #if !PLC_DISABLED 320 334 /* Create PLC, always with 10ms ptime */ 321 335 status = pjmedia_plc_create(g711_factory.pool, 8000, 80, … … 325 339 return status; 326 340 } 341 #endif 327 342 328 343 /* Create VAD */ … … 358 373 { 359 374 struct g711_private *priv = codec->codec_data; 360 pj_int16_t frame[SAMPLES_PER_FRAME];361 375 int i; 362 376 … … 369 383 } 370 384 385 #if !PLC_DISABLED 371 386 /* Clear left samples in the PLC, since codec+plc will be reused 372 387 * next time. 373 388 */ 374 389 for (i=0; i<2; ++i) { 390 pj_int16_t frame[SAMPLES_PER_FRAME]; 375 391 pjmedia_zero_samples(frame, PJ_ARRAY_SIZE(frame)); 376 392 pjmedia_plc_save(priv->plc, frame); 377 393 } 394 #else 395 PJ_UNUSED_ARG(i); 396 PJ_UNUSED_ARG(priv); 397 #endif 378 398 379 399 /* Lock mutex. */ … … 403 423 struct g711_private *priv = codec->codec_data; 404 424 priv->pt = attr->info.pt; 425 #if !PLC_DISABLED 405 426 priv->plc_enabled = (attr->setting.plc != 0); 427 #endif 406 428 priv->vad_enabled = (attr->setting.vad != 0); 407 429 return PJ_SUCCESS; … … 423 445 return PJMEDIA_EINVALIDPT; 424 446 447 #if !PLC_DISABLED 425 448 priv->plc_enabled = (attr->setting.plc != 0); 449 #endif 426 450 priv->vad_enabled = (attr->setting.vad != 0); 427 451 … … 562 586 output->size = (input->size << 1); 563 587 588 #if !PLC_DISABLED 564 589 if (priv->plc_enabled) 565 590 pjmedia_plc_save( priv->plc, output->buf); 566 567 return PJ_SUCCESS; 568 } 569 591 #endif 592 593 return PJ_SUCCESS; 594 } 595 596 #if !PLC_DISABLED 570 597 static pj_status_t g711_recover( pjmedia_codec *codec, 571 598 unsigned output_buf_len, … … 585 612 return PJ_SUCCESS; 586 613 } 614 #endif 587 615 588 616 #endif /* PJMEDIA_HAS_G711_CODEC */
Note: See TracChangeset
for help on using the changeset viewer.