@Override
 public void onDestroy() {
   super.onDestroy();
   inProcessing = true;
   if (webServer != null) webServer.stop();
   audioLoop.ReleaseLoop();
   audioCapture.release();
 }
 private boolean initWebServer() {
   String ipAddr = getLocalIpAddress();
   if (ipAddr != null) {
     try {
       webServer = new TeaServer(8080, this);
       webServer.registerCGI("/cgi/query", doQuery);
       webServer.registerCGI("/cgi/setup", doSetup);
       webServer.registerCGI("/stream/live.jpg", doCapture);
       webServer.registerCGI("/stream/live.mp3", doBroadcast);
       webServer.registerCGI("/cgi/rotate", doRotate);
       webServer.registerCGI("/cgi/autofocus", doAutoFocus);
       webServer.registerCGI("/cgi/changequality", doChangeQuality);
       webServer.registerCGI("/cgi/dimscreen", doDimScreen);
     } catch (IOException e) {
       webServer = null;
     }
   }
   if (webServer != null) {
     tvMessage1.setText(getString(R.string.msg_access_local) + " http://" + ipAddr + ":8080");
     tvMessage2.setText(getString(R.string.msg_access_query));
     tvMessage2.setVisibility(View.VISIBLE);
     NatPMPClient natQuery = new NatPMPClient();
     natQuery.start();
     return true;
   } else {
     tvMessage1.setText(getString(R.string.msg_error));
     // tvMessage2.setVisibility(View.GONE);
     return false;
   }
 }