Ignore:
Timestamp:
Jan 20, 2007 5:14:24 AM (17 years ago)
Author:
bennylp
Message:

Fixed ticket #70: Frame timestamp not propagated correctly in PJMEDIA

File:
1 edited

Legend:

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

    r864 r887  
    13121312 */ 
    13131313static pj_status_t write_port(pjmedia_conf *conf, struct conf_port *cport, 
    1314                               pj_uint32_t timestamp,  
     1314                              const pj_timestamp *timestamp,  
    13151315                              pjmedia_frame_type *frm_type) 
    13161316{ 
    13171317    pj_int16_t *buf; 
    1318     unsigned j; 
     1318    unsigned j, ts; 
    13191319    pj_status_t status; 
    13201320 
     
    13321332        pjmedia_frame frame; 
    13331333 
     1334        /* Adjust the timestamp */ 
     1335        frame.timestamp.u64 = timestamp->u64 * cport->clock_rate / 
     1336                                conf->clock_rate; 
    13341337        frame.type = PJMEDIA_FRAME_TYPE_NONE; 
    13351338        frame.buf = NULL; 
     
    14581461            frame.buf = (pj_int16_t*)cport->mix_buf; 
    14591462            frame.size = conf->samples_per_frame * BYTES_PER_SAMPLE; 
    1460             frame.timestamp.u64 = timestamp; 
     1463            /* No need to adjust timestamp, port has the same 
     1464             * clock rate as conference bridge  
     1465             */ 
     1466            frame.timestamp = *timestamp; 
    14611467 
    14621468            TRACE_((THIS_FILE, "put_frame %.*s, count=%d",  
     
    14921498    /* Transmit while we have enough frame in the tx_buf. */ 
    14931499    status = PJ_SUCCESS; 
     1500    ts = 0; 
    14941501    while (cport->tx_buf_count >= cport->samples_per_frame && 
    14951502           status == PJ_SUCCESS)  
     
    15061513            frame.buf = cport->tx_buf; 
    15071514            frame.size = cport->samples_per_frame * BYTES_PER_SAMPLE; 
    1508             frame.timestamp.u64 = timestamp; 
     1515            /* Adjust timestamp as port may have different clock rate 
     1516             * than the bridge. 
     1517             */ 
     1518            frame.timestamp.u64 = timestamp->u64 * cport->clock_rate / 
     1519                                  conf->clock_rate; 
     1520 
     1521            /* Add timestamp for individual frame */ 
     1522            frame.timestamp.u64 += ts; 
     1523            ts += cport->samples_per_frame; 
    15091524 
    15101525            TRACE_((THIS_FILE, "put_frame %.*s, count=%d",  
     
    17471762        ++ci; 
    17481763 
    1749         status = write_port( conf, conf_port, frame->timestamp.u32.lo, 
     1764        status = write_port( conf, conf_port, &frame->timestamp, 
    17501765                             &frm_type); 
    17511766        if (status != PJ_SUCCESS) { 
Note: See TracChangeset for help on using the changeset viewer.