コード例 #1
0
  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;
  }
コード例 #2
0
 public int prepareParticipantAsActiveRender(String sParticipantId) {
   int numActiveRenders = getActiveRenders();
   LogSdk.i(Utils.getOoVooTag(), "Active renders = " + numActiveRenders);
   if ((!_on_full_mode
       && numActiveRenders < ParticipantsManager.MAX_ACTIVE_PARTICIPANTS_IN_CALL)) {
     LogSdk.i(Utils.getOoVooTag(), "Add joined user to active renders " + sParticipantId);
     RenderViewData d = getFreeRender();
     if (d != null) {
       _users.get(sParticipantId).setViewId(d._view_id);
       LogSdk.i(
           Utils.getOoVooTag(), "Add free render for " + sParticipantId + " as " + d._view_id);
       d._video_on = false;
       d._user = sParticipantId;
       return d._view_id;
     } else {
       LogSdk.i(
           Utils.getOoVooTag(), "No available GLView found for Participant " + sParticipantId);
     }
   } else {
     LogSdk.i(
         Utils.getOoVooTag(),
         "ConferenceManager.OnParticipantJoinedSession - can't add user to active surfaces");
   }
   return -1;
 }
コード例 #3
0
 public int getNumOfVideosOn() {
   int rc = 0;
   for (int i = 0; i < _renders.size(); i++) {
     RenderViewData d = _renders.valueAt(i);
     if (d.isVideoOn()) rc++;
   }
   return rc;
 }
コード例 #4
0
 private RenderViewData getFreeRender() {
   RenderViewData rd = null;
   LogSdk.i(Utils.getOoVooTag(), "RENDERS Size = " + _renders.size());
   for (int i = 0; i < _renders.size(); i++) {
     RenderViewData d = _renders.valueAt(i);
     //			if (!d._video_on && d._user == null) {
     if (TextUtils.isEmpty(d._user) && !d.isPreview()) {
       rd = d;
       break;
     }
   }
   return rd;
 }
コード例 #5
0
 public void moveToFullMode(int viewIdForFullMode) {
   _on_full_mode = true;
   for (int i = 0; i < _renders.size(); i++) {
     RenderViewData d = _renders.valueAt(i);
     if (d._view_id != viewIdForFullMode) {
       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);
       }
       d.isFullMode = false;
     } else {
       d.isFullMode = true;
     }
   }
 }
コード例 #6
0
 private void fillEmptyRenders() {
   for (Map.Entry<String, VideoParticipant> e : _users.entrySet()) {
     VideoParticipant participant = e.getValue();
     if (participant.getViewId() == -1) {
       RenderViewData d = getFreeRender();
       if (d != null) {
         participant.setViewId(d._view_id);
         LogSdk.i(
             Utils.getOoVooTag(),
             "Add free render for " + participant._participantId + " as " + d._view_id);
         d._video_on = true;
         d._user = participant.getParticipantId();
         ConferenceCore.instance().receiveParticipantVideoOn(participant.getParticipantId());
       } else {
         break;
       }
     }
   }
 }
コード例 #7
0
  public void Pause() {
    LogSdk.d(TAG, "Pause: on_pause=" + _on_pause);
    _on_pause = true;

    for (int i = 0; i < _renders.size(); i++) {
      RenderViewData d = _renders.valueAt(i);
      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);
        d.updateVideoState(VIDEO_PAUSED_DUE_QOS);

        // d._render.channel().Disconnect();
        // d._render = null;

      }
    }
  }
コード例 #8
0
  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) {
      }
    }
  }
コード例 #9
0
  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);
  }
コード例 #10
0
  public void moveToMultiMode(int viewIdForFullMode) {
    _on_full_mode = false;
    int numActiveRenders = 0;
    for (int i = 0; i < _renders.size(); i++) {
      RenderViewData d = _renders.valueAt(i);
      if (d._view_id != viewIdForFullMode) {
        d.isFullMode = false;
        if (d._video_on && d._user != null) {
          numActiveRenders++;
          ConferenceCore.instance().receiveParticipantVideoOn(d._user);
          LogSdk.d(TAG, "resume GLview " + d._view_id + " for user " + d._user);
        }
      } else {
        numActiveRenders++;
      }
    }

    if (numActiveRenders < ParticipantsManager.MAX_ACTIVE_PARTICIPANTS_IN_CALL
        && _users.size() > numActiveRenders) {
      fillEmptyRenders();
    }
  }
コード例 #11
0
  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;
  }
コード例 #12
0
  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;
  }