Changeset 3999 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_aud.c
- Timestamp:
- Mar 30, 2012 7:10:13 AM (12 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_aud.c
r3982 r3999 27 27 28 28 /***************************************************************************** 29 /*29 * 30 30 * Prototypes 31 31 */ … … 44 44 45 45 /***************************************************************************** 46 /*46 * 47 47 * Call API that are closely tied to PJMEDIA 48 48 */ … … 224 224 225 225 /***************************************************************************** 226 /*226 * 227 227 * Audio media with PJMEDIA backend 228 228 */ … … 807 807 pj_log_push_indent(); 808 808 809 PJSUA_LOCK(); 810 809 811 /* If sound device idle timer is active, cancel it first. */ 810 PJSUA_LOCK();811 812 if (pjsua_var.snd_idle_timer.id) { 812 813 pjsip_endpt_cancel_timer(pjsua_var.endpt, &pjsua_var.snd_idle_timer); 813 814 pjsua_var.snd_idle_timer.id = PJ_FALSE; 814 815 } 815 PJSUA_UNLOCK();816 816 817 817 … … 911 911 !pjsua_var.no_snd) 912 912 { 913 pj_status_t status;914 915 913 status = pjsua_set_snd_dev(pjsua_var.cap_dev, pjsua_var.play_dev); 916 914 if (status != PJ_SUCCESS) { … … 927 925 } 928 926 929 status = pjmedia_conf_connect_port(pjsua_var.mconf, source, sink, 0);930 931 927 on_return: 928 PJSUA_UNLOCK(); 929 930 if (status == PJ_SUCCESS) { 931 status = pjmedia_conf_connect_port(pjsua_var.mconf, source, sink, 0); 932 } 933 932 934 pj_log_pop_indent(); 933 935 return status; … … 1852 1854 pj_log_push_indent(); 1853 1855 1856 PJSUA_LOCK(); 1857 1854 1858 /* Null-sound */ 1855 1859 if (capture_dev==NULL_SND_DEV_ID && playback_dev==NULL_SND_DEV_ID) { 1860 PJSUA_UNLOCK(); 1856 1861 status = pjsua_set_null_snd_dev(); 1857 1862 pj_log_pop_indent(); … … 1904 1909 pjsua_var.snd_is_on = PJ_TRUE; 1905 1910 1911 PJSUA_UNLOCK(); 1906 1912 pj_log_pop_indent(); 1907 1913 return PJ_SUCCESS; 1908 1914 1909 1915 on_error: 1916 PJSUA_UNLOCK(); 1910 1917 pj_log_pop_indent(); 1911 1918 return status; … … 1921 1928 int *playback_dev) 1922 1929 { 1930 PJSUA_LOCK(); 1931 1923 1932 if (capture_dev) { 1924 1933 *capture_dev = pjsua_var.cap_dev; … … 1928 1937 } 1929 1938 1939 PJSUA_UNLOCK(); 1930 1940 return PJ_SUCCESS; 1931 1941 } … … 1943 1953 pj_log_push_indent(); 1944 1954 1955 PJSUA_LOCK(); 1945 1956 1946 1957 /* Close existing sound device */ … … 1970 1981 pjsua_perror(THIS_FILE, "Unable to create null sound device", 1971 1982 status); 1983 PJSUA_UNLOCK(); 1972 1984 pj_log_pop_indent(); 1973 1985 return status; … … 1984 1996 pjsua_var.snd_is_on = PJ_TRUE; 1985 1997 1998 PJSUA_UNLOCK(); 1986 1999 pj_log_pop_indent(); 1987 2000 return PJ_SUCCESS; … … 1995 2008 PJ_DEF(pjmedia_port*) pjsua_set_no_snd_dev(void) 1996 2009 { 2010 PJSUA_LOCK(); 2011 1997 2012 /* Close existing sound device */ 1998 2013 close_snd_dev(); 1999 2000 2014 pjsua_var.no_snd = PJ_TRUE; 2015 2016 PJSUA_UNLOCK(); 2017 2001 2018 return pjmedia_conf_get_master_port(pjsua_var.mconf); 2002 2019 } … … 2008 2025 PJ_DEF(pj_status_t) pjsua_set_ec(unsigned tail_ms, unsigned options) 2009 2026 { 2027 pj_status_t status = PJ_SUCCESS; 2028 2029 PJSUA_LOCK(); 2030 2010 2031 pjsua_var.media_cfg.ec_tail_len = tail_ms; 2011 2032 2012 2033 if (pjsua_var.snd_port) 2013 return pjmedia_snd_port_set_ec( pjsua_var.snd_port, pjsua_var.pool, 2014 tail_ms, options); 2015 2016 return PJ_SUCCESS; 2034 status = pjmedia_snd_port_set_ec(pjsua_var.snd_port, pjsua_var.pool, 2035 tail_ms, options); 2036 2037 PJSUA_UNLOCK(); 2038 return status; 2017 2039 } 2018 2040 … … 2050 2072 return PJMEDIA_EAUD_INVCAP; 2051 2073 } 2074 2075 PJSUA_LOCK(); 2052 2076 2053 2077 /* If sound is active, set it immediately */ … … 2061 2085 } 2062 2086 2063 if (status != PJ_SUCCESS) 2087 if (status != PJ_SUCCESS) { 2088 PJSUA_UNLOCK(); 2064 2089 return status; 2090 } 2065 2091 2066 2092 /* Save in internal param for later device open */ … … 2070 2096 } 2071 2097 2098 PJSUA_UNLOCK(); 2072 2099 return status; 2073 2100 } … … 2079 2106 void *pval) 2080 2107 { 2108 pj_status_t status; 2109 2110 PJSUA_LOCK(); 2111 2081 2112 /* If sound device has never been opened before, open it to 2082 2113 * retrieve the initial setting from the device (e.g. audio … … 2094 2125 2095 2126 strm = pjmedia_snd_port_get_snd_stream(pjsua_var.snd_port); 2096 returnpjmedia_aud_stream_get_cap(strm, cap, pval);2127 status = pjmedia_aud_stream_get_cap(strm, cap, pval); 2097 2128 } else { 2098 2129 /* Otherwise retrieve from internal param */ 2099 return pjmedia_aud_param_get_cap(&pjsua_var.aud_param, 2100 cap, pval); 2101 } 2130 status = pjmedia_aud_param_get_cap(&pjsua_var.aud_param, 2131 cap, pval); 2132 } 2133 2134 PJSUA_UNLOCK(); 2135 return status; 2102 2136 } 2103 2137
Note: See TracChangeset
for help on using the changeset viewer.