Changeset 5820 for pjproject/trunk/pjsip/src/pjsua2/account.cpp
- Timestamp:
- Jul 12, 2018 8:22:31 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua2/account.cpp
r5801 r5820 27 27 28 28 #define THIS_FILE "account.cpp" 29 30 /////////////////////////////////////////////////////////////////////////////// 31 32 void RtcpFbCap::fromPj(const pjmedia_rtcp_fb_cap &prm) 33 { 34 this->codecId = pj2Str(prm.codec_id); 35 this->type = prm.type; 36 this->typeName = pj2Str(prm.type_name); 37 this->param = pj2Str(prm.param); 38 } 39 40 pjmedia_rtcp_fb_cap RtcpFbCap::toPj() const 41 { 42 pjmedia_rtcp_fb_cap cap; 43 44 pj_bzero(&cap, sizeof(cap)); 45 cap.codec_id = str2Pj(this->codecId); 46 cap.type = this->type; 47 cap.type_name = str2Pj(this->typeName); 48 cap.param = str2Pj(this->param); 49 50 return cap; 51 } 52 53 /////////////////////////////////////////////////////////////////////////////// 54 55 RtcpFbConfig::RtcpFbConfig() 56 { 57 pjmedia_rtcp_fb_setting setting; 58 pjmedia_rtcp_fb_setting_default(&setting); 59 fromPj(setting); 60 } 61 62 void RtcpFbConfig::fromPj(const pjmedia_rtcp_fb_setting &prm) 63 { 64 this->dontUseAvpf = PJ2BOOL(prm.dont_use_avpf); 65 this->caps.clear(); 66 for (unsigned i = 0; i < prm.cap_count; ++i) { 67 RtcpFbCap cap; 68 cap.fromPj(prm.caps[i]); 69 this->caps.push_back(cap); 70 } 71 } 72 73 pjmedia_rtcp_fb_setting RtcpFbConfig::toPj() const 74 { 75 pjmedia_rtcp_fb_setting setting; 76 77 pj_bzero(&setting, sizeof(setting)); 78 setting.dont_use_avpf = this->dontUseAvpf; 79 setting.cap_count = this->caps.size(); 80 for (unsigned i = 0; i < setting.cap_count; ++i) { 81 setting.caps[i] = this->caps[i].toPj(); 82 } 83 84 return setting; 85 } 86 87 void RtcpFbConfig::readObject(const ContainerNode &node) throw(Error) 88 { 89 ContainerNode this_node = node.readContainer("RtcpFbConfig"); 90 NODE_READ_BOOL (this_node, dontUseAvpf); 91 92 ContainerNode cap_node = this_node.readArray("caps"); 93 this->caps.clear(); 94 while (cap_node.hasUnread()) { 95 RtcpFbCap cap; 96 NODE_READ_STRING (cap_node, cap.codecId); 97 NODE_READ_NUM_T (cap_node, pjmedia_rtcp_fb_type, cap.type); 98 NODE_READ_STRING (cap_node, cap.typeName); 99 NODE_READ_STRING (cap_node, cap.param); 100 this->caps.push_back(cap); 101 } 102 } 103 104 void RtcpFbConfig::writeObject(ContainerNode &node) const throw(Error) 105 { 106 ContainerNode this_node = node.writeNewContainer("RtcpFbConfig"); 107 NODE_WRITE_BOOL (this_node, dontUseAvpf); 108 109 ContainerNode cap_node = this_node.writeNewArray("caps"); 110 for (unsigned i=0; i<this->caps.size(); ++i) { 111 NODE_WRITE_STRING (cap_node, this->caps[i].codecId); 112 NODE_WRITE_NUM_T (cap_node, pjmedia_rtcp_fb_type, 113 this->caps[i].type); 114 NODE_WRITE_STRING (cap_node, this->caps[i].typeName); 115 NODE_WRITE_STRING (cap_node, this->caps[i].param); 116 } 117 } 29 118 30 119 ///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.