当前位置: 首页>>代码示例>>Java>>正文


Java MediaDescription.getAttribute方法代码示例

本文整理汇总了Java中javax.sdp.MediaDescription.getAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java MediaDescription.getAttribute方法的具体用法?Java MediaDescription.getAttribute怎么用?Java MediaDescription.getAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.sdp.MediaDescription的用法示例。


在下文中一共展示了MediaDescription.getAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSDPParseOffer

import javax.sdp.MediaDescription; //导入方法依赖的package包/类
@Test
public void testSDPParseOffer() throws Exception {
    Exchange ex = new DefaultExchange(new DefaultCamelContext());
    ex.getIn().setBody(offerSdp);
    processor.process(ex);
    assertEquals(ex.getIn().getBody().getClass(),Offer.class);

    Offer offer = (Offer)ex.getIn().getBody();

    MediaDescription mediaDescription = (MediaDescription) offer.getSdp().getMediaDescriptions(true).get(0);

    String icePwd = mediaDescription.getAttribute("ice-pwd");
    String iceUfrag = mediaDescription.getAttribute("ice-ufrag");
    String fingerprint = offer.getSdp().getAttribute("fingerprint");

    assertEquals(icePwd,"c490fef46f74bdbe64edd636bc49a259");
    assertEquals(iceUfrag,"64dc2277");
    assertEquals(fingerprint,"sha-256 99:45:B1:94:7E:97:AE:F2:A5:75:86:89:B5:AD:06:BB:63:02:FA:05:04:B2:83:1B:52:C9:EF:0E:61:8F:38:73");
}
 
开发者ID:IIlllII,项目名称:bitbreeds-webrtc,代码行数:20,代码来源:ProcessSignalsTest.java

示例2: parseSDP

import javax.sdp.MediaDescription; //导入方法依赖的package包/类
/**
 * Llegada la respuesta a una petición de DESCRIBE, esta debe contener
 * un SDP. Este método comprobará que el SDP viene y sacará los streams
 * que éste contiene almacenandolos para poder luego realizar las peticiones
 * SETUP/PLAY de estos streams.
 * @param content
 */
private void parseSDP(ChannelBuffer content) {

	if (content.readable()) {

		try {

			String str_content = content.toString(CharsetUtil.UTF_8);


			SDPAnnounceParser parser = new SDPAnnounceParser(str_content);
			SessionDescriptionImpl sdp = parser.parse();


			//Meto en el Player el SDP
			setSdp(sdp.toString());

			@SuppressWarnings("unchecked")
			Vector<MediaDescription> vec_md = sdp.getMediaDescriptions(false);

			//Obtengo del SDP los nombres de los medias que contiene.
			Iterator<MediaDescription> it = vec_md.iterator();

			streamsSetup = new ArrayList<String>();
			while(it.hasNext()) {
				MediaDescription md = it.next();
				String stream = md.getAttribute("control");
				streamsSetup.add(stream);
			}

		} catch (ParseException e) {
			createNotify("Parse SDP exception",false);
		} catch(Exception ex) {
			createNotify("Unhandled exception",false);
		}

	}
}
 
开发者ID:laggc,项目名称:rtsp_multicast_pfc,代码行数:45,代码来源:ClientRTSP.java

示例3: handleOffer

import javax.sdp.MediaDescription; //导入方法依赖的package包/类
/**
 *
 * @param offer the received offer
 * @return The answer to respond with.
 */
public Answer handleOffer(Offer offer) throws Exception {

    String fingerPrint = CertUtil.getCertFingerPrint(
            keyStoreInfo.getFilePath(),
            keyStoreInfo.getAlias(),
            keyStoreInfo.getPassword());

    SessionDescription sdp = offer.getSdp();
    sdp.setAttribute("fingerprint", fingerPrint);
    MediaDescription med = (MediaDescription)sdp.getMediaDescriptions(true).get(0);
    med.setAttribute("fingerprint", fingerPrint);

    String pwd = med.getAttribute("ice-pwd");
    String user = med.getAttribute("ice-ufrag");

    String cand = med.getAttribute("candidate");
    List<String> candData = Arrays.asList(cand.split(" "));

    String ip = candData.get(4);
    String port = candData.get(5);

    this.setRemote(new UserData(user,pwd));

    /**
     * TODO The below should be defined outside PeerConnection
     *
     * This is a huge hack now. Should follow browser API
     * and create datachannel from the outside.
     */
    DataChannelImpl conn = new DataChannelImpl(this);

    //Add handling of input
    conn.onOpen(() -> {
        logger.info("Running onOpen");
        conn.send("I'M SO OPEN!!!");
    });
    conn.onMessage((i)->{
        String in = new String(i.getData());
        //logger.info("Running onMessage: " + in);
        conn.send("ECHO: " + in);
    });
    conn.onError((i)->{
        logger.info("Received error",i.getError());
    });

    new Thread(conn).start();

    String localAddress = InetAddress.getLocalHost().getHostAddress();
    String address = System.getProperty("com.bitbreeds.ip",localAddress);
    logger.info("Adr: {}", address);
    med.setAttribute("ice-pwd",local.getPassword());
    med.setAttribute("ice-ufrag",local.getUserName());
    med.setAttribute("candidate","1 1 UDP 2122252543 "+address+" "+conn.getPort()+" typ host");

    return new Answer(sdp);
}
 
开发者ID:IIlllII,项目名称:bitbreeds-webrtc,代码行数:62,代码来源:PeerConnection.java


注:本文中的javax.sdp.MediaDescription.getAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。