Changeset 3086 for pjproject/trunk
- Timestamp:
- Feb 3, 2010 2:43:25 PM (15 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/sdp.c
r2995 r3086 1061 1061 return attr; 1062 1062 } 1063 1064 1065 /* 1066 * Apply direction attribute in session to all media. 1067 */ 1068 static void apply_media_direction(pjmedia_sdp_session *sdp) 1069 { 1070 pjmedia_sdp_attr *dir_attr = NULL; 1071 unsigned i; 1072 1073 const pj_str_t inactive = { "inactive", 8 }; 1074 const pj_str_t sendonly = { "sendonly", 8 }; 1075 const pj_str_t recvonly = { "recvonly", 8 }; 1076 const pj_str_t sendrecv = { "sendrecv", 8 }; 1077 1078 /* Find direction attribute in session, don't need to find default 1079 * direction "sendrecv". 1080 */ 1081 for (i = 0; i < sdp->attr_count && !dir_attr; ++i) { 1082 if (!pj_strcmp(&sdp->attr[i]->name, &sendonly) || 1083 !pj_strcmp(&sdp->attr[i]->name, &recvonly) || 1084 !pj_strcmp(&sdp->attr[i]->name, &inactive)) 1085 { 1086 dir_attr = sdp->attr[i]; 1087 } 1088 } 1089 1090 /* Found the direction attribute */ 1091 if (dir_attr) { 1092 /* Remove the direction attribute in session */ 1093 pjmedia_sdp_attr_remove(&sdp->attr_count, sdp->attr, dir_attr); 1094 1095 /* Apply the direction attribute to all media, but not overriding it 1096 * if media already has direction attribute. 1097 */ 1098 for (i = 0; i < sdp->media_count; ++i) { 1099 pjmedia_sdp_media *m; 1100 unsigned j; 1101 1102 /* Find direction attribute in this media */ 1103 m = sdp->media[i]; 1104 for (j = 0; j < m->attr_count; ++j) { 1105 if (!pj_strcmp(&m->attr[j]->name, &sendrecv) || 1106 !pj_strcmp(&m->attr[j]->name, &sendonly) || 1107 !pj_strcmp(&m->attr[j]->name, &recvonly) || 1108 !pj_strcmp(&m->attr[j]->name, &inactive)) 1109 { 1110 break; 1111 } 1112 } 1113 1114 /* Not found, apply direction attribute from session */ 1115 if (j == m->attr_count) 1116 pjmedia_sdp_media_add_attr(m, dir_attr); 1117 } 1118 } 1119 } 1120 1063 1121 1064 1122 /* … … 1178 1236 pj_scan_fini(&scanner); 1179 1237 1238 apply_media_direction(session); 1239 1180 1240 *p_sdp = session; 1181 1241 return ctx.last_error;
Note: See TracChangeset
for help on using the changeset viewer.