Ignore:
Timestamp:
Sep 27, 2006 10:49:55 PM (18 years ago)
Author:
bennylp
Message:

Added pjmedia_snd_stream_get_info() function.

NOTE SOUND DEVICE IMPLEMENTORS: YOU'LL NEED TO IMPLEMENT THIS

FUNCTION TOO *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/sound_port.c

    r740 r744  
    125125        if (snd_port->ec_suspended) { 
    126126            snd_port->ec_suspended = PJ_FALSE; 
     127            //pjmedia_echo_state_reset(snd_port->ec_state); 
    127128            PJ_LOG(4,(THIS_FILE, "EC activated")); 
    128129        } 
     
    141142            snd_port->ec_suspended = PJ_TRUE; 
    142143            PJ_LOG(4,(THIS_FILE, "EC suspended because of inactivity")); 
     144        } 
     145        if (snd_port->ec_state) { 
     146            /* To maintain correct delay in EC */ 
     147            pjmedia_echo_playback(snd_port->ec_state, output); 
    143148        } 
    144149    } 
     
    354359 
    355360/* 
    356  * Create sound recorder port. 
     361 * Create sound recorder AEC. 
    357362 */ 
    358363PJ_DEF(pj_status_t) pjmedia_snd_port_create_rec( pj_pool_t *pool, 
     
    457462                                             unsigned options) 
    458463{ 
     464    pjmedia_snd_stream_info si; 
    459465    pj_status_t status; 
    460466 
     
    464470                     PJ_EINVALIDOP); 
    465471 
     472    /* Sound port must have 16bits per sample */ 
     473    PJ_ASSERT_RETURN(snd_port->bits_per_sample == 16, 
     474                     PJ_EINVALIDOP); 
     475 
    466476    /* Destroy AEC */ 
    467477    if (snd_port->ec_state) { 
     
    473483 
    474484    if (tail_ms != 0) { 
     485        unsigned delay_ms; 
     486 
     487        status = pjmedia_snd_stream_get_info(snd_port->snd_stream, &si); 
     488        if (status != PJ_SUCCESS) 
     489            si.rec_latency = si.play_latency = 0; 
     490 
     491        delay_ms = (si.rec_latency + si.play_latency) * 1000 / 
     492                   snd_port->clock_rate; 
    475493        status = pjmedia_echo_create(pool, snd_port->clock_rate,  
    476494                                    snd_port->samples_per_frame,  
Note: See TracChangeset for help on using the changeset viewer.