Changes between Initial Version and Version 7 of Ticket #2181


Ignore:
Timestamp:
Apr 23, 2019 10:48:08 AM (5 years ago)
Author:
nanang
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2181 – Description

    initial v7  
    3232 
    3333 
    34 === Sample usage: three parties video conference using PJSUA === 
     34=== Sample usage: three parties video conference === 
    3535 
    3636Here are steps to setup a three parties video conference: 
    3737 
    3838 1. Make two video calls as normal to two other participants. 
    39  1. After all calls are established, simply connect those port IDs using {{{pjsua_vid_conf_connect()}}}, e.g: 
     39 1. After all calls are established, simply connect those port IDs using {{{pjsua_vid_conf_connect()}}} for PJSUA or {{{VideoMedia::startTransmit()}}} for PJSUA2, e.g: 
     40    - using PJSUA: 
    4041    {{{ 
    41 ... 
    4242/* Get video ports of call 1, there are two ports as in a video call as 
    4343 * encoding and decoding directions may not use the same frame rate or  
     
    5757status = pjsua_vid_conf_connect(call_1_dec_port, call_2_enc_port, NULL); 
    5858status = pjsua_vid_conf_connect(call_2_dec_port, call_1_enc_port, NULL); 
    59 ... 
     59    }}} 
     60    - using PJSUA2 (exception handling excluded): 
     61    {{{ 
     62/* Get video ports of call 1 */ 
     63VideoMedia call_1_dec_port = call1->getDecodingVideoMedia(-1); 
     64VideoMedia call_1_enc_port = call1->getEncodingVideoMedia(-1); 
     65 
     66/* Get video ports of call 2 */ 
     67VideoMedia call_2_dec_port = call2->getDecodingVideoMedia(-1); 
     68VideoMedia call_2_enc_port = call2->getEncodingVideoMedia(-1); 
     69 
     70/* Connect video ports of call 1 and call 2 */ 
     71VideoMediaTransmitParam transmit_param; 
     72call_1_dec_port.startTransmit(call_2_enc_port, transmit_param); 
     73call_2_dec_port.startTransmit(call_1_enc_port, transmit_param); 
    6074    }}} 
    6175 1. At this point, each participant should be able to see video from the two other participants. The caller will see them in separate windows as it has two video calls (may be combined if preferred, see below), while the other two will only have one incoming video window as usual, just it contains a mixed video (from the caller and the other participant). 
    6276 1. On the caller side, it may combine video window of call 1 and call 2 into a single window (for simpler UI management perhaps), e.g: 
     77    - using PJSUA: 
    6378    {{{ 
    6479pjsua_vid_win_id wid1, wid2; 
     
    7489pjsua_vid_win_set_show(wid1, PJ_FALSE); 
    7590    }}} 
     91    - using PJSUA2: 
     92    {{{ 
     93/* Function for querying any first video window of the specified call */ 
     94VideoWindow getCallVideoWindow(const Call *call) { 
     95    CallInfo ci = call->getInfo(); 
     96    CallMediaInfoVector::iterator it; 
     97    for (it = ci.media.begin(); it != ci.media.end(); ++it) { 
     98        if (it->type == PJMEDIA_TYPE_VIDEO && 
     99            it->videoIncomingWindowId != PJSUA_INVALID_ID) 
     100        { 
     101            return it->videoWindow; 
     102        } 
     103    } 
     104    return VideoWindow(PJSUA_INVALID_ID); 
     105} 
    76106 
     107/* Put incoming video stream from call 1 into call 2 window */ 
     108VideoWindow wid2 = getCallVideoWindow(call2); 
     109VideoMediaTransmitParam transmit_param; 
     110call_1_dec_port.startTransmit(wid2.getVideoMedia(), transmit_param); 
     111 
     112/* Now hide the video window of call 1 */ 
     113VideoWindow wid1 = getCallVideoWindow(call1); 
     114wid1.Show(false); 
     115    }}}