亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mediamanager.java

?? 是一個用java實現的
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
		prepareMediaSession(incomingSdpBody);
		SessionDescription sessionDescription = null;
		try {
			sessionDescription =
				sdpFactory.createSessionDescription(incomingSdpBody);
			//Get the remote address where the user agent has to connect to
			Connection remoteConnection = sessionDescription.getConnection();
			remoteAddress = remoteConnection.getAddress();
		} catch (SdpParseException spe) {
			spe.printStackTrace();
		}
		//Constructing the sdp response body
		SessionDescription responseSessionDescription = null;
		try {
			responseSessionDescription =
				(SessionDescription) sessionDescription.clone();
		} catch (CloneNotSupportedException cnse) {
			cnse.printStackTrace();
		}
		try {
			//Connection
			Connection connection =
				sdpFactory.createConnection(
					callListener.getConfiguration().contactIPAddress);
			responseSessionDescription.setConnection(connection);
			//Owner
			long sdpSessionId=(long)(Math.random() * 1000000);		
			Origin origin =
				sdpFactory.createOrigin(
					callListener.sipMeetingManager.getUserURI().getUser(),
					sdpSessionId,
					sdpSessionId+1369,
					"IN",
					"IP4",
				callListener.getConfiguration().contactIPAddress);			
			responseSessionDescription.setOrigin(origin);
		} catch (SdpException se) {
			se.printStackTrace();
		}
		//Media Description        
		Vector mediaDescriptions = new Vector();
		if (negotiatedAudioCodec != null) {
			System.out.println(
				"Negotiated audio codec "
					+ negotiatedAudioCodec
					+ " on Port "
					+ localAudioPort);
			MediaDescription mediaDescription =
				sdpFactory.createMediaDescription(
					"audio",
					localAudioPort,
					1,
					"RTP/AVP",
					new String[] { negotiatedAudioCodec });
			mediaDescriptions.add(mediaDescription);
		} else {
			System.out.println(
				"No Negotiated audio codec,"
					+ "so no audio media descriptions will be added to the sdp body");
		}
		if (negotiatedVideoCodec != null) {
			System.out.println(
				"Negotiated video codec "
					+ negotiatedVideoCodec
					+ " on Port "
					+ localVideoPort);
			MediaDescription mediaDescription =
				sdpFactory.createMediaDescription(
					"video",
					localVideoPort,
					1,
					"RTP/AVP",
					new String[] { negotiatedVideoCodec });
			mediaDescriptions.add(mediaDescription);
		} else {
			System.out.println(
				"No Negotiated video codec,"
					+ "so no video media descriptions will be added to the sdp body");
		}
		try {
			responseSessionDescription.setMediaDescriptions(mediaDescriptions);
		} catch (SdpException se) {
			se.printStackTrace();
		}

		return responseSessionDescription;
	}

	/**
	 * Extracts all the audio codecs from the description of the media session of the incoming request
	 * @param sessionDescription - the description of the media session of the incoming request
	 * @return List of all the audio codecs from the description of the media session of the incoming request
	 */
	public List extractAudioCodecs(SessionDescription sessionDescription) {
		List audioCodecList = new Vector();
		Vector mediaDescriptionList = null;
		try {
			mediaDescriptionList =
				sessionDescription.getMediaDescriptions(true);
		} catch (SdpException se) {
			se.printStackTrace();
		}
		try {
			for (int i = 0; i < mediaDescriptionList.size(); i++) {
				MediaDescription mediaDescription =
					(MediaDescription) mediaDescriptionList.elementAt(i);
				Media media = mediaDescription.getMedia();
				if (media.getMediaType().equals("audio"))
					audioCodecList = media.getMediaFormats(true);
			}
		} catch (SdpParseException spe) {
			spe.printStackTrace();
		}
		return audioCodecList;
	}

	/**
	 * Extracts all the video codecs from the description of the media session of the incoming request
	 * @param sessionDescription - the description of the media session of the incoming request
	 * @return List of all the audio codecs from the description of the media session of the incoming request
	 */
	public List extractVideoCodecs(SessionDescription sessionDescription) {
		List videoCodecList = new Vector();
		Vector mediaDescriptionList = null;
		try {
			mediaDescriptionList =
				sessionDescription.getMediaDescriptions(true);
		} catch (SdpException se) {
			se.printStackTrace();
		}
		try {
			for (int i = 0; i < mediaDescriptionList.size(); i++) {
				MediaDescription mediaDescription =
					(MediaDescription) mediaDescriptionList.elementAt(i);
				Media media = mediaDescription.getMedia();
				if (mediaDescription.getMedia().getMediaType().equals("video"))
					videoCodecList = media.getMediaFormats(true);
			}
		} catch (SdpParseException spe) {
			spe.printStackTrace();
		}
		return videoCodecList;
	}

	/**
	 * Extracts the audio port from the description of the media session of the incoming request
	 * @param sessionDescription - the description of the media session of the incoming request
	 * @return the audio port on which is listening the remote user agent
	 */
	public int getAudioPort(SessionDescription sessionDescription) {
		Vector mediaDescriptionList = null;
		try {
			mediaDescriptionList =
				sessionDescription.getMediaDescriptions(true);
		} catch (SdpException se) {
			se.printStackTrace();
		}
		try {
			for (int i = 0; i < mediaDescriptionList.size(); i++) {
				MediaDescription mediaDescription =
					(MediaDescription) mediaDescriptionList.elementAt(i);
				if (mediaDescription.getMedia().getMediaType().equals("audio"))
					return mediaDescription.getMedia().getMediaPort();
			}
		} catch (SdpParseException spe) {
			spe.printStackTrace();
		}
		return -1;
	}

	/**
	 * Extracts the video port from the description of the media session of the incoming request
	 * @param sessionDescription - the description of the media session of the incoming request
	 * @return the video port on which is listening the remote user agent
	 */
	public int getVideoPort(SessionDescription sessionDescription) {
		Vector mediaDescriptionList = null;
		try {
			mediaDescriptionList =
				sessionDescription.getMediaDescriptions(true);
		} catch (SdpException se) {
			se.printStackTrace();
		}
		try {
			for (int i = 0; i < mediaDescriptionList.size(); i++) {
				MediaDescription mediaDescription =
					(MediaDescription) mediaDescriptionList.elementAt(i);
				if (mediaDescription.getMedia().getMediaType().equals("video"))
					return mediaDescription.getMedia().getMediaPort();
			}
		} catch (SdpParseException spe) {
			spe.printStackTrace();
		}
		return -1;
	}

	/**
	 * Find the best codec between our own supported codecs 
	 * and the remote supported codecs to initiate the media session
	 * Currently, take the first one to match
	 * @param audioCodecList - the list of the remote audio supported codecs
	 * @return the negotiated audio codec
	 */
	public String negotiateAudioCodec(List audioCodecList) {
		//Find the mapping of the jmf format to the sdp format
		List audioCodecSupportedSdpFormat = new Vector();
		Iterator it = audioCodecSupportedList.iterator();
		while (it.hasNext()) {
			String sdpCodecValue =
				findCorrespondingSdpFormat(((Format) it.next()).getEncoding());
			if (sdpCodecValue != null)
				audioCodecSupportedSdpFormat.add(sdpCodecValue);
		}
		//find the best codec(currently the first one which is in both list)
		Iterator iteratorSupportedCodec =
			audioCodecSupportedSdpFormat.iterator();
		while (iteratorSupportedCodec.hasNext()) {
			String supportedCodec = (String) iteratorSupportedCodec.next();
			Iterator iteratorRemoteCodec = audioCodecList.iterator();
			while (iteratorRemoteCodec.hasNext()) {
				String remoteCodec = iteratorRemoteCodec.next().toString();
				if (remoteCodec.equals(supportedCodec))
					return remoteCodec;
			}
		}
		return null;
	}

	/**
	 * Find the best codec between our own supported codecs 
	 * and the remote supported codecs to initiate the media session
	 * Currently, take the first one to match
	 * @param videoCodecList - the list of the remote video supported codecs
	 * @return the negotiated video codec
	 */
	public String negotiateVideoCodec(List videoCodecList) {
		//Find the mapping of the jmf format to the sdp format
		List videoCodecSupportedSdpFormat = new Vector();
		Iterator it = videoCodecSupportedList.iterator();
		while (it.hasNext()) {
			String sdpCodecValue =
				findCorrespondingSdpFormat(((Format) it.next()).getEncoding());
			if (sdpCodecValue != null)
				videoCodecSupportedSdpFormat.add(sdpCodecValue);
		}
		//find the best codec(currently the first one which is in both list)        
		Iterator iteratorSupportedCodec =
			videoCodecSupportedSdpFormat.iterator();
		while (iteratorSupportedCodec.hasNext()) {
			String supportedCodec = (String) iteratorSupportedCodec.next();
			Iterator iteratorRemoteCodec = videoCodecList.iterator();
			while (iteratorRemoteCodec.hasNext()) {
				String remoteCodec = iteratorRemoteCodec.next().toString();
				if (remoteCodec.equals(supportedCodec))
					return remoteCodec;
			}
		}
		return null;
	}

	/**
	 * Utility method to print the remote codecs
	 */
	public void printCodecs(List codecList) {
		System.out.println("List of codecs: ");
		Iterator it = codecList.iterator();
		while (it.hasNext()) {
			String att = it.next().toString();
			System.out.println(att);
		}
	}

	/**
	 * Utility method to print the supported codecs
	 */
	public void printSupportedCodecs() {
		System.out.println("List of supported audio codecs: ");
		Iterator it = audioCodecSupportedList.iterator();
		while (it.hasNext()) {
			System.out.println(((Format) it.next()).toString());
		}
		System.out.println("List of supported video codecs: ");
		it = videoCodecSupportedList.iterator();
		while (it.hasNext()) {
			System.out.println(((Format) it.next()).toString());
		}
	}

	/**
	 * Utility method to print the supported codecs in parameter
	 * @param codecList - the list of codec to print out
	 */
	public void printSupportedCodecs(List codecList) {
		System.out.println("List of codecs: ");
		Iterator it = codecList.iterator();
		while (it.hasNext()) {
			System.out.println(it.next());
		}
	}

	/**
	 * Retrieve the audio port for this media session,
	 * if no audio port has been allowed it will choose one and return it
	 * @return the audio port for this media session
	 */
	public int getAudioPort() {
		if (localAudioPort == -1) {
			localAudioPort = new Random().nextInt(8885);
			if (localAudioPort % 2 == 0)
				localAudioPort += 1024;
			else
				localAudioPort += 1025;
		}
		return localAudioPort;
	}

	/**
	 * Retrieve the video port for this media session,
	 * if no video port has been allowed it will choose one and return it
	 * @return the video port for this media session
	 */
	public int getVideoPort() {
		if (localVideoPort == -1) {
			localVideoPort = new Random().nextInt(8885);
			if (localVideoPort % 2 == 0)
				localVideoPort += 1024;
			else
				localVideoPort += 1025;
		}
		return localVideoPort;
	}

	/**
	 * Map a jmf format to a sdp format
	 * @param jmfFormat - the jmf Format
	 * @return the corresponding sdp format
	 */
	public static String findCorrespondingSdpFormat(String jmfFormat) {
		if (jmfFormat == null) {
			return null;
		} else if (jmfFormat.equals(AudioFormat.ULAW_RTP)) {
			return Integer.toString(SdpConstants.PCMU);
		} else if (jmfFormat.equals(AudioFormat.GSM_RTP)) {
			return Integer.toString(SdpConstants.GSM);
		} else if (jmfFormat.equals(AudioFormat.G723_RTP)) {
			return Integer.toString(SdpConstants.G723);
		} else if (jmfFormat.equals(AudioFormat.DVI_RTP)) {
			return Integer.toString(SdpConstants.DVI4_8000);
		} else if (jmfFormat.equals(AudioFormat.DVI_RTP)) {
			return Integer.toString(SdpConstants.DVI4_16000);
		} else if (jmfFormat.equals(AudioFormat.ALAW)) {
			return Integer.toString(SdpConstants.PCMA);
		} else if (jmfFormat.equals(AudioFormat.G728_RTP)) {
			return Integer.toString(SdpConstants.G728);
		} else if (jmfFormat.equals(AudioFormat.G729_RTP)) {
			return Integer.toString(SdpConstants.G729);
		} else if (jmfFormat.equals(VideoFormat.H263_RTP)) {
			return Integer.toString(SdpConstants.H263);
		} else if (jmfFormat.equals(VideoFormat.JPEG_RTP)) {
			return Integer.toString(SdpConstants.JPEG);
		} else if (jmfFormat.equals(VideoFormat.H261_RTP)) {
			return Integer.toString(SdpConstants.H261);
		} else {
			return null;
		}
	}

	/**
	 * Map a sdp format to a jmf format
	 * @param sdpFormatStr - the sdp Format
	 * @return the corresponding jmf format
	 */
	public static String findCorrespondingJmfFormat(String sdpFormatStr) {
		int sdpFormat = -1;
		try {
			sdpFormat = Integer.parseInt(sdpFormatStr);
		} catch (NumberFormatException ex) {
			return null;
		}
		switch (sdpFormat) {
			case SdpConstants.PCMU :
				return AudioFormat.ULAW_RTP;
			case SdpConstants.GSM :
				return AudioFormat.GSM_RTP;
			case SdpConstants.G723 :
				return AudioFormat.G723_RTP;
			case SdpConstants.DVI4_8000 :
				return AudioFormat.DVI_RTP;
			case SdpConstants.DVI4_16000 :
				return AudioFormat.DVI_RTP;
			case SdpConstants.PCMA :
				return AudioFormat.ALAW;
			case SdpConstants.G728 :
				return AudioFormat.G728_RTP;
			case SdpConstants.G729 :
				return AudioFormat.G729_RTP;
			case SdpConstants.H263 :
				return VideoFormat.H263_RTP;
			case SdpConstants.JPEG :
				return VideoFormat.JPEG_RTP;
			case SdpConstants.H261 :
				return VideoFormat.H261_RTP;
			case 99 :
				return "mpegaudio/rtp, 48000.0 hz, 16-bit, mono";
			default :
				return null;
		}
	}
	/*PCMU 		javax.media.format.AudioFormat.ULAW_RTP;
	1016
	G721
	GSM 		javax.media.format.AudioFormat.GSM_RTP;
	G723		javax.media.format.AudioFormat.G723_RTP
	DVI4_8000           javax.media.format.AudioFormat.DVI_RTP;
	DVI4_16000          javax.media.format.AudioFormat.DVI_RTP;
	LPC
	PCMA		javax.media.format.AudioFormat.ALAW;
	G722		javax.media.format.AudioFormat.ALAW;
	L16_2CH
	L16_1CH
	QCELP
	CN
	MPA
	G728		javax.media.format.AudioFormat.G728_RTP;
	DVI4_11025
	DVI4_22050
	G729		javax.media.format.AudioFormat.G729_RTP
	CN_DEPRECATED
	H263		javax.media.format.VideoFormat.H263_RTP
	CelB
	JPEG		javax.media.format.VideoFormat.JPEG_RTP
	nv
	H261		javax.media.format.VideoFormat.H261_RTP
	MPV*/
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩黄色免费网站| 欧美一卡2卡3卡4卡| 国产乱码精品一区二区三 | 在线观看日韩电影| 7777精品伊人久久久大香线蕉的| 欧美精品在线观看播放| 2020国产精品自拍| 亚洲欧洲制服丝袜| 日本亚洲最大的色成网站www| 国产mv日韩mv欧美| 欧美精选午夜久久久乱码6080| 香蕉久久一区二区不卡无毒影院 | 激情欧美一区二区三区在线观看| av动漫一区二区| 欧美精品欧美精品系列| 日韩电影在线免费观看| 欧美变态口味重另类| 亚洲综合久久久| 久久激情综合网| 欧美在线免费播放| 美女久久久精品| 欧美午夜片在线观看| 亚洲三级在线免费观看| 国产一区三区三区| 日韩一区二区免费在线观看| 亚洲一区在线视频| 精品久久99ma| 一区二区久久久久久| 粉嫩欧美一区二区三区高清影视 | 狠狠久久亚洲欧美| 日本一区二区综合亚洲| 秋霞成人午夜伦在线观看| 色老头久久综合| 国产精品久久福利| 国产乱人伦偷精品视频免下载| 国产精品久久毛片a| 欧美蜜桃一区二区三区| 亚洲国产色一区| 欧美视频在线播放| 成人性视频网站| 国产精品视频免费| 风流少妇一区二区| 日韩黄色小视频| 亚洲卡通动漫在线| 欧美三级一区二区| 亚洲午夜久久久久久久久电影院| 精品少妇一区二区三区日产乱码 | 欧美午夜一区二区| 成人性生交大片免费看中文| 日本亚洲免费观看| 亚洲免费观看在线视频| 久久久精品天堂| av亚洲产国偷v产偷v自拍| 免费成人在线影院| 亚洲精品国产第一综合99久久 | 日本最新不卡在线| 亚洲自拍偷拍九九九| 国产精品毛片大码女人| 精品奇米国产一区二区三区| 欧美日韩免费在线视频| 99综合影院在线| 风间由美一区二区av101| 免费精品视频最新在线| 亚洲在线免费播放| 国产精品福利av | 中文字幕中文字幕一区二区| 精品国产乱码久久久久久图片| 欧美日韩国产高清一区| 色婷婷综合久久久中文一区二区| 亚洲免费高清视频在线| 国产精品盗摄一区二区三区| 久久精品欧美日韩精品| 日本久久精品电影| 日韩三级视频中文字幕| 欧美日韩国产综合一区二区三区| 色综合色综合色综合| 成人av资源站| 亚洲一区二区三区四区在线免费观看| 欧美激情综合网| 在线观看www91| 日本高清视频一区二区| 北岛玲一区二区三区四区| 国产盗摄女厕一区二区三区| 一区二区三区中文字幕精品精品| 国产精品理论在线观看| 国产偷国产偷精品高清尤物| 国产亚洲视频系列| 国产丝袜美腿一区二区三区| 久久久99久久| 久久久久久久精| 国产午夜亚洲精品羞羞网站| 久久久无码精品亚洲日韩按摩| 久久综合九色欧美综合狠狠| 久久综合中文字幕| 日本一区二区三区四区在线视频| 国产亚洲短视频| 中文字幕av一区二区三区高| 亚洲另类色综合网站| 亚洲乱码中文字幕| 亚洲成a人片综合在线| 首页国产丝袜综合| 琪琪久久久久日韩精品| 国产综合色在线视频区| 成人18精品视频| 欧美综合天天夜夜久久| 欧美精品1区2区3区| 欧美成人精品二区三区99精品| 欧美精品一区二区三区高清aⅴ | 欧美不卡一二三| 欧美岛国在线观看| 91一区二区三区在线观看| 亚洲成a人v欧美综合天堂下载 | 久久精品噜噜噜成人88aⅴ| 日本在线播放一区二区三区| 麻豆国产精品官网| 国产乱码精品一区二区三区av | 香蕉av福利精品导航| 日本不卡不码高清免费观看| 国产.精品.日韩.另类.中文.在线.播放| 国产毛片精品视频| www.一区二区| 欧美亚洲愉拍一区二区| 欧美一级理论片| 欧美激情综合在线| 无码av中文一区二区三区桃花岛| 欧美日韩精品一区二区在线播放| 91精品中文字幕一区二区三区| 日韩欧美视频一区| 精品日产卡一卡二卡麻豆| 国产日产欧美精品一区二区三区| 2020国产精品自拍| 五月天亚洲精品| 国产东北露脸精品视频| 91捆绑美女网站| 日韩一二三区视频| 国产精品盗摄一区二区三区| 麻豆专区一区二区三区四区五区| 国产91清纯白嫩初高中在线观看| 91婷婷韩国欧美一区二区| 538在线一区二区精品国产| 国产精品三级电影| 亚洲一区在线视频| 成人av第一页| 欧美一区二区播放| 亚洲免费观看高清完整版在线观看 | 欧美一卡2卡3卡4卡| 国产精品久久777777| 天堂蜜桃91精品| 成人晚上爱看视频| 欧美成人女星排名| 亚洲精品欧美在线| 国产精品亚洲专一区二区三区| xvideos.蜜桃一区二区| 午夜影院久久久| 不卡视频在线看| 精品人在线二区三区| 亚洲国产日韩精品| 成人美女在线观看| 欧美一区二区三区婷婷月色| 国产精品久久毛片a| 国产一区在线不卡| 3d动漫精品啪啪| 亚洲综合在线第一页| 国产成都精品91一区二区三| 日韩一区二区免费在线电影| 亚洲大片一区二区三区| 91视频国产观看| 久久综合久久鬼色中文字| 亚洲国产三级在线| 91官网在线观看| 亚洲男人电影天堂| 国产精品夜夜嗨| 国产精品久久久久久久久快鸭| 久久99九九99精品| 日韩亚洲电影在线| 日韩中文字幕一区二区三区| 91九色02白丝porn| 亚洲视频电影在线| av亚洲精华国产精华| 中文字幕精品一区二区三区精品| 国产综合色产在线精品| 制服丝袜一区二区三区| 美腿丝袜亚洲综合| 日韩一区二区麻豆国产| 日韩在线一二三区| 91精品视频网| 亚洲午夜精品在线| 欧美日韩一区二区在线观看 | 色菇凉天天综合网| 午夜私人影院久久久久| 欧美性大战久久久| 亚洲成人你懂的| 欧美日韩国产一区| 舔着乳尖日韩一区| 精品毛片乱码1区2区3区| 麻豆一区二区99久久久久| 久久影院午夜片一区| 国产精品中文欧美| 久久这里只有精品首页| 99re成人精品视频|