- Timestamp:
- Dec 19, 2011 5:47:55 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/1.x/pjsip/src/pjsua-lib/pjsua_media.c
r3829 r3913 1985 1985 pjsua_var.snd_idle_timer.id = PJ_FALSE; 1986 1986 } 1987 PJSUA_UNLOCK();1988 1987 1989 1988 … … 2039 2038 if (status != PJ_SUCCESS) { 2040 2039 pjsua_perror(THIS_FILE, "Error opening sound device", status); 2040 PJSUA_UNLOCK(); 2041 2041 return status; 2042 2042 } … … 2052 2052 if (status != PJ_SUCCESS) { 2053 2053 pjsua_perror(THIS_FILE, "Error opening sound device", status); 2054 PJSUA_UNLOCK(); 2054 2055 return status; 2055 2056 } … … 2059 2060 if (status != PJ_SUCCESS) { 2060 2061 pjsua_perror(THIS_FILE, "Error opening sound device", status); 2062 PJSUA_UNLOCK(); 2061 2063 return status; 2062 2064 } … … 2076 2078 if (status != PJ_SUCCESS) { 2077 2079 pjsua_perror(THIS_FILE, "Error opening sound device", status); 2080 PJSUA_UNLOCK(); 2078 2081 return status; 2079 2082 } … … 2082 2085 } 2083 2086 2087 PJSUA_UNLOCK(); 2084 2088 return pjmedia_conf_connect_port(pjsua_var.mconf, source, sink, 0); 2085 2089 } … … 2917 2921 pj_status_t status = -1; 2918 2922 2923 PJSUA_LOCK(); 2924 2919 2925 /* Null-sound */ 2920 2926 if (capture_dev==NULL_SND_DEV_ID && playback_dev==NULL_SND_DEV_ID) { 2927 PJSUA_UNLOCK(); 2921 2928 return pjsua_set_null_snd_dev(); 2922 2929 } … … 2949 2956 alt_cr[i], pjsua_var.media_cfg.channel_count, 2950 2957 samples_per_frame, 16); 2951 if (status != PJ_SUCCESS) 2958 if (status != PJ_SUCCESS) { 2959 PJSUA_UNLOCK(); 2952 2960 return status; 2961 } 2953 2962 2954 2963 /* Open! */ … … 2961 2970 if (status != PJ_SUCCESS) { 2962 2971 pjsua_perror(THIS_FILE, "Unable to open sound device", status); 2972 PJSUA_UNLOCK(); 2963 2973 return status; 2964 2974 } … … 2966 2976 pjsua_var.no_snd = PJ_FALSE; 2967 2977 2978 PJSUA_UNLOCK(); 2968 2979 return PJ_SUCCESS; 2969 2980 } … … 2978 2989 int *playback_dev) 2979 2990 { 2991 PJSUA_LOCK(); 2992 2980 2993 if (capture_dev) { 2981 2994 *capture_dev = pjsua_var.cap_dev; … … 2985 2998 } 2986 2999 3000 PJSUA_UNLOCK(); 3001 2987 3002 return PJ_SUCCESS; 2988 3003 } … … 2997 3012 pj_status_t status; 2998 3013 3014 PJSUA_LOCK(); 3015 2999 3016 /* Close existing sound device */ 3000 3017 close_snd_dev(); … … 3002 3019 /* Create memory pool for sound device. */ 3003 3020 pjsua_var.snd_pool = pjsua_pool_create("pjsua_snd", 4000, 4000); 3004 PJ_ASSERT_ RETURN(pjsua_var.snd_pool, PJ_ENOMEM);3021 PJ_ASSERT_ON_FAIL(pjsua_var.snd_pool, {PJSUA_UNLOCK(); return PJ_ENOMEM;}); 3005 3022 3006 3023 PJ_LOG(4,(THIS_FILE, "Opening null sound device..")); … … 3018 3035 pjsua_perror(THIS_FILE, "Unable to create null sound device", 3019 3036 status); 3037 PJSUA_UNLOCK(); 3020 3038 return status; 3021 3039 } … … 3023 3041 /* Start the master port */ 3024 3042 status = pjmedia_master_port_start(pjsua_var.null_snd); 3025 PJ_ASSERT_ RETURN(status == PJ_SUCCESS, status);3043 PJ_ASSERT_ON_FAIL(status == PJ_SUCCESS, {PJSUA_UNLOCK(); return status;}); 3026 3044 3027 3045 pjsua_var.cap_dev = NULL_SND_DEV_ID; … … 3030 3048 pjsua_var.no_snd = PJ_FALSE; 3031 3049 3050 PJSUA_UNLOCK(); 3032 3051 return PJ_SUCCESS; 3033 3052 } … … 3040 3059 PJ_DEF(pjmedia_port*) pjsua_set_no_snd_dev(void) 3041 3060 { 3061 PJSUA_LOCK(); 3062 3042 3063 /* Close existing sound device */ 3043 3064 close_snd_dev(); 3044 3045 3065 pjsua_var.no_snd = PJ_TRUE; 3066 3067 PJSUA_UNLOCK(); 3068 3046 3069 return pjmedia_conf_get_master_port(pjsua_var.mconf); 3047 3070 } … … 3053 3076 PJ_DEF(pj_status_t) pjsua_set_ec(unsigned tail_ms, unsigned options) 3054 3077 { 3078 pj_status_t status = PJ_SUCCESS; 3079 3080 PJSUA_LOCK(); 3081 3055 3082 pjsua_var.media_cfg.ec_tail_len = tail_ms; 3056 3083 3057 3084 if (pjsua_var.snd_port) 3058 return pjmedia_snd_port_set_ec(pjsua_var.snd_port, pjsua_var.pool,3059 tail_ms, options);3085 status = pjmedia_snd_port_set_ec(pjsua_var.snd_port, pjsua_var.pool, 3086 tail_ms, options); 3060 3087 3061 return PJ_SUCCESS; 3088 PJSUA_UNLOCK(); 3089 return status; 3062 3090 } 3063 3091 … … 3095 3123 return PJMEDIA_EAUD_INVCAP; 3096 3124 } 3125 3126 PJSUA_LOCK(); 3097 3127 3098 3128 /* If sound is active, set it immediately */ … … 3106 3136 } 3107 3137 3108 if (status != PJ_SUCCESS) 3138 if (status != PJ_SUCCESS) { 3139 PJSUA_UNLOCK(); 3109 3140 return status; 3141 } 3110 3142 3111 3143 /* Save in internal param for later device open */ … … 3115 3147 } 3116 3148 3149 PJSUA_UNLOCK(); 3150 3117 3151 return status; 3118 3152 } … … 3124 3158 void *pval) 3125 3159 { 3160 pj_status_t status; 3161 3162 PJSUA_LOCK(); 3163 3126 3164 /* If sound device has never been opened before, open it to 3127 3165 * retrieve the initial setting from the device (e.g. audio … … 3139 3177 3140 3178 strm = pjmedia_snd_port_get_snd_stream(pjsua_var.snd_port); 3141 returnpjmedia_aud_stream_get_cap(strm, cap, pval);3179 status = pjmedia_aud_stream_get_cap(strm, cap, pval); 3142 3180 } else { 3143 3181 /* Otherwise retrieve from internal param */ 3144 return pjmedia_aud_param_get_cap(&pjsua_var.aud_param, 3145 cap, pval); 3146 } 3182 status = pjmedia_aud_param_get_cap(&pjsua_var.aud_param, 3183 cap, pval); 3184 } 3185 3186 PJSUA_UNLOCK(); 3187 return status; 3147 3188 } 3148 3189
Note: See TracChangeset
for help on using the changeset viewer.