Ignore:
Timestamp:
Mar 9, 2009 12:55:29 PM (15 years ago)
Author:
bennylp
Message:

PJMEDIA/PJMEDIA-AUDIODEV update:

  • pjmedia.h: re-added inclusion of <sound.h> since we have compat

layer now

  • audiodev.h:
    • added input_vol and output_vol in pjmedia_aud_param, and

implement it on WMME dev

  • added pjmedia_aud_dev_cap_name() to see cap name
  • added pjmedia_aud_param_set_cap() and pjmedia_aud_param_get_cap() to set and get specific capability in param
  • conference.h: exported PJMEDIA_CONF_BRIDGE_SIGNATURE and

PJMEDIA_CONF_SWITCH_SIGNATURE since these are needed by PJSUA-LIB

  • WMME: bug due to addition of input_vol and output_vol in param:

volumes are set in flags in default_param(), but the
fields are not set. This would cause audio volume to be set to
zero for example.

  • WMME: some refactoring, removed duplicate settings in param
  • WMME: bug: setting set in set_cap() is not saved to param, so

get_param() will return wrong setting

  • APS: update because of s/out_route/output_route/ in param
  • APS: same bug as WMME due to addition of input_vol and output_vol in

param: flags are set in param but the fields are not

Location:
pjproject/branches/projects/aps-direct/pjmedia
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia-audiodev/audiodev.h

    r2489 r2492  
    6565    PJMEDIA_AUD_INVALID_DEV = -3 
    6666}; 
    67  
    68  
    69 /**  
    70  * Type for device unique identifier. The unique device ID can be used to save 
    71  * a reference to a particular device across software reboots. 
    72  */ 
    73 typedef pj_uint32_t pjmedia_aud_dev_uid; 
    7467 
    7568 
     
    187180     * PJ_FALSE. 
    188181     */ 
    189     PJMEDIA_AUD_DEV_CAP_PLC = 8192 
     182    PJMEDIA_AUD_DEV_CAP_PLC = 8192, 
    190183     
     184    /** 
     185     * End of capability 
     186     */ 
     187    PJMEDIA_AUD_DEV_CAP_MAX = 16384 
     188 
    191189} pjmedia_aud_dev_cap; 
    192190 
     
    370368    unsigned output_latency_ms; 
    371369 
     370    /** 
     371     * Input volume setting, in percent. This setting is optional, and will  
     372     * only be used if PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING is set in  
     373     * the flags. 
     374     */ 
     375    unsigned input_vol; 
     376 
     377    /** 
     378     * Output volume setting, in percent. This setting is optional, and will  
     379     * only be used if PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING is set in  
     380     * the flags. 
     381     */ 
     382    unsigned output_vol; 
     383 
     384    /**  
     385     * Set the audio input route. This setting is optional, and will only be 
     386     * used if PJMEDIA_AUD_DEV_CAP_INPUT_ROUTE is set in the flags. 
     387     */ 
     388    pjmedia_aud_dev_route input_route; 
     389 
    372390    /**  
    373391     * Set the audio output route. This setting is optional, and will only be 
    374392     * used if PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE is set in the flags. 
    375393     */ 
    376     pjmedia_aud_dev_route out_route; 
     394    pjmedia_aud_dev_route output_route; 
    377395 
    378396    /** 
     
    411429typedef struct pjmedia_aud_dev_factory pjmedia_aud_dev_factory; 
    412430 
     431/** 
     432 * Get string info for the specified capability. 
     433 * 
     434 * @param cap           The capability ID. 
     435 * @param p_desc        Optional pointer which will be filled with longer  
     436 *                      description about the capability. 
     437 * 
     438 * @return              Capability name. 
     439 */ 
     440PJ_DECL(const char*) pjmedia_aud_dev_cap_name(pjmedia_aud_dev_cap cap, 
     441                                              const char **p_desc); 
     442 
     443 
     444/** 
     445 * Set a capability field value in #pjmedia_aud_param structure. This will 
     446 * also set the flags field for the specified capability in the structure. 
     447 * 
     448 * @param param         The structure. 
     449 * @param cap           The audio capability which value is to be set. 
     450 * @param value         Pointer to value. Please see the type of value to 
     451 *                      be supplied in the pjmedia_aud_dev_cap documentation. 
     452 * 
     453 * @return              PJ_SUCCESS on successful operation or the appropriate 
     454 *                      error code. 
     455 */ 
     456PJ_DECL(pj_status_t) pjmedia_aud_param_set_cap(pjmedia_aud_param *param, 
     457                                               pjmedia_aud_dev_cap cap, 
     458                                               const void *pval); 
     459 
     460 
     461/** 
     462 * Get a capability field value from #pjmedia_aud_param structure. This 
     463 * function will return PJMEDIA_EAUD_INVCAP error if the flag for that 
     464 * capability is not set in the flags field in the structure. 
     465 * 
     466 * @param param         The structure. 
     467 * @param cap           The audio capability which value is to be retrieved. 
     468 * @param value         Pointer to value. Please see the type of value to 
     469 *                      be supplied in the pjmedia_aud_dev_cap documentation. 
     470 * 
     471 * @return              PJ_SUCCESS on successful operation or the appropriate 
     472 *                      error code. 
     473 */ 
     474PJ_DECL(pj_status_t) pjmedia_aud_param_get_cap(const pjmedia_aud_param *param, 
     475                                               pjmedia_aud_dev_cap cap, 
     476                                               void *pval); 
    413477 
    414478/** 
     
    444508 */ 
    445509PJ_DECL(pj_status_t) pjmedia_aud_subsys_shutdown(void); 
    446  
    447  
    448 /** 
    449  * Get string info for the specified capability. 
    450  * 
    451  * @param cap           The capability ID. 
    452  * @param p_desc        Optional pointer which will be filled with longer  
    453  *                      description about the capability. 
    454  * 
    455  * @return              Capability name. 
    456  */ 
    457 PJ_DECL(const char*) pjmedia_aud_dev_cap_name(pjmedia_aud_dev_cap cap, 
    458                                               const char **p_desc); 
    459510 
    460511 
     
    549600 * @param cap           The audio capability which value is to be retrieved. 
    550601 * @param value         Pointer to value to be filled in by this function  
    551  *                      once it returns successfully. 
     602 *                      once it returns successfully.  Please see the type  
     603 *                      of value to be supplied in the pjmedia_aud_dev_cap 
     604 *                      documentation. 
    552605 * 
    553606 * @return              PJ_SUCCESS on successful operation or the appropriate 
     
    563616 * @param strm          The audio stream. 
    564617 * @param cap           The audio capability which value is to be set. 
    565  * @param value         Pointer to value. 
     618 * @param value         Pointer to value. Please see the type of value to 
     619 *                      be supplied in the pjmedia_aud_dev_cap documentation. 
    566620 * 
    567621 * @return              PJ_SUCCESS on successful operation or the appropriate 
  • pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia.h

    r2473 r2492  
    5353#include <pjmedia/session.h> 
    5454#include <pjmedia/silencedet.h> 
    55 /* This sound API is deprecated. Please see: 
    56 http://trac.pjsip.org/repos/wiki/Audio_Dev_API 
    57 */ 
    58 #if PJMEDIA_AUDIO_API != PJMEDIA_AUDIO_API_NEW_ONLY 
    5955#include <pjmedia/sound.h> 
    60 #endif 
    6156#include <pjmedia/sound_port.h> 
    6257#include <pjmedia/splitcomb.h> 
  • pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia/conference.h

    r2460 r2492  
    4343 
    4444PJ_BEGIN_DECL 
     45 
     46/** 
     47 * The conference bridge signature in pjmedia_port_info. 
     48 */ 
     49#define PJMEDIA_CONF_BRIDGE_SIGNATURE   \ 
     50                    PJMEDIA_PORT_SIGNATURE('C', 'O', 'N', 'F') 
     51 
     52/** 
     53 * The audio switchboard signature in pjmedia_port_info. 
     54 */ 
     55#define PJMEDIA_CONF_SWITCH_SIGNATURE   \ 
     56                    PJMEDIA_PORT_SIGNATURE('A', 'S', 'W', 'I') 
    4557 
    4658 
  • pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-audiodev/audiodev.c

    r2489 r2492  
    116116} aud_subsys; 
    117117 
     118/* API: get capability name/info */ 
     119PJ_DEF(const char*) pjmedia_aud_dev_cap_name(pjmedia_aud_dev_cap cap, 
     120                                             const char **p_desc) 
     121{ 
     122    const char *desc; 
     123    unsigned i; 
     124 
     125    if (p_desc==NULL) p_desc = &desc; 
     126 
     127    for (i=0; i<PJ_ARRAY_SIZE(cap_infos); ++i) { 
     128        if ((1 << i)==cap) 
     129            break; 
     130    } 
     131 
     132    if (i==32) { 
     133        *p_desc = "??"; 
     134        return "??"; 
     135    } 
     136 
     137    *p_desc = cap_infos[i].info; 
     138    return cap_infos[i].name; 
     139} 
     140 
     141static pj_status_t get_cap_pointer(const pjmedia_aud_param *param, 
     142                                   pjmedia_aud_dev_cap cap, 
     143                                   void **ptr, 
     144                                   unsigned *size) 
     145{ 
     146#define FIELD_INFO(name)    *ptr = (void*)&param->name; \ 
     147                            *size = sizeof(param->name) 
     148 
     149    switch (cap) { 
     150    case PJMEDIA_AUD_DEV_CAP_EXT_FORMAT: 
     151        FIELD_INFO(ext_fmt); 
     152        break; 
     153    case PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY: 
     154        FIELD_INFO(input_latency_ms); 
     155        break; 
     156    case PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY: 
     157        FIELD_INFO(output_latency_ms); 
     158        break; 
     159    case PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING: 
     160        FIELD_INFO(input_vol); 
     161        break; 
     162    case PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING: 
     163        FIELD_INFO(output_vol); 
     164        break; 
     165    case PJMEDIA_AUD_DEV_CAP_INPUT_ROUTE: 
     166        FIELD_INFO(input_route); 
     167        break; 
     168    case PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE: 
     169        FIELD_INFO(output_route); 
     170        break; 
     171    case PJMEDIA_AUD_DEV_CAP_EC: 
     172        FIELD_INFO(ec_enabled); 
     173        break; 
     174    case PJMEDIA_AUD_DEV_CAP_EC_TAIL: 
     175        FIELD_INFO(ec_tail_ms); 
     176        break; 
     177    case PJMEDIA_AUD_DEV_CAP_VAD: 
     178        FIELD_INFO(ext_fmt.vad); 
     179        break; 
     180    case PJMEDIA_AUD_DEV_CAP_CNG: 
     181        FIELD_INFO(cng_enabled); 
     182        break; 
     183    case PJMEDIA_AUD_DEV_CAP_PLC: 
     184        FIELD_INFO(plc_enabled); 
     185        break; 
     186    default: 
     187        return PJMEDIA_EAUD_INVCAP; 
     188    } 
     189 
     190#undef FIELD_INFO 
     191 
     192    return PJ_SUCCESS; 
     193} 
     194 
     195/* API: set cap value to param */ 
     196PJ_DEF(pj_status_t) pjmedia_aud_param_set_cap( pjmedia_aud_param *param, 
     197                                               pjmedia_aud_dev_cap cap, 
     198                                               const void *pval) 
     199{ 
     200    void *cap_ptr; 
     201    unsigned cap_size; 
     202    pj_status_t status; 
     203 
     204    status = get_cap_pointer(param, cap, &cap_ptr, &cap_size); 
     205    if (status != PJ_SUCCESS) 
     206        return status; 
     207 
     208    pj_memcpy(cap_ptr, pval, cap_size); 
     209    param->flags |= cap; 
     210 
     211    return PJ_SUCCESS; 
     212} 
     213 
     214/* API: get cap value from param */ 
     215PJ_DEF(pj_status_t) pjmedia_aud_param_get_cap( const pjmedia_aud_param *param, 
     216                                               pjmedia_aud_dev_cap cap, 
     217                                               void *pval) 
     218{ 
     219    void *cap_ptr; 
     220    unsigned cap_size; 
     221    pj_status_t status; 
     222 
     223    status = get_cap_pointer(param, cap, &cap_ptr, &cap_size); 
     224    if (status != PJ_SUCCESS) 
     225        return status; 
     226 
     227    if ((param->flags & cap) == 0) { 
     228        pj_bzero(cap_ptr, cap_size); 
     229        return PJMEDIA_EAUD_INVCAP; 
     230    } 
     231 
     232    pj_memcpy(pval, cap_ptr, cap_size); 
     233    return PJ_SUCCESS; 
     234} 
    118235 
    119236/* Internal: init driver */ 
     
    292409    aud_subsys.pf = NULL; 
    293410    return PJ_SUCCESS; 
    294 } 
    295  
    296 /* API: get capability name/info */ 
    297 PJ_DEF(const char*) pjmedia_aud_dev_cap_name(pjmedia_aud_dev_cap cap, 
    298                                              const char **p_desc) 
    299 { 
    300     const char *desc; 
    301     unsigned i; 
    302  
    303     if (p_desc==NULL) p_desc = &desc; 
    304  
    305     for (i=0; i<PJ_ARRAY_SIZE(cap_infos); ++i) { 
    306         if ((1 << i)==cap) 
    307             break; 
    308     } 
    309  
    310     if (i==32) { 
    311         *p_desc = "??"; 
    312         return "??"; 
    313     } 
    314  
    315     *p_desc = cap_infos[i].info; 
    316     return cap_infos[i].name; 
    317411} 
    318412 
  • pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-audiodev/symb_aps_dev.cpp

    r2491 r2492  
    12061206    param->samples_per_frame = af->dev_info.default_samples_per_sec * 20 / 1000; 
    12071207    param->bits_per_sample = BITS_PER_SAMPLE; 
    1208     param->flags = af->dev_info.caps; 
     1208    param->flags = PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE; 
    12091209    param->ext_fmt.id = PJMEDIA_FORMAT_L16; 
    1210     param->out_route = PJMEDIA_AUD_DEV_ROUTE_EARPIECE; 
     1210    param->output_route = PJMEDIA_AUD_DEV_ROUTE_EARPIECE; 
    12111211 
    12121212    return PJ_SUCCESS; 
     
    13011301    aps_setting.cng = aps_setting.vad; 
    13021302    aps_setting.loudspk =  
    1303                 strm->param.out_route==PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER; 
     1303                strm->param.output_route==PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER; 
    13041304 
    13051305    /* Set audio engine callbacks. */ 
     
    13761376    case PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE:  
    13771377        if (strm->param.dir & PJMEDIA_DIR_PLAYBACK) { 
    1378             *(pjmedia_aud_dev_route*)pval = strm->param.out_route; 
     1378            *(pjmedia_aud_dev_route*)pval = strm->param.output_route; 
    13791379            status = PJ_SUCCESS; 
    13801380        } 
     
    14501450            } 
    14511451            if (status == PJ_SUCCESS) 
    1452                 strm->param.out_route = r;  
     1452                strm->param.output_route = r;  
    14531453        } 
    14541454        break; 
  • pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-audiodev/wmme_dev.c

    r2489 r2492  
    4848#define THIS_FILE                       "wmme_dev.c" 
    4949 
    50  
    5150/* WMME device info */ 
    5251struct wmme_dev_info 
     
    8180    DWORD         dwBufIdx; 
    8281    DWORD         dwMaxBufIdx; 
    83     unsigned      latency_ms; 
    8482    pj_timestamp  timestamp; 
    8583}; 
     
    8987struct wmme_stream 
    9088{ 
    91     pjmedia_aud_stream   base; 
    92     pjmedia_dir          dir;               /**< Sound direction.      */ 
    93     int                  play_id;           /**< Playback dev id.      */ 
    94     int                  rec_id;            /**< Recording dev id.     */ 
     89    pjmedia_aud_stream   base;              /**< Base stream           */ 
     90    pjmedia_aud_param    param;             /**< Settings              */ 
    9591    pj_pool_t           *pool;              /**< Memory pool.          */ 
    9692 
     
    105101    pjmedia_format_id    fmt_id;            /**< Frame format          */ 
    106102    pj_uint8_t           silence_char;      /**< Silence pattern       */ 
    107     unsigned             clock_rate;        /**< Clock rate.           */ 
    108103    unsigned             bytes_per_frame;   /**< Bytes per frame       */ 
    109     unsigned             samples_per_frame; /**< Samples per frame.    */ 
    110     unsigned             bits_per_sample;   /**< Bits per sample.      */ 
    111     unsigned             channel_count;     /**< Channel count.        */ 
    112104 
    113105    pjmedia_frame_ext   *xfrm;              /**< Extended frame buffer */ 
     
    438430    param->samples_per_frame = di->info.default_samples_per_sec * 20 / 1000; 
    439431    param->bits_per_sample = 16; 
    440     param->flags = di->info.caps; 
     432    param->flags = PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY | 
     433                   PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY; 
    441434    param->input_latency_ms = PJMEDIA_SND_DEFAULT_REC_LATENCY; 
    442435    param->output_latency_ms = PJMEDIA_SND_DEFAULT_PLAY_LATENCY; 
     
    498491 
    499492    if (id == PJMEDIA_FORMAT_L16) 
    500         return "l16"; 
     493        return "PCM"; 
    501494    pj_memcpy(name, &id, 4); 
    502495    name[4] = '\0'; 
     
    686679    eventCount = 0; 
    687680    events[eventCount++] = strm->thread_quit_event; 
    688     if (strm->dir & PJMEDIA_DIR_PLAYBACK) 
     681    if (strm->param.dir & PJMEDIA_DIR_PLAYBACK) 
    689682        events[eventCount++] = strm->play_strm.hEvent; 
    690     if (strm->dir & PJMEDIA_DIR_CAPTURE) 
     683    if (strm->param.dir & PJMEDIA_DIR_CAPTURE) 
    691684        events[eventCount++] = strm->rec_strm.hEvent; 
    692685 
     
    696689     */ 
    697690#if defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE != 0 
    698     if (strm->dir & PJMEDIA_DIR_PLAYBACK) 
     691    if (strm->param.dir & PJMEDIA_DIR_PLAYBACK) 
    699692        CeSetThreadPriority(GetCurrentThread(), 153); 
    700693    else 
     
    834827                if (++wmme_strm->dwBufIdx >= wmme_strm->dwMaxBufIdx) 
    835828                    wmme_strm->dwBufIdx = 0; 
    836                 wmme_strm->timestamp.u64 += strm->samples_per_frame /  
    837                                             strm->channel_count; 
     829                wmme_strm->timestamp.u64 += strm->param.samples_per_frame / 
     830                                            strm->param.channel_count; 
    838831            } 
    839832        } 
     
    914907                    strm->xfrm->samples_cnt = 0; 
    915908                    strm->xfrm->subframe_cnt = 0; 
    916                     pjmedia_frame_ext_append_subframe(strm->xfrm, buffer, 
    917                                                       strm->bytes_per_frame *8, 
    918                                                       strm->samples_per_frame); 
     909                    pjmedia_frame_ext_append_subframe( 
     910                        strm->xfrm, buffer, 
     911                        strm->bytes_per_frame *8, 
     912                        strm->param.samples_per_frame 
     913                    ); 
    919914                } 
    920915 
     
    938933                if (++wmme_strm->dwBufIdx >= wmme_strm->dwMaxBufIdx) 
    939934                    wmme_strm->dwBufIdx = 0; 
    940                 wmme_strm->timestamp.u64 += strm->samples_per_frame /  
    941                                             strm->channel_count; 
     935                wmme_strm->timestamp.u64 += strm->param.samples_per_frame / 
     936                                            strm->param.channel_count; 
    942937            } 
    943938        } 
     
    982977 
    983978    strm = PJ_POOL_ZALLOC_T(pool, struct wmme_stream); 
    984     strm->dir = param->dir; 
    985     strm->play_id = param->play_id; 
    986     strm->rec_id = param->rec_id; 
     979    pj_memcpy(&strm->param, param, sizeof(*param)); 
    987980    strm->pool = pool; 
    988981    strm->rec_cb = rec_cb; 
     
    991984    strm->fmt_id = param->ext_fmt.id; 
    992985    strm->silence_char = silence_char; 
    993     strm->clock_rate = param->clock_rate; 
    994     strm->samples_per_frame = param->samples_per_frame; 
    995     strm->bits_per_sample = param->bits_per_sample; 
    996     strm->channel_count = param->channel_count; 
    997986 
    998987    /* Create player stream */ 
     
    1000989        unsigned buf_count; 
    1001990 
    1002         if (param->flags & PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY) 
    1003             strm->play_strm.latency_ms = param->output_latency_ms; 
    1004         else 
    1005             strm->play_strm.latency_ms = PJMEDIA_SND_DEFAULT_PLAY_LATENCY; 
    1006  
    1007         buf_count = strm->play_strm.latency_ms * param->clock_rate *  
     991        if ((param->flags & PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY)==0) { 
     992            strm->param.flags |= PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY; 
     993            strm->param.output_latency_ms = PJMEDIA_SND_DEFAULT_PLAY_LATENCY; 
     994        } 
     995 
     996        buf_count = strm->param.output_latency_ms * param->clock_rate *  
    1008997                    param->channel_count / param->samples_per_frame / 1000; 
    1009998 
     
    10241013        unsigned buf_count; 
    10251014 
    1026         if (param->flags & PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY) 
    1027             strm->rec_strm.latency_ms = param->input_latency_ms; 
    1028         else 
    1029             strm->rec_strm.latency_ms = PJMEDIA_SND_DEFAULT_REC_LATENCY; 
    1030  
    1031         buf_count = strm->rec_strm.latency_ms * param->clock_rate *  
     1015        if ((param->flags & PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY)==0) { 
     1016            strm->param.flags |= PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY; 
     1017            strm->param.input_latency_ms = PJMEDIA_SND_DEFAULT_REC_LATENCY; 
     1018        } 
     1019 
     1020        buf_count = strm->param.input_latency_ms * param->clock_rate *  
    10321021                    param->channel_count / param->samples_per_frame / 1000; 
    10331022 
     
    10751064    } 
    10761065 
     1066    /* Apply the remaining settings */ 
     1067    if (param->flags & PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING) { 
     1068        stream_set_cap(&strm->base, PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING, 
     1069                       &param->output_vol); 
     1070    } 
     1071 
     1072 
    10771073    /* Done */ 
    10781074    strm->base.op = &stream_op; 
     
    10901086    PJ_ASSERT_RETURN(strm && pi, PJ_EINVAL); 
    10911087 
    1092     pj_bzero(pi, sizeof(*pi)); 
    1093     pi->dir = strm->dir; 
    1094     pi->play_id = strm->play_id; 
    1095     pi->rec_id = strm->rec_id; 
    1096     pi->clock_rate = strm->clock_rate; 
    1097     pi->channel_count = strm->channel_count; 
    1098     pi->samples_per_frame = strm->samples_per_frame; 
    1099     pi->bits_per_sample = strm->bits_per_sample; 
     1088    pj_memcpy(pi, &strm->param, sizeof(*pi)); 
    11001089     
    1101     if (pi->dir & PJMEDIA_DIR_CAPTURE) { 
    1102         pi->flags |= PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY; 
    1103         pi->input_latency_ms = strm->rec_strm.latency_ms; 
    1104     } 
    1105  
    1106     if (pi->dir & PJMEDIA_DIR_PLAYBACK) { 
    1107         /* TODO: report the actual latency? */ 
    1108         pi->flags |= PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY; 
    1109         pi->output_latency_ms = strm->play_strm.latency_ms; 
    1110     } 
    1111  
    11121090    return PJ_SUCCESS; 
    11131091} 
     
    11231101 
    11241102    if (cap==PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY &&  
    1125         (strm->dir & PJMEDIA_DIR_CAPTURE))  
     1103        (strm->param.dir & PJMEDIA_DIR_CAPTURE))  
    11261104    { 
    11271105        /* Recording latency */ 
    1128         *(unsigned*)pval = strm->rec_strm.latency_ms; 
     1106        *(unsigned*)pval = strm->param.input_latency_ms; 
    11291107        return PJ_SUCCESS; 
    11301108    } else if (cap==PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY  &&  
    1131                (strm->dir & PJMEDIA_DIR_PLAYBACK)) 
     1109               (strm->param.dir & PJMEDIA_DIR_PLAYBACK)) 
    11321110    { 
    11331111        /* Playback latency */ 
    1134         *(unsigned*)pval = strm->play_strm.latency_ms; 
     1112        *(unsigned*)pval = strm->param.output_latency_ms; 
    11351113        return PJ_SUCCESS; 
    11361114    } else if (cap==PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING && 
     
    11381116    { 
    11391117        /* Output volume setting */ 
    1140         DWORD dwVol; 
     1118        DWORD waveVol; 
    11411119        MMRESULT mr; 
    11421120 
    1143         mr = waveOutGetVolume(strm->play_strm.hWave.Out, &dwVol); 
     1121        mr = waveOutGetVolume(strm->play_strm.hWave.Out, &waveVol); 
    11441122        if (mr != MMSYSERR_NOERROR) { 
    11451123            return PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_OUT(mr); 
    11461124        } 
    11471125 
    1148         dwVol &= 0xFFFF; 
    1149         *(unsigned*)pval = (dwVol * 100) / 0xFFFF; 
     1126        waveVol &= 0xFFFF; 
     1127        *(unsigned*)pval = (waveVol * 100) / 0xFFFF; 
    11501128        return PJ_SUCCESS; 
    11511129    } else { 
     
    11671145    { 
    11681146        /* Output volume setting */ 
    1169         DWORD dwVol; 
     1147        unsigned vol = *(unsigned*)pval; 
     1148        DWORD waveVol; 
    11701149        MMRESULT mr; 
    1171  
    1172         dwVol = ((*(unsigned*)pval) * 0xFFFF) / 100; 
    1173         dwVol |= (dwVol << 16); 
    1174  
    1175         mr = waveOutSetVolume(strm->play_strm.hWave.Out, dwVol); 
    1176         return (mr==MMSYSERR_NOERROR)? PJ_SUCCESS :  
     1150        pj_status_t status; 
     1151 
     1152        if (vol > 100) 
     1153            vol = 100; 
     1154 
     1155        waveVol = (vol * 0xFFFF) / 100; 
     1156        waveVol |= (waveVol << 16); 
     1157 
     1158        mr = waveOutSetVolume(strm->play_strm.hWave.Out, waveVol); 
     1159        status = (mr==MMSYSERR_NOERROR)? PJ_SUCCESS :  
    11771160                                PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_OUT(mr); 
     1161        if (status == PJ_SUCCESS) { 
     1162            strm->param.output_vol = *(unsigned*)pval; 
     1163        } 
     1164        return status; 
    11781165    } 
    11791166 
  • pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/conf_switch.c

    r2472 r2492  
    4646#define THIS_FILE           "conf_switch.c" 
    4747 
    48 #define SIGNATURE           PJMEDIA_PORT_SIGNATURE('S', 'W', 'T', 'C') 
     48#define SIGNATURE           PJMEDIA_CONF_SWITCH_SIGNATURE 
    4949#define SIGNATURE_PORT      PJMEDIA_PORT_SIGNATURE('S', 'W', 'T', 'P') 
    5050#define NORMAL_LEVEL        128 
  • pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/conference.c

    r2468 r2492  
    6565#define BYTES_PER_SAMPLE    2 
    6666 
    67 #define SIGNATURE           PJMEDIA_PORT_SIGNATURE('C', 'O', 'N', 'F') 
     67#define SIGNATURE           PJMEDIA_CONF_BRIDGE_SIGNATURE 
    6868#define SIGNATURE_PORT      PJMEDIA_PORT_SIGNATURE('C', 'O', 'N', 'P') 
    6969/* Normal level is hardcodec to 128 in all over places */ 
Note: See TracChangeset for help on using the changeset viewer.