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; }
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)) { rd = d; break; } } return rd; }
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; } } } }