コード例 #1
0
    /**
     * Adds a <tt>payload-type</tt> element defined by XEP-0167: Jingle RTP Sessions to this
     * <tt>channel</tt>.
     *
     * @param payloadType the <tt>payload-type</tt> element to be added to this <tt>channel</tt>
     * @return <tt>true</tt> if the list of <tt>payload-type</tt> elements associated with this
     *     <tt>channel</tt> has been modified as part of the method call; otherwise, <tt>false</tt>
     * @throws NullPointerException if the specified <tt>payloadType</tt> is <tt>null</tt>
     */
    public boolean addPayloadType(PayloadTypePacketExtension payloadType) {
      if (payloadType == null) throw new NullPointerException("payloadType");

      // Make sure that the COLIBRI namespace is used.
      payloadType.setNamespace(null);
      for (ParameterPacketExtension p : payloadType.getParameters()) p.setNamespace(null);

      return payloadTypes.contains(payloadType) ? false : payloadTypes.add(payloadType);
    }
コード例 #2
0
    @Override
    protected void printContent(StringBuilder xml) {
      List<PayloadTypePacketExtension> payloadTypes = getPayloadTypes();
      List<SourcePacketExtension> sources = getSources();
      int[] ssrcs = getSSRCs();

      for (PayloadTypePacketExtension payloadType : payloadTypes) xml.append(payloadType.toXML());

      for (SourcePacketExtension source : sources) xml.append(source.toXML());

      for (int i = 0; i < ssrcs.length; i++) {
        xml.append('<')
            .append(SSRC_ELEMENT_NAME)
            .append('>')
            .append(Long.toString(ssrcs[i] & 0xFFFFFFFFL))
            .append("</")
            .append(SSRC_ELEMENT_NAME)
            .append('>');
      }
    }