@Override public int getMediaPort() { try { return this.mediaDescription.getMedia().getMediaPort(); } catch (final SdpParseException e) { throw new RuntimeException("TODO: real exception pls", e); } }
public void excludeAttribute(String id, MediaDescription m) throws SdpParseException { Vector<Attribute> attributes = m.getAttributes(false); int count = 0; for (Attribute a : attributes) { if (a.getName().equalsIgnoreCase("rtpmap")) { String[] tokens = a.getValue().split(" "); if (tokens[0].trim().equalsIgnoreCase(id)) { break; } } count++; } if (count < attributes.size()) { attributes.remove(count); } }
/** * Convenience method for creating a new {@link RTPInfo} object. * * @param connection * the connection (the c-field) information from the SDP or null * if there were none. * @param md * the media description from the SDP * @return a new {@link RTPInfo} object if the {@link MediaDescription} was * of type "RTP/AVP", otherwise null. * @throws SdpParseException */ private RTPInfo processMediaDescription(final Connection connection, final MediaDescription md) throws SdpParseException { final Media m = md.getMedia(); if ("RTP/AVP".equalsIgnoreCase(m.getProtocol())) { final Connection c = md.getConnection() != null ? null : connection; return new RTPInfoImpl(connection, md); } return null; }
private static HashMap<Integer, Format> getVideoFormats(MediaDescription md) throws SdpParseException, SdpException { HashMap<Integer, Format> formats = new HashMap<Integer, Format>(); Media media = md.getMedia(); Enumeration<String> payloads = media.getMediaFormats(false).elements(); while (payloads.hasMoreElements()) { int payload = Integer.parseInt((String) payloads.nextElement()); Format fmt = AVProfile.getVideoFormat(payload); if (fmt != null) { formats.put(new Integer(payload), fmt); } } Enumeration attributes = md.getAttributes(false).elements(); while (attributes.hasMoreElements()) { Attribute attribute = (Attribute) attributes.nextElement(); if (attribute.getName().equals("rtpmap")) { RTPVideoFormat fmt = RTPVideoFormat.parseFormat(attribute.getValue()); formats.put(new Integer(fmt.getPayloadType()), fmt); } } return formats; }
String[] rtcpValues; for (int i = 0; i < sourceMediaDescriptions.size(); i++) { attributes = sourceMediaDescriptions.get(i).getAttributes(false); bandwidth = sourceMediaDescriptions.get(i).getBandwidths(false); currMedia = sourceMediaDescriptions.get(i).getMedia(); dataPort = currMedia.getMediaPort(); rtcpPort = currMedia.getMediaPort() + 1; if (sourceMediaDescriptions.get(i).getConnection() != null) rtcpAddress = sourceMediaDescriptions.get(i).getConnection().getAddress(); else rtcpAddress = sourceSessionDescription.getConnection().getAddress(); for (int i = 0; i < destinationMediaDescriptions.size(); i++) { found = false; currMedia = destinationMediaDescriptions.get(i).getMedia(); mediaType = currMedia.getMediaType().toLowerCase(); attributes = destinationMediaDescriptions.get(i).getAttributes(false); bandwidth = destinationMediaDescriptions.get(i).getBandwidths(false); dataPort = currMedia.getMediaPort(); rtcpPort = currMedia.getMediaPort() + 1; if (destinationMediaDescriptions.get(i).getConnection() != null) rtcpAddress = destinationMediaDescriptions.get(i).getConnection().getAddress(); else rtcpAddress = destinationSessionDescription.getConnection().getAddress();
mediaDescription.setAttribute(MID, iceMediaStream.getName()); firstComponent = component; Vector attributes = mediaDescription.getAttributes(true); for(Candidate<?> candidate : component.getLocalCandidates()) .getDefaultCandidate().getTransportAddress(); mediaDescription.getMedia().setMediaPort( defaultAddress.getPort()); : Connection.IP4; mediaDescription.setConnection(sdpFactory.createConnection( "IN", defaultAddress.getHostAddress(), addressFamily)); mediaDescription.setAttribute( RTCP, Integer.toString(defaultRtcpCandidate.getPort()));
public RTPInfoImpl(final Connection connection, final MediaDescription mediaDescription) { this.connection = mediaDescription.getConnection() != null ? mediaDescription.getConnection() : connection; this.mediaDescription = mediaDescription; }
private Collection<RTPFormat> getRTPFormats(MediaDescription md) throws SdpParseException { ArrayList<RTPFormat> formats = new ArrayList(); Vector<String> fmts = md.getMedia().getMediaFormats(false); Vector<Attribute> attributes = md.getAttributes(false);
String[] rtcpValues; for (int i = 0; i < sourceMediaDescriptions.size(); i++) { attributes = sourceMediaDescriptions.get(i).getAttributes(false); bandwidth = sourceMediaDescriptions.get(i).getBandwidths(false); currMedia = sourceMediaDescriptions.get(i).getMedia(); dataPort = currMedia.getMediaPort(); rtcpPort = currMedia.getMediaPort() + 1; if (sourceMediaDescriptions.get(i).getConnection() != null) rtcpAddress = sourceMediaDescriptions.get(i).getConnection().getAddress(); else rtcpAddress = sourceSessionDescription.getConnection().getAddress();
public RTPInfoImpl(final Connection connection, final MediaDescription mediaDescription) { this.connection = mediaDescription.getConnection() != null ? mediaDescription.getConnection() : connection; this.mediaDescription = mediaDescription; }
private Collection<RTPFormat> getRTPFormats(MediaDescription md) throws SdpParseException { ArrayList<RTPFormat> formats = new ArrayList(); Vector<String> fmts = md.getMedia().getMediaFormats(false); Vector<Attribute> attributes = md.getAttributes(false);
private void excludeFormat(String id, MediaDescription m) throws SdpParseException { Vector<String> fmts = m.getMedia().getMediaFormats(false); int count = 0; for (String s : fmts) { if (s.equals(id)) { break; } count++; } if (count < fmts.size()) { fmts.remove(count); } }
/** * Convenience method for creating a new {@link RTPInfo} object. * * @param connection * the connection (the c-field) information from the SDP or null * if there were none. * @param md * the media description from the SDP * @return a new {@link RTPInfo} object if the {@link MediaDescription} was * of type "RTP/AVP", otherwise null. * @throws SdpParseException */ private RTPInfo processMediaDescription(final Connection connection, final MediaDescription md) throws SdpParseException { final Media m = md.getMedia(); if ("RTP/AVP".equalsIgnoreCase(m.getProtocol())) { final Connection c = md.getConnection() != null ? null : connection; return new RTPInfoImpl(connection, md); } return null; }
public boolean containsFormat(String format, SessionDescription sdp) throws SdpException { Vector<MediaDescription> mds = sdp.getMediaDescriptions(false); for (MediaDescription m : mds) { Vector<Attribute> attributes = m.getAttributes(false); for (Attribute a : attributes) { if (a.getName().equalsIgnoreCase("rtpmap") && a.getValue().toLowerCase().contains(format.toLowerCase())) { return true; } } } return false; }
@Override public String getAddress() { try { if (this.connection != null) { return this.connection.getAddress(); } return this.mediaDescription.getConnection().getAddress(); } catch (final SdpParseException e) { throw new RuntimeException("TODO: real exception pls", e); } }
private static HashMap<Integer, Format> getVideoFormats(MediaDescription md) throws SdpParseException, SdpException { HashMap<Integer, Format> formats = new HashMap<Integer, Format>(); Media media = md.getMedia(); Enumeration<String> payloads = media.getMediaFormats(false).elements(); while (payloads.hasMoreElements()) { int payload = Integer.parseInt((String) payloads.nextElement()); Format fmt = AVProfile.getVideoFormat(payload); if (fmt != null) { formats.put(new Integer(payload), fmt); } } Enumeration attributes = md.getAttributes(false).elements(); while (attributes.hasMoreElements()) { Attribute attribute = (Attribute) attributes.nextElement(); if (attribute.getName().equals("rtpmap")) { RTPVideoFormat fmt = RTPVideoFormat.parseFormat(attribute.getValue()); formats.put(new Integer(fmt.getPayloadType()), fmt); } } return formats; }
@Override public int getMediaPort() { try { return this.mediaDescription.getMedia().getMediaPort(); } catch (final SdpParseException e) { throw new RuntimeException("TODO: real exception pls", e); } }
public void excludeAttribute(String id, MediaDescription m) throws SdpParseException { Vector<Attribute> attributes = m.getAttributes(false); int count = 0; for (Attribute a : attributes) { if (a.getName().equalsIgnoreCase("rtpmap")) { String[] tokens = a.getValue().split(" "); if (tokens[0].trim().equalsIgnoreCase(id)) { break; } } count++; } if (count < attributes.size()) { attributes.remove(count); } }
@Override public String getAddress() { try { if (this.connection != null) { return this.connection.getAddress(); } return this.mediaDescription.getConnection().getAddress(); } catch (final SdpParseException e) { throw new RuntimeException("TODO: real exception pls", e); } }
private static HashMap<Integer, Format> getAudioFormats(MediaDescription md) throws SdpParseException, SdpException { HashMap<Integer, Format> formats = new HashMap<Integer, Format>(); Media media = md.getMedia(); Enumeration payloads = media.getMediaFormats(false).elements(); while (payloads.hasMoreElements()) { int payload = Integer.parseInt((String) payloads.nextElement()); Format fmt = AVProfile.getAudioFormat(payload); if (fmt != null) { formats.put(new Integer(payload), fmt); } } Enumeration attributes = md.getAttributes(false).elements(); while (attributes.hasMoreElements()) { Attribute attribute = (Attribute) attributes.nextElement(); if (attribute.getName().equals("rtpmap")) { RTPAudioFormat fmt = RTPAudioFormat.parseRtpmapFormat(attribute.getValue()); if (fmt != null) { formats.put(new Integer(fmt.getPayloadType()), fmt); } } } return formats; }