Changeset 5014


Ignore:
Timestamp:
Mar 22, 2015 8:53:03 AM (9 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.
Location:
pjproject/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia-videodev/android_opengl.c

    r5007 r5014  
    137137}; 
    138138 
    139 static void get_jvm(JNIEnv **jni_env) 
    140 { 
    141     (*pj_jni_jvm)->GetEnv(pj_jni_jvm, (void **)jni_env, JNI_VERSION_1_4); 
    142 } 
    143  
    144 void* android_opengl_get_surface(jobject surface) 
    145 { 
    146     JNIEnv *env = 0; 
    147     get_jvm(&env); 
    148     return ((env && surface)? ANativeWindow_fromSurface(env, surface): NULL); 
    149 } 
    150  
    151139int pjmedia_vid_dev_opengl_imp_get_cap(void) 
    152140{ 
  • pjproject/trunk/pjsip-apps/src/pjsua/android/jni/pjsua.i

    r4496 r5014  
    44#include "pjsua_app_callback.h" 
    55#include "../../pjsua_app.h" 
     6#include <android/native_window_jni.h> 
    67 
    78#ifdef __cplusplus 
     
    1718%} 
    1819 
    19 int pjsuaStart(); 
    20 void pjsuaDestroy(); 
    21 int pjsuaRestart(); 
    22  
    23 /* turn on director wrapping PjsuaAppCallback */ 
     20/* Turn on director wrapping PjsuaAppCallback */ 
    2421%feature("director") PjsuaAppCallback; 
    2522 
     23/* Convert Surface object to ANativeWindow for setIncomingVideoRenderer() */ 
     24%typemap(in) jobject surface { 
     25    $1 = (jobject)ANativeWindow_fromSurface(jenv, $input); 
     26} 
     27 
    2628%include "pjsua_app_callback.h" 
    27  
    28 void setCallbackObject(PjsuaAppCallback* callback); 
    29  
  • 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 
  • pjproject/trunk/pjsip-apps/src/pjsua/android/jni/pjsua_app_callback.h

    r4496 r5014  
    2020#define __PJSUA_APP_CALLBACK_H__ 
    2121 
     22#include <jni.h> 
     23 
    2224class PjsuaAppCallback { 
    2325public: 
     
    3234int pjsuaRestart(); 
    3335void setCallbackObject(PjsuaAppCallback* callback); 
     36void setIncomingVideoRenderer(jobject surface); 
    3437} 
    3538 
  • pjproject/trunk/pjsip-apps/src/pjsua/android/res/layout/activity_main.xml

    r4496 r5014  
    44    android:layout_height="fill_parent" 
    55    android:orientation="vertical" > 
     6 
     7    <TextView 
     8        android:id="@+id/textStatus" 
     9        android:layout_width="wrap_content" 
     10        android:layout_height="wrap_content" 
     11        android:layout_alignParentBottom="true" 
     12        android:layout_alignParentTop="false" 
     13        android:layout_centerHorizontal="true" 
     14        android:textIsSelectable="false" /> 
     15 
     16    <SurfaceView 
     17        android:id="@+id/surfaceViewIncomingCall" 
     18        android:layout_width="wrap_content" 
     19        android:layout_height="match_parent" 
     20        android:layout_above="@+id/imageApp" 
     21        android:layout_alignParentLeft="true" 
     22        android:layout_alignParentRight="true" 
     23        android:layout_alignParentTop="true" 
     24        android:layout_marginBottom="50dp" /> 
     25 
     26    <TextView 
     27        android:id="@+id/textApp" 
     28        android:layout_width="wrap_content" 
     29        android:layout_height="wrap_content" 
     30        android:layout_above="@+id/textStatus" 
     31        android:layout_centerHorizontal="true" 
     32        android:layout_marginBottom="126dp" 
     33        android:text="@string/app_name" 
     34        android:textSize="40sp" 
     35        android:typeface="serif" /> 
    636 
    737    <ImageView 
     
    1444        android:src="@drawable/main_image" /> 
    1545 
    16     <TextView 
    17         android:id="@+id/textApp" 
    18         android:layout_width="wrap_content" 
    19         android:layout_height="wrap_content" 
    20         android:layout_centerHorizontal="true" 
    21         android:layout_centerVertical="true" 
    22         android:text="@string/app_name" 
    23         android:textSize="40sp" 
    24         android:typeface="serif" /> 
    25  
    26     <TextView 
    27         android:id="@+id/textStatus" 
    28         android:layout_width="wrap_content" 
    29         android:layout_height="wrap_content" 
    30         android:layout_alignParentBottom="true" 
    31         android:layout_centerHorizontal="true"  
    32         android:textIsSelectable="false"/> 
    33  
    3446</RelativeLayout> 
  • pjproject/trunk/pjsip-apps/src/pjsua/android/src/org/pjsip/pjsua/MainActivity.java

    r4496 r5014  
    2626import android.os.Bundle; 
    2727import android.util.Log; 
     28import android.view.SurfaceHolder; 
     29import android.view.SurfaceView; 
    2830import android.os.Handler; 
    2931import android.os.Message; 
     
    3133 
    3234class CONST { 
    33         public static final String LIB_FILENAME = "pjsua"; 
    34         public static final String TAG = "pjsua"; 
    35         public static final Boolean AUTOKILL_ON_FINISH = true; 
    36         public enum MSG_TYPE { 
    37                 STR_DEBUG, 
    38                 STR_INFO, 
    39                 STR_ERROR, 
    40                 CLI_STOP, 
    41                 CLI_RESTART, 
    42                 QUIT 
    43         };       
     35    public static final String LIB_FILENAME = "pjsua"; 
     36    public static final String TAG = "pjsua"; 
     37    public static final Boolean AUTOKILL_ON_FINISH = true; 
     38    public enum MSG_TYPE { 
     39        STR_DEBUG, 
     40        STR_INFO, 
     41        STR_ERROR, 
     42        CLI_STOP, 
     43        CLI_RESTART, 
     44        QUIT 
     45    }; 
    4446} 
    4547 
    4648class LOG { 
    47         public static void DEBUG(Handler h, String str) { 
    48                 Message msg = Message.obtain(h, CONST.MSG_TYPE.STR_DEBUG.ordinal(),  
    49                                                                         str); 
    50                 msg.sendToTarget(); 
    51         }        
    52         public static void INFO(Handler h, String str) { 
    53                 Message msg = Message.obtain(h, CONST.MSG_TYPE.STR_INFO.ordinal(),  
    54                                                                         str); 
    55                 msg.sendToTarget(); 
    56         } 
    57         public static void ERROR(Handler h, String str) { 
    58                 Message msg = Message.obtain(h, CONST.MSG_TYPE.STR_ERROR.ordinal(),  
    59                                                                         str); 
    60                 msg.sendToTarget(); 
    61         } 
     49    public static void DEBUG(Handler h, String str) { 
     50        Message msg = Message.obtain(h, CONST.MSG_TYPE.STR_DEBUG.ordinal(),  
     51                                    str); 
     52        msg.sendToTarget(); 
     53    }    
     54    public static void INFO(Handler h, String str) { 
     55        Message msg = Message.obtain(h, CONST.MSG_TYPE.STR_INFO.ordinal(),  
     56                                    str); 
     57        msg.sendToTarget(); 
     58    } 
     59    public static void ERROR(Handler h, String str) { 
     60        Message msg = Message.obtain(h, CONST.MSG_TYPE.STR_ERROR.ordinal(),  
     61                                    str); 
     62        msg.sendToTarget(); 
     63    } 
    6264} 
    6365 
    64 public class MainActivity extends Activity { 
    65         private MyHandler ui_handler = new MyHandler(this); 
    66         private static MyCallback callback; 
    67          
    68         private static class MyHandler extends Handler { 
    69                 private final WeakReference<MainActivity> mTarget; 
    70                  
    71                 public MyHandler(MainActivity target) { 
    72                         mTarget = new WeakReference<MainActivity>(target);  
     66public class MainActivity extends Activity implements SurfaceHolder.Callback { 
     67    private MyHandler ui_handler = new MyHandler(this); 
     68    private static MyCallback callback; 
     69 
     70    private static class MyHandler extends Handler { 
     71        private final WeakReference<MainActivity> mTarget; 
     72 
     73        public MyHandler(MainActivity target) { 
     74            mTarget = new WeakReference<MainActivity>(target);  
     75        } 
     76 
     77        @Override 
     78        public void handleMessage(Message m) { 
     79            MainActivity target = mTarget.get(); 
     80            if (target == null) 
     81                return; 
     82 
     83            if (m.what == CONST.MSG_TYPE.STR_DEBUG.ordinal()) { 
     84                Log.d(CONST.TAG, (String)m.obj);         
     85            } else if (m.what == CONST.MSG_TYPE.STR_INFO.ordinal()) { 
     86                target.updateStatus((String)m.obj); 
     87                Log.i(CONST.TAG, (String)m.obj);                                 
     88            } else if (m.what == CONST.MSG_TYPE.STR_ERROR.ordinal()) { 
     89                target.updateStatus((String)m.obj); 
     90                Log.e(CONST.TAG, (String)m.obj); 
     91            } else if (m.what == CONST.MSG_TYPE.CLI_STOP.ordinal()) { 
     92                pjsua.pjsuaDestroy(); 
     93                LOG.INFO(this, "Telnet Unavailable"); 
     94            } else if (m.what == CONST.MSG_TYPE.CLI_RESTART.ordinal()) { 
     95                int status = pjsua.pjsuaRestart(); 
     96                if (status != 0) { 
     97                    LOG.INFO(this, "Failed restarting telnet"); 
    7398                } 
    74                  
    75                 @Override 
    76                 public void handleMessage(Message m) { 
    77                         MainActivity target = mTarget.get(); 
    78                         if (target == null) 
    79                                 return; 
    80                          
    81                         if (m.what == CONST.MSG_TYPE.STR_DEBUG.ordinal()) { 
    82                                 Log.d(CONST.TAG, (String)m.obj);         
    83                         } else if (m.what == CONST.MSG_TYPE.STR_INFO.ordinal()) { 
    84                                 target.updateStatus((String)m.obj); 
    85                                 Log.i(CONST.TAG, (String)m.obj);                                 
    86                         } else if (m.what == CONST.MSG_TYPE.STR_ERROR.ordinal()) { 
    87                                 target.updateStatus((String)m.obj); 
    88                                 Log.e(CONST.TAG, (String)m.obj); 
    89                         } else if (m.what == CONST.MSG_TYPE.CLI_STOP.ordinal()) { 
    90                                 pjsua.pjsuaDestroy(); 
    91                                 LOG.INFO(this, "Telnet Unavailable"); 
    92                         } else if (m.what == CONST.MSG_TYPE.CLI_RESTART.ordinal()) { 
    93                                 int status = pjsua.pjsuaRestart(); 
    94                                 if (status != 0) { 
    95                                         LOG.INFO(this, "Failed restarting telnet"); 
    96                                 } 
    97                         } else if (m.what == CONST.MSG_TYPE.QUIT.ordinal()) { 
    98                                 target.finish(); 
    99                                 System.gc(); 
    100                                 android.os.Process.killProcess(android.os.Process.myPid()); 
    101                         } 
    102                 } 
    103     } 
    104          
    105         /** Callback object **/ 
    106         private static class MyCallback extends PjsuaAppCallback { 
    107                 private WeakReference<Handler> ui_handler; 
    108                  
    109                 public MyCallback(Handler in_ui_handler) { 
    110                         set_ui_handler(in_ui_handler);                   
    111                 } 
    112                  
    113                 public void set_ui_handler(Handler in_ui_handler) { 
    114                         ui_handler = new WeakReference<Handler>(in_ui_handler); 
    115                 }                
    116                  
    117                 @Override 
    118             public void onStarted(String msg) { 
    119                         Handler ui = ui_handler.get(); 
    120                         LOG.INFO(ui, msg);                       
    121                 } 
    122                  
    123                 @Override 
    124             public void onStopped(int restart) { 
    125                         Handler ui = ui_handler.get(); 
    126                         /** Use timer to stopped/restart **/ 
    127                         if (restart != 0) { 
    128                                 LOG.INFO(ui, "Telnet Restarting"); 
    129                                 Message msg = Message.obtain(ui,  
    130                                                                                   CONST.MSG_TYPE.CLI_RESTART.ordinal()); 
    131                                 ui.sendMessageDelayed(msg, 100); 
    132                         } else { 
    133                                 LOG.INFO(ui, "Telnet Stopping"); 
    134                                 Message msg = Message.obtain(ui,  
    135                                                                                          CONST.MSG_TYPE.CLI_STOP.ordinal()); 
    136                                 ui.sendMessageDelayed(msg, 100); 
    137                         } 
    138                 } 
    139         } 
    140          
    141         private void updateStatus(String output) { 
    142         TextView tStatus = (TextView) findViewById(R.id.textStatus); 
    143         tStatus.setText(output);         
    144         } 
     99            } else if (m.what == CONST.MSG_TYPE.QUIT.ordinal()) { 
     100                target.finish(); 
     101                System.gc(); 
     102                android.os.Process.killProcess(android.os.Process.myPid()); 
     103            } 
     104        } 
     105    } 
     106 
     107    /** Callback object **/ 
     108    private static class MyCallback extends PjsuaAppCallback { 
     109        private WeakReference<Handler> ui_handler; 
     110 
     111        public MyCallback(Handler in_ui_handler) { 
     112            set_ui_handler(in_ui_handler);                       
     113        } 
     114 
     115        public void set_ui_handler(Handler in_ui_handler) { 
     116            ui_handler = new WeakReference<Handler>(in_ui_handler); 
     117        }                
     118 
     119        @Override 
     120        public void onStarted(String msg) { 
     121            Handler ui = ui_handler.get(); 
     122            LOG.INFO(ui, msg);                   
     123        } 
     124 
     125        @Override 
     126        public void onStopped(int restart) { 
     127            Handler ui = ui_handler.get(); 
     128            /** Use timer to stopped/restart **/ 
     129            if (restart != 0) { 
     130                LOG.INFO(ui, "Telnet Restarting"); 
     131                Message msg = Message.obtain(ui,  
     132                        CONST.MSG_TYPE.CLI_RESTART.ordinal()); 
     133                ui.sendMessageDelayed(msg, 100); 
     134            } else { 
     135                LOG.INFO(ui, "Telnet Stopping"); 
     136                Message msg = Message.obtain(ui,  
     137                        CONST.MSG_TYPE.CLI_STOP.ordinal()); 
     138                ui.sendMessageDelayed(msg, 100); 
     139            } 
     140        } 
     141    } 
     142 
     143    private void updateStatus(String output) { 
     144        TextView tStatus = (TextView) findViewById(R.id.textStatus); 
     145        tStatus.setText(output);         
     146    } 
     147 
     148    @Override 
     149    protected void onCreate(Bundle savedInstanceState) { 
     150        LOG.DEBUG(ui_handler, "=== Activity::onCreate() ==="); 
     151        super.onCreate(savedInstanceState); 
     152 
     153        init_view(); 
     154 
     155        init_lib(); 
     156    } 
     157 
     158    @Override 
     159    protected void onStart() { 
     160        LOG.DEBUG(ui_handler, "=== Activity::onStart() ==="); 
     161        super.onStart(); 
     162    } 
     163 
     164    @Override 
     165    protected void onRestart() { 
     166        LOG.DEBUG(ui_handler, "=== Activity::onRestart() ==="); 
     167        super.onRestart(); 
     168    } 
     169 
     170    @Override 
     171    protected void onResume() { 
     172        LOG.DEBUG(ui_handler, "=== Activity::onResume() ==="); 
     173        super.onResume(); 
     174    } 
     175 
     176    @Override 
     177    protected void onPause() { 
     178        LOG.DEBUG(ui_handler, "=== Activity::onPause() ==="); 
     179        super.onPause(); 
     180    } 
     181 
     182    @Override 
     183    protected void onStop() { 
     184        LOG.DEBUG(ui_handler, "=== Activity::onStop() ==="); 
     185        super.onStop(); 
     186    } 
     187 
     188    @Override 
     189    protected void onDestroy() { 
     190        LOG.DEBUG(ui_handler, "=== Activity::onDestroy() ==="); 
     191        super.onDestroy(); 
     192    } 
     193 
     194    @Override 
     195    protected void onSaveInstanceState(Bundle outState) { 
     196        super.onSaveInstanceState(outState); 
     197    } 
     198 
     199    @Override 
     200    protected void onRestoreInstanceState(Bundle savedInstanceState) { 
     201        super.onRestoreInstanceState(savedInstanceState); 
     202    } 
     203 
     204    private void init_view() { 
     205        setContentView(R.layout.activity_main); 
     206    } 
     207 
     208    private int init_lib() {         
     209        LOG.INFO(ui_handler, "Loading module..."); 
     210 
     211        // Try loading video dependency libs 
     212        try { 
     213            System.loadLibrary("openh264"); 
     214            System.loadLibrary("yuv"); 
     215        } catch (UnsatisfiedLinkError e) { 
     216            LOG.ERROR(ui_handler, "UnsatisfiedLinkError: " + e.getMessage()); 
     217            LOG.ERROR(ui_handler, "This could be safely ignored if you "+ 
     218                                  "don't need video."); 
     219        } 
     220 
     221        // Load pjsua 
     222        try { 
     223            System.loadLibrary(CONST.LIB_FILENAME); 
     224        } catch (UnsatisfiedLinkError e) { 
     225            LOG.ERROR(ui_handler, "UnsatisfiedLinkError: " + e.getMessage()); 
     226            return -1; 
     227        } 
     228 
     229        // Wait for GDB to init, for native debugging only 
     230        if (false && (getApplicationInfo().flags &  
     231                      ApplicationInfo.FLAG_DEBUGGABLE) != 0) 
     232        { 
     233            try { 
     234                Thread.sleep(5000); 
     235            } catch (InterruptedException e) { 
     236                LOG.ERROR(ui_handler, "InterruptedException: " +  
     237                        e.getMessage()); 
     238            } 
     239        } 
     240 
     241        // Set callback object 
     242        if (callback == null) 
     243            callback = new MyCallback(ui_handler); 
     244 
     245        pjsua.setCallbackObject(callback); 
     246 
     247        SurfaceView surfaceView = (SurfaceView) 
     248                                  findViewById(R.id.surfaceViewIncomingCall); 
     249        surfaceView.getHolder().addCallback(this); 
     250 
     251        LOG.INFO(ui_handler, "Starting module.."); 
     252 
     253        int rc = pjsua.pjsuaStart(); 
     254 
     255        if (rc != 0) { 
     256            LOG.INFO(ui_handler, "Failed starting telnet"); 
     257        } 
     258 
     259        return 0; 
     260    } 
    145261     
    146     @Override 
    147     protected void onCreate(Bundle savedInstanceState) { 
    148         LOG.DEBUG(ui_handler, "=== Activity::onCreate() ==="); 
    149         super.onCreate(savedInstanceState); 
    150          
    151         init_view(); 
    152  
    153         init_lib(); 
    154         } 
    155  
    156     @Override 
    157     protected void onStart() { 
    158         LOG.DEBUG(ui_handler, "=== Activity::onStart() ==="); 
    159         super.onStart(); 
     262    public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) 
     263    { 
     264        pjsua.setIncomingVideoRenderer(holder.getSurface()); 
     265    } 
     266 
     267    public void surfaceCreated(SurfaceHolder holder) 
     268    { 
     269        pjsua.setIncomingVideoRenderer(holder.getSurface()); 
     270    } 
     271 
     272    public void surfaceDestroyed(SurfaceHolder holder) 
     273    { 
     274        pjsua.setIncomingVideoRenderer(null); 
    160275    } 
    161276     
    162     @Override 
    163     protected void onRestart() { 
    164         LOG.DEBUG(ui_handler, "=== Activity::onRestart() ==="); 
    165         super.onRestart(); 
    166     } 
    167  
    168     @Override 
    169     protected void onResume() { 
    170         LOG.DEBUG(ui_handler, "=== Activity::onResume() ==="); 
    171         super.onResume(); 
    172     } 
    173  
    174     @Override 
    175     protected void onPause() { 
    176         LOG.DEBUG(ui_handler, "=== Activity::onPause() ==="); 
    177         super.onPause(); 
    178     } 
    179  
    180     @Override 
    181     protected void onStop() { 
    182         LOG.DEBUG(ui_handler, "=== Activity::onStop() ==="); 
    183         super.onStop(); 
    184     } 
    185  
    186     @Override 
    187     protected void onDestroy() { 
    188         LOG.DEBUG(ui_handler, "=== Activity::onDestroy() ==="); 
    189         super.onDestroy(); 
    190     } 
    191      
    192     @Override 
    193     protected void onSaveInstanceState(Bundle outState) { 
    194                 super.onSaveInstanceState(outState); 
    195     } 
    196  
    197     @Override 
    198     protected void onRestoreInstanceState(Bundle savedInstanceState) { 
    199                 super.onRestoreInstanceState(savedInstanceState); 
    200     } 
    201      
    202         private void init_view() { 
    203         setContentView(R.layout.activity_main); 
    204         } 
    205          
    206         private int init_lib() {         
    207                 LOG.INFO(ui_handler, "Loading module..."); 
    208                 try { 
    209                         System.loadLibrary(CONST.LIB_FILENAME); 
    210                 } catch (UnsatisfiedLinkError e) { 
    211                         LOG.ERROR(ui_handler, "UnsatisfiedLinkError: " + e.getMessage()); 
    212                         return -1; 
    213                 } 
    214                  
    215                 // Wait for GDB to init 
    216                 if ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0)  
    217                 { 
    218                         try { 
    219                                 Thread.sleep(5000); 
    220                 } catch (InterruptedException e) { 
    221                         LOG.ERROR(ui_handler, "InterruptedException: " +  
    222                                           e.getMessage()); 
    223                 } 
    224                 } 
    225                  
    226                 // Set callback object 
    227                 if (callback == null) 
    228                         callback = new MyCallback(ui_handler); 
    229                  
    230                 pjsua.setCallbackObject(callback); 
    231  
    232                 LOG.INFO(ui_handler, "Starting module.."); 
    233  
    234                 int rc = pjsua.pjsuaStart(); 
    235          
    236                 if (rc != 0) { 
    237                         LOG.INFO(ui_handler, "Failed starting telnet"); 
    238                 } 
    239                  
    240                 return 0; 
    241         } 
    242277} 
  • pjproject/trunk/pjsip-apps/src/swig/java/android/src/org/pjsip/pjsua2/app/CallActivity.java

    r4997 r5014  
    8080                                vidWH.getHandle().setWindow(null); 
    8181                        else 
    82                                 vidWH.getHandle().setWindow(pjsua2.android_opengl_get_surface(holder.getSurface())); 
     82                                vidWH.getHandle().setWindow(holder.getSurface()); 
    8383                        try { 
    8484                                MainActivity.currentCall.vidWin.setWindow(vidWH); 
  • pjproject/trunk/pjsip-apps/src/swig/java/android/src/org/pjsip/pjsua2/app/MyApp.java

    r4997 r5014  
    2121import java.io.File; 
    2222import java.util.ArrayList; 
     23 
    2324import org.pjsip.pjsua2.*; 
    2425 
     
    244245class MyApp { 
    245246        static { 
     247                try{ 
     248                    System.loadLibrary("openh264"); 
     249                    System.loadLibrary("yuv"); 
     250                } catch (UnsatisfiedLinkError e) { 
     251                    System.out.println("UnsatisfiedLinkError: " + e.getMessage()); 
     252                    System.out.println("This could be safely ignored if you " + 
     253                                       "don't need video."); 
     254                } 
    246255                System.loadLibrary("pjsua2"); 
    247256                System.out.println("Library loaded"); 
  • pjproject/trunk/pjsip-apps/src/swig/pjsua2.i

    r4996 r5014  
    102102%template(CodecInfoVector)              std::vector<pj::CodecInfo*>; 
    103103 
    104 %include "pjsua2/media.hpp" 
    105 // Create an interface for android_opengl_get_surface() 
     104/* pj::WindowHandle::setWindow() receives Surface object */ 
    106105#if defined(SWIGJAVA) && defined(__ANDROID__) 
    107 %inline %{ 
    108 extern "C" { 
    109     void* android_opengl_get_surface(jobject surface); 
     106%{#include <android/native_window_jni.h>%} 
     107%ignore pj::WindowHandle::display; 
     108%ignore pj::WindowHandle::window; 
     109%typemap(in) jobject surface { 
     110    $1 = (jobject)ANativeWindow_fromSurface(jenv, $input); 
    110111} 
    111 %} 
     112%extend pj::WindowHandle { 
     113    void setWindow(jobject surface) { $self->window = surface; } 
     114} 
    112115#endif 
    113116 
     117%include "pjsua2/media.hpp" 
    114118%include "pjsua2/presence.hpp" 
    115119%include "pjsua2/account.hpp" 
Note: See TracChangeset for help on using the changeset viewer.