public boolean checkForMinimalOffer(SessionDescription sdp) throws SdpException { Vector<MediaDescription> mds = sdp.getMediaDescriptions(false); for (MediaDescription m : mds) { if (m.getMedia().getMediaFormats(false) == null) { return false; } } return true; }
/** Adds a media format to the media description. * Each element in this Vector should be an String value which matches one of the * a=rtpmap: attribute fields of the media description. * @param mediaFormats the format to add. * @throws SdpException if the vector is null */ public void setMediaFormats(Vector mediaFormats) throws SdpException { if (mediaFormats == null) throw new SdpException("The mediaFormats is null"); this.formats = mediaFormats; }
public RTPInfoImpl(final Connection connection, final MediaDescription mediaDescription) { this.connection = mediaDescription.getConnection() != null ? mediaDescription.getConnection() : connection; this.mediaDescription = mediaDescription; }
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; }
public boolean containsMedia(String media, SessionDescription sdp) throws SdpException { Vector<MediaDescription> mds = sdp.getMediaDescriptions(false); for (MediaDescription m : mds) { if (m.getMedia().getMediaType().equalsIgnoreCase(media)) { 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); } }
protected void setLocalDescriptor(String sdp) throws SdpException { this.localSdp = sdpFactory.createSessionDescription(sdp); }
@Override public int getMediaPort() { try { return this.mediaDescription.getMedia().getMediaPort(); } catch (final SdpParseException e) { throw new RuntimeException("TODO: real exception pls", e); } }
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; }
public boolean containsMedia(String media, SessionDescription sdp) throws SdpException { Vector<MediaDescription> mds = sdp.getMediaDescriptions(false); for (MediaDescription m : mds) { if (m.getMedia().getMediaType().equalsIgnoreCase(media)) { return true; } } return false; }
public boolean checkForMinimalOffer(SessionDescription sdp) throws SdpException { Vector<MediaDescription> mds = sdp.getMediaDescriptions(false); for (MediaDescription m : mds) { if (m.getMedia().getMediaFormats(false) == null) { return false; } } return true; }
@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); } }
@Override public int getMediaPort() { try { return this.mediaDescription.getMedia().getMediaPort(); } catch (final SdpParseException e) { throw new RuntimeException("TODO: real exception pls", e); } }
public RTPInfoImpl(final Connection connection, final MediaDescription mediaDescription) { this.connection = mediaDescription.getConnection() != null ? mediaDescription.getConnection() : connection; this.mediaDescription = mediaDescription; }
/** Sets the name of the session originator. * @param user the string username. * @throws SdpException if the parameter is null */ public void setUsername(String user) throws SdpException { if (user == null) throw new SdpException("The user parameter is null"); else { this.username = user; } }
/** Returns the type of the network for this Connection. * @param type to set * @throws SdpException if the type is null */ public void setAddressType(String type) throws SdpException { if (type == null) throw new SdpException("the type is null"); this.addrtype = type; }
/** * Set Preconditions * * @param preconditions - vector with precondition attributes * @throws SdpException -- if precondition attributes is null */ public void setPreconditions(Vector preconditions) throws SdpException { if (preconditions == null) throw new SdpException("Precondition attributes are null"); else preconditionAttributes = preconditions; }
/** * set the value of the Bandwidth with the specified type * * @param bandwidths * type of the Bandwidth object whose value is requested * @throws SdpException * if vector is null */ public void setBandwidths(Vector bandwidths) throws SdpException { if (bandwidths == null) throw new SdpException("The vector bandwidths is null"); this.bandwidthFields = bandwidths; }
/** * Adds the specified Attribute to this Description object. * * @param attributes - the attribute to add * @throws SdpException * if the vector is null */ public void setAttributes(Vector attributes) throws SdpException { if (attributes == null) throw new SdpException("The parameter is null"); else attributesList = attributes; }
/** * set the value of the Bandwidth with the specified type. * * @param bandwidthList * to set * @throws SdpException * if the vector is null */ public void setBandwidths(Vector bandwidthList) throws SdpException { if (bandwidthList == null) throw new SdpException("The parameter is null"); else this.bandwidthList = bandwidthList; }