Changeset 888 for pjproject/trunk/pjmedia/src/pjmedia-codec/gsm.c
- Timestamp:
- Jan 20, 2007 5:18:14 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-codec/gsm.c
r874 r888 120 120 pj_bool_t vad_enabled; 121 121 pjmedia_silence_det *vad; 122 pj_timestamp last_tx; 122 123 }; 123 124 … … 366 367 } 367 368 369 /* Re-init silence_period */ 370 pj_set_timestamp32(&gsm_data->last_tx, 0, 0); 371 368 372 /* Put in the free list. */ 369 373 pj_mutex_lock(gsm_codec_factory.mutex); … … 498 502 return PJMEDIA_CODEC_EFRMTOOSHORT; 499 503 500 if (input->size < 320) 501 return PJMEDIA_CODEC_EPCMTOOSHORT; 504 PJ_ASSERT_RETURN(input->size==320, PJMEDIA_CODEC_EPCMFRMINLEN); 502 505 503 506 /* Detect silence */ 504 507 if (gsm_data->vad_enabled) { 505 508 pj_bool_t is_silence; 509 pj_int32_t silence_duration; 510 511 silence_duration = pj_timestamp_diff32(&gsm_data->last_tx, 512 &input->timestamp); 506 513 507 514 is_silence = pjmedia_silence_det_detect(gsm_data->vad, 508 515 input->buf, 509 input->size / 2,516 (input->size >> 1), 510 517 NULL); 511 if (is_silence) { 518 if (is_silence && 519 PJMEDIA_CODEC_MAX_SILENCE_PERIOD != -1 && 520 silence_duration < PJMEDIA_CODEC_MAX_SILENCE_PERIOD) 521 { 512 522 output->type = PJMEDIA_FRAME_TYPE_NONE; 513 523 output->buf = NULL; 514 524 output->size = 0; 515 output->timestamp .u64 = input->timestamp.u64;525 output->timestamp = input->timestamp; 516 526 return PJ_SUCCESS; 527 } else { 528 gsm_data->last_tx = input->timestamp; 517 529 } 518 530 }
Note: See TracChangeset
for help on using the changeset viewer.