/** * Makes sure that conference is allocated for given <tt>room</tt>. * * @param room name of the MUC room of Jitsi Meet conference. * @param properties configuration properties, see {@link JitsiMeetConfig} for the list of valid * properties. * @throws Exception if any error occurs. */ private void createConference(String room, Map<String, String> properties) throws Exception { JitsiMeetConfig config = new JitsiMeetConfig(properties); JitsiMeetConference conference = new JitsiMeetConference(room, focusUserName, protocolProviderHandler, this, config); conferences.put(room, conference); StringBuilder options = new StringBuilder(); for (Map.Entry<String, String> option : properties.entrySet()) { options.append("\n ").append(option.getKey()).append(": ").append(option.getValue()); } logger.info( "Created new focus for " + room + "@" + focusUserDomain + " conferences count: " + conferences.size() + " options:" + options.toString()); // Send focus created event EventAdmin eventAdmin = FocusBundleActivator.getEventAdmin(); if (eventAdmin != null) { eventAdmin.sendEvent(EventFactory.focusCreated(conference.getId(), conference.getRoomName())); } try { conference.start(); } catch (Exception e) { logger.info("Exception while trying to start the conference", e); // stop() method is called by the conference automatically in order // to not release the lock on JitsiMeetConference instance and avoid // a deadlock. It may happen when this thread is about to call // conference.stop() and another thread has entered the method // before us. That other thread will try to call // FocusManager.conferenceEnded, but we're still holding the lock // on FocusManager instance. // conference.stop(); throw e; } }
/** * Makes <tt>RTCPSDES</tt> packets for all the RTP streams that we're sending. * * @return a <tt>List</tt> of <tt>RTCPSDES</tt> packets for all the RTP streams that we're * sending. */ private RTCPSDESPacket makeSDESPacket() { Collection<RTCPSDES> sdesChunks = new ArrayList<RTCPSDES>(); // Create an SDES for our own SSRC. RTCPSDES ownSDES = new RTCPSDES(); SSRCInfo ourinfo = getStream().getStreamRTPManager().getSSRCCache().ourssrc; ownSDES.ssrc = (int) getLocalSSRC(); Collection<RTCPSDESItem> ownItems = new ArrayList<RTCPSDESItem>(); ownItems.add(new RTCPSDESItem(RTCPSDESItem.CNAME, ourinfo.sourceInfo.getCNAME())); // Throttle the source description bandwidth. See RFC3550#6.3.9 // Allocation of Source Description Bandwidth. if (sdesCounter % 3 == 0) { if (ourinfo.name != null && ourinfo.name.getDescription() != null) ownItems.add(new RTCPSDESItem(RTCPSDESItem.NAME, ourinfo.name.getDescription())); if (ourinfo.email != null && ourinfo.email.getDescription() != null) ownItems.add(new RTCPSDESItem(RTCPSDESItem.EMAIL, ourinfo.email.getDescription())); if (ourinfo.phone != null && ourinfo.phone.getDescription() != null) ownItems.add(new RTCPSDESItem(RTCPSDESItem.PHONE, ourinfo.phone.getDescription())); if (ourinfo.loc != null && ourinfo.loc.getDescription() != null) ownItems.add(new RTCPSDESItem(RTCPSDESItem.LOC, ourinfo.loc.getDescription())); if (ourinfo.tool != null && ourinfo.tool.getDescription() != null) ownItems.add(new RTCPSDESItem(RTCPSDESItem.TOOL, ourinfo.tool.getDescription())); if (ourinfo.note != null && ourinfo.note.getDescription() != null) ownItems.add(new RTCPSDESItem(RTCPSDESItem.NOTE, ourinfo.note.getDescription())); } sdesCounter++; ownSDES.items = ownItems.toArray(new RTCPSDESItem[ownItems.size()]); sdesChunks.add(ownSDES); for (Map.Entry<Integer, byte[]> entry : cnameRegistry.entrySet()) { RTCPSDES sdes = new RTCPSDES(); sdes.ssrc = entry.getKey(); sdes.items = new RTCPSDESItem[] {new RTCPSDESItem(RTCPSDESItem.CNAME, entry.getValue())}; } RTCPSDES[] sps = sdesChunks.toArray(new RTCPSDES[sdesChunks.size()]); RTCPSDESPacket sp = new RTCPSDESPacket(sps); return sp; }
/** * Makes sure that conference is allocated for given <tt>room</tt>. * * @param room name of the MUC room of Jitsi Meet conference. * @param properties configuration properties, see {@link JitsiMeetConfig} for the list of valid * properties. * @throws Exception if any error occurs. */ private void createConference(String room, Map<String, String> properties) throws Exception { JitsiMeetConfig config = new JitsiMeetConfig(properties); JitsiMeetConference conference = new JitsiMeetConference(room, focusUserName, protocolProviderHandler, this, config); conferences.put(room, conference); StringBuilder options = new StringBuilder(); for (Map.Entry<String, String> option : properties.entrySet()) { options.append("\n ").append(option.getKey()).append(": ").append(option.getValue()); } logger.info( "Created new focus for " + room + "@" + focusUserDomain + " conferences count: " + conferences.size() + " options:" + options.toString()); // Send focus created event EventAdmin eventAdmin = FocusBundleActivator.getEventAdmin(); if (eventAdmin != null) { eventAdmin.sendEvent(EventFactory.focusCreated(conference.getId(), conference.getRoomName())); } try { conference.start(); } catch (Exception e) { logger.info("Exception while trying to start the conference", e); conference.stop(); throw e; } }
/** * Notifies this instance that the dynamic payload types of the associated {@link MediaStream} * have changed. */ public void onDynamicPayloadTypesChanged() { rtxPayloadType = -1; rtxAssociatedPayloadType = -1; MediaStream mediaStream = channel.getStream(); Map<Byte, MediaFormat> mediaFormatMap = mediaStream.getDynamicRTPPayloadTypes(); Iterator<Map.Entry<Byte, MediaFormat>> it = mediaFormatMap.entrySet().iterator(); while (it.hasNext() && rtxPayloadType == -1) { Map.Entry<Byte, MediaFormat> entry = it.next(); MediaFormat format = entry.getValue(); if (!Constants.RTX.equalsIgnoreCase(format.getEncoding())) { continue; } // XXX(gp) we freak out if multiple codecs with RTX support are // present. rtxPayloadType = entry.getKey(); rtxAssociatedPayloadType = Byte.parseByte(format.getFormatParameters().get("apt")); } }