Changeset 322


Ignore:
Timestamp:
Mar 16, 2006 7:03:07 PM (18 years ago)
Author:
bennylp
Message:

Support for stereo audio (or N audio channels, for that matter)

Location:
pjproject/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/conference.h

    r312 r322  
    7676 *                          is also used to set the sampling rate of the 
    7777 *                          sound device. 
     78 * @param channel_count     Number of channels in the PCM stream. Normally 
     79 *                          the value will be 1 for mono, but application may 
     80 *                          specify a value of 2 for stereo. Note that all 
     81 *                          ports that will be connected to the bridge MUST  
     82 *                          have the same number of channels as the bridge. 
    7883 * @param samples_per_frame Set the number of samples per frame. This value 
    7984 *                          is also used to set the sound device. 
     
    9196                                          unsigned max_slots, 
    9297                                          unsigned sampling_rate, 
     98                                          unsigned channel_count, 
    9399                                          unsigned samples_per_frame, 
    94100                                          unsigned bits_per_sample, 
  • pjproject/trunk/pjmedia/include/pjmedia/null_port.h

    r318 r322  
    3434 * 
    3535 * @param sampling_rate         Sampling rate of the port. 
     36 * @param channel_count         Number of channels. 
    3637 * @param samples_per_frame     Number of samples per frame. 
    3738 * @param bits_per_sample       Number of bits per sample. 
     
    4243PJ_DECL(pj_status_t) pjmedia_null_port_create( pj_pool_t *pool, 
    4344                                               unsigned sampling_rate, 
     45                                               unsigned channel_count, 
    4446                                               unsigned samples_per_frame, 
    4547                                               unsigned bits_per_sample, 
  • pjproject/trunk/pjmedia/src/pjmedia/conference.c

    r321 r322  
    137137    struct conf_port    **ports;        /**< Array of ports.                */ 
    138138    pj_uint16_t          *uns_buf;      /**< Buf for unsigned conversion    */ 
    139     unsigned              clock_rate;   /**< Sampling rate.         */ 
     139    unsigned              clock_rate;   /**< Sampling rate.                 */ 
     140    unsigned              channel_count;/**< Number of channels (1=mono).   */ 
    140141    unsigned              samples_per_frame;    /**< Samples per frame.     */ 
    141142    unsigned              bits_per_sample;      /**< Bits per sample.       */ 
     
    323324                                         unsigned max_ports, 
    324325                                         unsigned clock_rate, 
     326                                         unsigned channel_count, 
    325327                                         unsigned samples_per_frame, 
    326328                                         unsigned bits_per_sample, 
     
    493495 
    494496    PJ_ASSERT_RETURN(conf && pool && strm_port && port_name, PJ_EINVAL); 
     497 
     498    /* For this version of PJMEDIA, port MUST have the same number of 
     499     * PCM channels. 
     500     */ 
     501    if (strm_port->info.channel_count != conf->channel_count) { 
     502        pj_assert(!"Number of channels mismatch"); 
     503        return PJMEDIA_ENCCHANNEL; 
     504    } 
    495505 
    496506    pj_mutex_lock(conf->mutex); 
  • pjproject/trunk/pjmedia/src/pjmedia/file_port.c

    r288 r322  
    201201 
    202202    if (wave_hdr.fmt_hdr.fmt_tag != 1 || 
    203         wave_hdr.fmt_hdr.nchan != 1 || 
    204203        wave_hdr.fmt_hdr.bits_per_sample != 16 || 
    205204        wave_hdr.fmt_hdr.block_align != 2) 
     
    225224 
    226225    /* Update port info. */ 
     226    fport->base.info.channel_count = wave_hdr.fmt_hdr.nchan; 
    227227    fport->base.info.sample_rate = wave_hdr.fmt_hdr.sample_rate; 
    228228    fport->base.info.bits_per_sample = wave_hdr.fmt_hdr.bits_per_sample; 
  • pjproject/trunk/pjmedia/src/pjmedia/null_port.c

    r318 r322  
    3333PJ_DEF(pj_status_t) pjmedia_null_port_create( pj_pool_t *pool, 
    3434                                              unsigned sampling_rate, 
     35                                              unsigned channel_count, 
    3536                                              unsigned samples_per_frame, 
    3637                                              unsigned bits_per_sample, 
     
    5354    port->info.sample_rate = sampling_rate; 
    5455    port->info.samples_per_frame = samples_per_frame; 
     56    port->info.channel_count = channel_count; 
    5557    port->info.signature = 0x2411; 
    5658    port->info.type = PJMEDIA_TYPE_AUDIO; 
  • pjproject/trunk/pjmedia/src/pjmedia/stream.c

    r321 r322  
    660660    stream->port.info.pt = info->fmt.pt; 
    661661    pj_strdup(pool, &stream->port.info.encoding_name, &info->fmt.encoding_name); 
     662    stream->port.info.channel_count = 1; 
    662663    stream->port.info.sample_rate = info->fmt.sample_rate; 
    663664    stream->port.user_data = stream; 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r321 r322  
    761761                                 pjsua.max_calls+PJSUA_CONF_MORE_PORTS,  
    762762                                 pjsua.clock_rate,  
     763                                 1, /* mono */ 
    763764                                 pjsua.clock_rate * 20 / 1000, 16,  
    764765                                 options, 
     
    774775    /* Add NULL port to the bridge. */ 
    775776    status = pjmedia_null_port_create( pjsua.pool, pjsua.clock_rate,  
     777                                       1, /* mono */ 
    776778                                       pjsua.clock_rate * 20 / 1000, 16, 
    777779                                       &pjsua.null_port); 
Note: See TracChangeset for help on using the changeset viewer.