Changeset 5426 for pjproject


Ignore:
Timestamp:
Aug 23, 2016 9:13:28 AM (8 years ago)
Author:
ming
Message:

Fixed #1956: Support for setting audio input source capability in Android JNI audio device

Location:
pjproject/trunk/pjmedia
Files:
2 edited

Legend:

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

    r5255 r5426  
    182182 
    183183    /**  
    184      * Support for audio input routing. The value of this capability is an  
    185      * integer containing #pjmedia_aud_dev_route enumeration. 
     184     * Support for audio input routing/source. The value of this capability 
     185     * is an integer containing #pjmedia_aud_dev_route enumeration. 
    186186     */ 
    187187    PJMEDIA_AUD_DEV_CAP_INPUT_ROUTE = 128, 
     188    PJMEDIA_AUD_DEV_CAP_INPUT_SOURCE = 128, 
    188189 
    189190    /**  
     
    237238 
    238239/** 
    239  * This enumeration describes audio routing setting. 
     240 * This enumeration describes audio routing/source setting. 
    240241 */ 
    241242typedef enum pjmedia_aud_dev_route 
    242243{ 
    243244    /** 
    244      * Default route, it is the default audio route of the audio framework 
    245      * backend, as in opening audio device without specifying any route 
    246      * setting or with specifying neutral route setting. 
     245     * Default route/source, it is the default audio route/source of 
     246     * the audio framework backend, as in opening audio device without 
     247     * specifying any route/source setting or with specifying neutral 
     248     * route/source setting. 
    247249     */ 
    248250    PJMEDIA_AUD_DEV_ROUTE_DEFAULT = 0, 
     
    255257 
    256258    /** Route to paired Bluetooth device */ 
    257     PJMEDIA_AUD_DEV_ROUTE_BLUETOOTH = 4 
     259    PJMEDIA_AUD_DEV_ROUTE_BLUETOOTH = 4, 
     260 
     261    /**  
     262     * Custom audio route/source, specific to each audio device 
     263     * backend. 
     264     * 
     265     * For Android JNI audio device, the default is 
     266     * VOICE_COMMUNICATION (7). To change it to another value, set 
     267     * the input source capability of pjmedia_aud_param accordingly. 
     268     * For example: 
     269     *   pjmedia_aud_param_set_cap(&param, PJMEDIA_AUD_DEV_CAP_INPUT_SOURCE, 
     270     *                             // 4 is VOICE_CALL 
     271     *                             PJMEDIA_AUD_DEV_ROUTE_CUSTOM | 4); 
     272     */ 
     273    PJMEDIA_AUD_DEV_ROUTE_CUSTOM = 128 
    258274 
    259275} pjmedia_aud_dev_route; 
     
    300316 
    301317    /**  
    302      * Supported audio device routes, as bitmask combination of  
     318     * Supported audio device routes/sources, as bitmask combination of  
    303319     * #pjmedia_aud_dev_route. The value may be zero if the device 
    304      * does not support audio routing. 
     320     * does not support changing audio routes/sources. 
    305321     */ 
    306322    unsigned routes; 
     
    436452 
    437453    /**  
    438      * Set the audio input route. This setting is optional, and will only be 
    439      * used if PJMEDIA_AUD_DEV_CAP_INPUT_ROUTE is set in the flags. 
     454     * Set the audio input route/source. This setting is optional, and 
     455     * will only be used if PJMEDIA_AUD_DEV_CAP_INPUT_ROUTE/ 
     456     * PJMEDIA_AUD_DEV_CAP_INPUT_SOURCE is set in the flags. 
    440457     */ 
    441458    pjmedia_aud_dev_route input_route; 
  • pjproject/trunk/pjmedia/src/pjmedia-audiodev/android_jni_dev.c

    r5357 r5426  
    484484    pj_ansi_strcpy(info->name, "Android JNI"); 
    485485    info->default_samples_per_sec = 8000; 
    486     info->caps = PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING; 
     486    info->caps = PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING | 
     487                 PJMEDIA_AUD_DEV_CAP_INPUT_SOURCE; 
    487488    info->input_count = 1; 
    488489    info->output_count = 1; 
     490    info->routes = PJMEDIA_AUD_DEV_ROUTE_CUSTOM; 
    489491     
    490492    return PJ_SUCCESS; 
     
    666668        jobject record_obj; 
    667669        int mic_source = 0; /* DEFAULT: default audio source */ 
     670 
     671        if ((param->flags & PJMEDIA_AUD_DEV_CAP_INPUT_SOURCE) && 
     672            (param->input_route & PJMEDIA_AUD_DEV_ROUTE_CUSTOM)) 
     673        { 
     674            mic_source = param->input_route & ~PJMEDIA_AUD_DEV_ROUTE_CUSTOM; 
     675        } 
    668676 
    669677        /* Get pointer to the constructor */ 
Note: See TracChangeset for help on using the changeset viewer.