public boolean turnVideoOn(String sParticipantId, VideoChannelPtr in) {
    if (!_users.containsKey(sParticipantId)) {
      LogSdk.e(TAG, "turnVideoOn: Participant " + sParticipantId + " not found");
      return false;
    }

    RenderViewData d = null;
    Integer view_id = _users.get(sParticipantId).getViewId();
    if (view_id == -1) {
      LogSdk.d(TAG, "Participant " + sParticipantId + " is not connected to any GLView");
      d = getFreeRender();
      if (d != null) _users.get(sParticipantId).setViewId(d._view_id);

    } else {
      d = _renders.get(view_id);
    }

    if (d != null) {
      d._render.connect(in, sParticipantId);
      d._video_on = true;
      d._user = sParticipantId;
      LogSdk.d(TAG, "video is ON for " + sParticipantId + " GLView " + d._view_id);
      return true;
    } else {
      LogSdk.w(TAG, "No available GVView found for Participant " + sParticipantId);
    }
    return false;
  }
  @Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    try {
      int count = getChildCount();

      int maxHeight = 0;
      int maxWidth = 0;

      // Find out how big everyone wants to be
      measureChildren(widthMeasureSpec, heightMeasureSpec);

      // Find rightmost and bottom-most child
      for (int i = 0; i < count; i++) {
        View child = getChildAt(i);
        if (child.getVisibility() != GONE) {
          int childRight;
          int childBottom;

          DynamicAbsoluteLayout.LayoutParams lp =
              (DynamicAbsoluteLayout.LayoutParams) child.getLayoutParams();

          childRight = lp.x + child.getMeasuredWidth();
          childBottom = lp.y + child.getMeasuredHeight();

          maxWidth = Math.max(maxWidth, childRight);
          maxHeight = Math.max(maxHeight, childBottom);
        }
      }

      // Account for padding too
      maxWidth += getPaddingLeft() + getPaddingRight();
      maxHeight += getPaddingTop() + getPaddingBottom();

      // Check against minimum height and width
      maxHeight = Math.max(maxHeight, getSuggestedMinimumHeight());
      maxWidth = Math.max(maxWidth, getSuggestedMinimumWidth());
      measuredWidth = resolveSize(maxWidth, widthMeasureSpec);
      measuredHeight = resolveSize(maxHeight, heightMeasureSpec);
      setMeasuredDimension(measuredWidth, measuredHeight);
    } catch (Exception ex) {
      LogSdk.e("", "", ex);
    }
  }
  public void updateGLViews(SessionUIPresenter presenter) {
    //		_on_pause = false;
    for (int i = 0; i < _renders.size(); i++) {
      RenderViewData d = _renders.valueAt(i);
      LogSdk.d(TAG, "updating GLview " + d._view_id + " for user " + d._user);

      GLSurfaceView glview = (GLSurfaceView) presenter.findViewById(d._view_id);
      if (glview == null) {
        LogSdk.e(TAG, "NULL GL view!!! " + d._view_id);
        continue;
      }
      try {
        glview.setEGLContextClientVersion(2);
        d._render = new VideoRenderer(glview);
        glview.setRenderer(d._render);
        glview.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); // .RENDERMODE_CONTINUOUSLY);
      } catch (IllegalStateException e) {
      }
    }
  }
  public void turnVideoOff(String sParticipantId) {
    if (!_users.containsKey(sParticipantId)) {
      LogSdk.e(TAG, "Participant " + sParticipantId + " not found");
      return;
    }

    Integer view_id = _users.get(sParticipantId).getViewId();
    if (view_id == -1) {
      LogSdk.w(TAG, "No GLview found for participant " + sParticipantId);
      return;
    }

    RenderViewData d = _renders.get(view_id);
    if (d != null) {
      if (d._render != null) d._render.disconnect();
      if (!_on_pause && !_on_full_mode) {
        d._video_on = false;
        d._user = null;
      }
      LogSdk.d(TAG, "video is OFF for " + sParticipantId);
    } else LogSdk.w(TAG, "turnVideoOff: No GVView found for Participant " + sParticipantId);
  }
  public boolean removeParticipant(String sParticipantId) {
    boolean updateFullMode = false;
    if (!_users.containsKey(sParticipantId)) {
      LogSdk.e(TAG, "remove Participant failed! Participant " + sParticipantId + " not found");
      return updateFullMode;
    }
    Integer view_id = _users.get(sParticipantId).getViewId();
    if (view_id == -1) {
      LogSdk.d(TAG, "Participant " + sParticipantId + " is not connected to any GLView");
    } else {
      RenderViewData d = _renders.get(view_id);
      updateFullMode = d.isFullMode;
      d._render.disconnect();
      d._video_on = false;
      d._user = null;
    }
    _users.remove(sParticipantId);

    if (updateFullMode) {
      _on_full_mode = true;
      for (int i = 0; i < _renders.size(); i++) {
        RenderViewData d = _renders.valueAt(i);
        if (d._view_id != view_id) {
          String user = getParticipantByViewId(d._view_id);
          LogSdk.d(TAG, "pausing GLview " + d._view_id + " for user " + user);
          if (d._video_on) {
            ConferenceCore.instance().receiveParticipantVideoOff(user);
            LogSdk.d(TAG, "send turn video Off for user " + user);
          }
        } else {
          d.isFullMode = false;
        }
      }
    }
    LogSdk.d(TAG, "remove Participant " + sParticipantId + " GLView " + view_id + " is free.");
    return updateFullMode;
  }
  public boolean removeParticipant(String sParticipantId) {
    boolean updateFullMode = false;
    if (!_users.containsKey(sParticipantId)) {
      LogSdk.e(TAG, "remove Participant failed! Participant " + sParticipantId + " not found");
      return updateFullMode;
    }
    Integer view_id = _users.get(sParticipantId).getViewId();
    if (view_id == -1) {
      LogSdk.d(TAG, "Participant " + sParticipantId + " is not connected to any GLView");
    } else {
      RenderViewData d = _renders.get(view_id);
      updateFullMode = d.isFullMode;
      d.isFullMode = false;
      d._render.disconnect();
      d._video_on = false;
      d._user = null;
    }
    _users.remove(sParticipantId);

    if (updateFullMode) moveToMultiMode(-1);

    LogSdk.d(TAG, "remove Participant " + sParticipantId + " GLView " + view_id + " is free.");
    return updateFullMode;
  }
  @Override
  protected void onLayout(boolean changed, int l, int t, int r, int b) {
    try {
      int count = getChildCount();
      for (int i = 0; i < count; i++) {
        View child = getChildAt(i);
        if (child.getVisibility() != GONE) {

          DynamicAbsoluteLayout.LayoutParams lp =
              (DynamicAbsoluteLayout.LayoutParams) child.getLayoutParams();

          int childLeft = getPaddingLeft() + lp.x;
          int childTop = getPaddingTop() + lp.y;
          child.layout(
              childLeft,
              childTop,
              childLeft + child.getMeasuredWidth(),
              childTop + child.getMeasuredHeight());
        }
      }
    } catch (Exception ex) {
      LogSdk.e("", "", ex);
    }
  }