Changeset 3901 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
- Timestamp:
- Dec 7, 2011 10:43:28 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r3893 r3901 1259 1259 pjsua_call_media *call_med = (pjsua_call_media*)user_data; 1260 1260 pjsua_call *call = call_med->call; 1261 pj_status_t status = PJ_SUCCESS; 1262 1263 switch(event->type) { 1264 case PJMEDIA_EVENT_KEYFRAME_MISSING: 1265 if (call->opt.req_keyframe_method & PJSUA_VID_REQ_KEYFRAME_SIP_INFO) 1266 { 1267 pj_timestamp now; 1268 1269 pj_get_timestamp(&now); 1270 if (pj_elapsed_msec(&call_med->last_req_keyframe, &now) >= 1271 PJSUA_VID_REQ_KEYFRAME_INTERVAL) 1272 { 1273 pjsua_msg_data msg_data; 1274 const pj_str_t SIP_INFO = {"INFO", 4}; 1275 const char *BODY_TYPE = "application/media_control+xml"; 1276 const char *BODY = 1277 "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" 1278 "<media_control><vc_primitive><to_encoder>" 1279 "<picture_fast_update/>" 1280 "</to_encoder></vc_primitive></media_control>"; 1281 1282 PJ_LOG(4,(THIS_FILE, 1283 "Sending video keyframe request via SIP INFO")); 1284 1285 pjsua_msg_data_init(&msg_data); 1286 pj_cstr(&msg_data.content_type, BODY_TYPE); 1287 pj_cstr(&msg_data.msg_body, BODY); 1288 status = pjsua_call_send_request(call->index, &SIP_INFO, 1289 &msg_data); 1290 if (status != PJ_SUCCESS) { 1291 pj_perror(3, THIS_FILE, status, 1292 "Failed requesting keyframe via SIP INFO"); 1293 } else { 1294 call_med->last_req_keyframe = now; 1295 } 1296 } 1297 } 1298 break; 1299 1300 default: 1301 break; 1302 } 1261 1303 1262 1304 if (pjsua_var.ua_cfg.cb.on_call_media_event && call) { … … 1265 1307 } 1266 1308 1267 return PJ_SUCCESS;1309 return status; 1268 1310 } 1269 1311 … … 4188 4230 4189 4231 4232 pj_status_t pjsua_media_apply_xml_control(pjsua_call_id call_id, 4233 const pj_str_t *xml_st) 4234 { 4235 pjsua_call *call = &pjsua_var.calls[call_id]; 4236 const pj_str_t PICT_FAST_UPDATE = {"picture_fast_update", 19}; 4237 4238 #if PJMEDIA_HAS_VIDEO 4239 if (pj_strstr(xml_st, &PICT_FAST_UPDATE)) { 4240 unsigned i; 4241 4242 PJ_LOG(4,(THIS_FILE, "Received keyframe request via SIP INFO")); 4243 4244 for (i = 0; i < call->med_cnt; ++i) { 4245 pjsua_call_media *cm = &call->media[i]; 4246 if (cm->type != PJMEDIA_TYPE_VIDEO || !cm->strm.v.stream) 4247 continue; 4248 4249 pjmedia_vid_stream_send_keyframe(cm->strm.v.stream); 4250 } 4251 4252 return PJ_SUCCESS; 4253 } 4254 #endif 4255 4256 /* Just to avoid compiler warning of unused var */ 4257 PJ_UNUSED_ARG(xml_st); 4258 4259 return PJ_ENOTSUP; 4260 } 4261
Note: See TracChangeset
for help on using the changeset viewer.