Ignore:
Timestamp:
Mar 22, 2015 8:53:03 AM (7 years ago)
Author:
nanang
Message:

Re #1790:

  • Removed android_opengl_get_surface() for renderer view setup, Java application can directly supply Surface object as renderer window.
  • Added renderer view on pjsua CLI app sample.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsua/android/jni/pjsua_app_callback.cpp

    r5005 r5014  
    3030static int restart_argc; 
    3131static char **restart_argv; 
     32static pjsua_callback pjsua_cb_orig; 
     33static jobject callVideoSurface; 
    3234 
    3335extern const char *pjsua_app_def_argv[]; 
     
    4244} 
    4345 
     46static void on_call_media_state(pjsua_call_id call_id) 
     47{ 
     48    pjsua_call_info call_info; 
     49    unsigned mi; 
     50    pj_bool_t has_error = PJ_FALSE; 
     51 
     52    pjsua_call_get_info(call_id, &call_info); 
     53 
     54    for (mi=0; mi<call_info.media_cnt; ++mi) { 
     55        pjsua_call_media_info *med_info = &call_info.media[mi]; 
     56        if (med_info->type == PJMEDIA_TYPE_VIDEO && 
     57            med_info->status == PJSUA_CALL_MEDIA_ACTIVE && 
     58            med_info->stream.vid.win_in != PJSUA_INVALID_ID) 
     59        { 
     60            pjmedia_vid_dev_hwnd vhwnd; 
     61 
     62            /* Setup renderer surface */ 
     63            pj_bzero(&vhwnd, sizeof(vhwnd)); 
     64            vhwnd.type = PJMEDIA_VID_DEV_HWND_TYPE_ANDROID; 
     65            vhwnd.info.window = callVideoSurface; 
     66            pjsua_vid_win_set_win(med_info->stream.vid.win_in, &vhwnd); 
     67            break; 
     68        } 
     69    } 
     70     
     71    /* Forward to original callback */ 
     72    if (pjsua_cb_orig.on_call_media_state) 
     73        (*pjsua_cb_orig.on_call_media_state)(call_id); 
     74} 
    4475 
    4576/** Callback wrapper **/ 
    4677static void on_cli_config(pjsua_app_config *cfg) 
    4778{ 
     79    pjsua_cb_orig = cfg->cfg.cb; 
    4880    cfg->log_cfg.cb = &log_writer; 
     81     
     82    /* Override pjsua callback, e.g: to install renderer view */ 
     83    cfg->cfg.cb.on_call_media_state = &on_call_media_state; 
    4984} 
    5085 
     
    127162} 
    128163 
     164 
     165void setIncomingVideoRenderer(jobject surface) 
     166{ 
     167    callVideoSurface = surface; 
     168} 
     169 
    129170#endif 
Note: See TracChangeset for help on using the changeset viewer.