Changeset 5969 for pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp
- Timestamp:
- Apr 15, 2019 10:52:16 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp
r5964 r5969 978 978 void Endpoint::on_buddy_state(pjsua_buddy_id buddy_id) 979 979 { 980 Buddy *buddy = (Buddy*)pjsua_buddy_get_user_data(buddy_id); 980 Buddy b(buddy_id); 981 Buddy *buddy = b.getOriginalInstance(); 981 982 if (!buddy || !buddy->isValid()) { 982 983 /* Ignored */ … … 993 994 PJ_UNUSED_ARG(sub); 994 995 995 Buddy *buddy = (Buddy*)pjsua_buddy_get_user_data(buddy_id); 996 Buddy b(buddy_id); 997 Buddy *buddy = b.getOriginalInstance(); 996 998 if (!buddy || !buddy->isValid()) { 997 999 /* Ignored */ … … 2045 2047 } 2046 2048 2049 AudioMediaVector2 Endpoint::mediaEnumPorts2() const throw(Error) 2050 { 2051 AudioMediaVector2 amv2; 2052 pjsua_conf_port_id ids[PJSUA_MAX_CONF_PORTS]; 2053 unsigned i, count = PJSUA_MAX_CONF_PORTS; 2054 2055 PJSUA2_CHECK_EXPR( pjsua_enum_conf_ports(ids, &count) ); 2056 for (i = 0; i < count; ++i) { 2057 AudioMedia am; 2058 am.id = ids[i]; 2059 amv2.push_back(am); 2060 } 2061 2062 return amv2; 2063 } 2064 2047 2065 void Endpoint::mediaAdd(AudioMedia &media) 2048 2066 { 2067 /* mediaList serves mediaEnumPorts() only, once mediaEnumPorts() 2068 * is removed, this function implementation should be no-op. 2069 */ 2049 2070 pj_mutex_lock(mediaListMutex); 2050 2071 … … 2060 2081 void Endpoint::mediaRemove(AudioMedia &media) 2061 2082 { 2083 /* mediaList serves mediaEnumPorts() only, once mediaEnumPorts() 2084 * is removed, this function implementation should be no-op. 2085 */ 2062 2086 pj_mutex_lock(mediaListMutex); 2063 2087 AudioMediaVector::iterator it = std::find(mediaList.begin(), … … 2067 2091 if (it != mediaList.end()) 2068 2092 mediaList.erase(it); 2069 2070 2093 pj_mutex_unlock(mediaListMutex); 2071 2094 } … … 2073 2096 bool Endpoint::mediaExists(const AudioMedia &media) const 2074 2097 { 2075 bool exists; 2076 2077 pj_mutex_lock(mediaListMutex); 2078 AudioMediaVector::const_iterator it = std::find(mediaList.begin(), 2079 mediaList.end(), 2080 &media); 2081 exists = (it != mediaList.end()); 2082 pj_mutex_unlock(mediaListMutex); 2083 return exists; 2098 pjsua_conf_port_id id = media.getPortId(); 2099 if (id == PJSUA_INVALID_ID || id >= (int)mediaMaxPorts()) 2100 return false; 2101 2102 pjsua_conf_port_info pi; 2103 return (pjsua_conf_get_port_info(id, &pi) == PJ_SUCCESS); 2084 2104 } 2085 2105 … … 2108 2128 } 2109 2129 2130 CodecInfoVector2 Endpoint::codecEnum2() const throw(Error) 2131 { 2132 CodecInfoVector2 civ2; 2133 pjsua_codec_info pj_codec[MAX_CODEC_NUM]; 2134 unsigned count = MAX_CODEC_NUM; 2135 2136 PJSUA2_CHECK_EXPR( pjsua_enum_codecs(pj_codec, &count) ); 2137 for (unsigned i = 0; i<count; ++i) { 2138 CodecInfo codec_info; 2139 codec_info.fromPj(pj_codec[i]); 2140 civ2.push_back(codec_info); 2141 } 2142 return civ2; 2143 } 2144 2110 2145 void Endpoint::codecSetPriority(const string &codec_id, 2111 2146 pj_uint8_t priority) throw(Error) … … 2169 2204 #endif 2170 2205 return videoCodecInfoList; 2206 } 2207 2208 CodecInfoVector2 Endpoint::videoCodecEnum2() const throw(Error) 2209 { 2210 CodecInfoVector2 civ2; 2211 #if PJSUA_HAS_VIDEO 2212 pjsua_codec_info pj_codec[MAX_CODEC_NUM]; 2213 unsigned count = MAX_CODEC_NUM; 2214 2215 PJSUA2_CHECK_EXPR(pjsua_vid_enum_codecs(pj_codec, &count)); 2216 for (unsigned i = 0; i<count; ++i) { 2217 CodecInfo codec_info; 2218 codec_info.fromPj(pj_codec[i]); 2219 civ2.push_back(codec_info); 2220 } 2221 #endif 2222 return civ2; 2171 2223 } 2172 2224
Note: See TracChangeset
for help on using the changeset viewer.