Ignore:
Timestamp:
Mar 15, 2006 8:56:04 PM (18 years ago)
Author:
bennylp
Message:

Tidying up sound device, register PortAudio? error codes, and initial support for stereo sound device (untested)

File:
1 edited

Legend:

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

    r311 r319  
    5454    unsigned                pt;             /**< Payload type.              */ 
    5555    pj_bool_t               paused;         /**< Paused?.                   */ 
    56     pj_snd_stream_info      snd_info;       /**< Sound stream param.        */ 
    57     //pj_snd_stream        *snd_stream;     /**< Sound stream.              */ 
    5856    unsigned                in_pkt_size;    /**< Size of input buffer.      */ 
    5957    void                   *in_pkt;         /**< Input buffer.              */ 
     
    279277 
    280278    /* Number of samples in the frame */ 
    281     ts_len = frame->size / (channel->snd_info.bits_per_sample / 8); 
     279    ts_len = frame->size / 2; 
    282280 
    283281    /* Init frame_out buffer. */ 
     
    565563 
    566564/* 
    567  * Create sound stream parameter from codec attributes. 
    568  */ 
    569 static void init_snd_param( pj_snd_stream_info *snd_param, 
    570                             const pjmedia_codec_param *codec_param) 
    571 { 
    572     pj_memset(snd_param, 0, sizeof(*snd_param)); 
    573  
    574     snd_param->bits_per_sample   = codec_param->pcm_bits_per_sample; 
    575     snd_param->bytes_per_frame   = 2; 
    576     snd_param->frames_per_packet = codec_param->sample_rate *  
    577                                    codec_param->ptime /  
    578                                    1000; 
    579     snd_param->samples_per_frame = 1; 
    580     snd_param->samples_per_sec   = codec_param->sample_rate; 
    581 } 
    582  
    583  
    584 /* 
    585565 * Create media channel. 
    586566 */ 
     
    643623    if (status != PJ_SUCCESS) 
    644624        return status; 
    645  
    646     /* Create and initialize sound device */ 
    647  
    648     init_snd_param(&channel->snd_info, codec_param); 
    649  
    650     /* 
    651     if (dir == PJMEDIA_DIR_ENCODING) 
    652         channel->snd_stream = pj_snd_open_recorder(-1, &channel->snd_info,  
    653                                                    &rec_callback, channel); 
    654     else 
    655         channel->snd_stream = pj_snd_open_player(-1, &channel->snd_info,  
    656                                                  &play_callback, channel); 
    657  
    658     if (!channel->snd_stream) 
    659         return -1; 
    660     */ 
    661625 
    662626    /* Done. */ 
Note: See TracChangeset for help on using the changeset viewer.