diff options
author | Benny Prijono <bennylp@teluu.com> | 2011-10-04 13:35:41 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2011-10-04 13:35:41 +0000 |
commit | 47b179cfea4ad6c423a7d3281920e0d195e6e60b (patch) | |
tree | 544a898374ee58a6c63e884d0828af8d6d0a21ec /pjsip/src | |
parent | 9dadde885bba819e5bdd2a51e219be669f02efd2 (diff) |
More re #1362: actually try to use the device switching capability in pjsua-lib, in pjsua_call_set_vid_strm(PJSUA_CALL_VID_STRM_CHANGE_CAP_DEV) operation
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3787 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_vid.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_vid.c b/pjsip/src/pjsua-lib/pjsua_vid.c index 7ad73bbb..2a4c99f5 100644 --- a/pjsip/src/pjsua-lib/pjsua_vid.c +++ b/pjsip/src/pjsua-lib/pjsua_vid.c @@ -1756,6 +1756,8 @@ static pj_status_t call_change_cap_dev(pjsua_call *call, pjmedia_vid_dev_index cap_dev) { pjsua_call_media *call_med; + pjmedia_vid_dev_stream *old_dev; + pjmedia_vid_dev_switch_param switch_prm; pjmedia_vid_dev_info info; pjsua_vid_win *w, *new_w = NULL; pjsua_vid_win_id wid, new_wid; @@ -1794,6 +1796,19 @@ static pj_status_t call_change_cap_dev(pjsua_call *call, w = &pjsua_var.win[wid]; pj_assert(w->type == PJSUA_WND_TYPE_PREVIEW && w->vp_cap); + /* If the old device supports fast switching, then that's excellent! */ + old_dev = pjmedia_vid_port_get_stream(w->vp_cap); + pjmedia_vid_dev_switch_param_default(&switch_prm); + switch_prm.target_id = cap_dev; + status = pjmedia_vid_dev_stream_set_cap(old_dev, + PJMEDIA_VID_DEV_CAP_SWITCH, + &switch_prm); + if (status == PJ_SUCCESS) { + w->preview_cap_id = cap_dev; + return PJ_SUCCESS; + } + + /* No it doesn't support fast switching. Do slow switching then.. */ status = pjmedia_vid_stream_get_port(call_med->strm.v.stream, PJMEDIA_DIR_ENCODING, &media_port); if (status != PJ_SUCCESS) |