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

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

?? receiver.java

?? 是一個用java實現的
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * Receiver.java
 *
 * Created on November 19, 2003, 10:38 AM
 */
package gov.nist.applet.phone.media.receiver;


import java.io.*;
import java.awt.*;
import java.net.*;
import java.util.Vector;

import javax.media.*;
import javax.media.rtp.*;
import javax.media.rtp.event.*;
import javax.media.protocol.DataSource;
import javax.media.format.AudioFormat;
import javax.media.format.VideoFormat;
import javax.media.Format;
import javax.media.control.BufferControl;
import javax.media.control.MpegAudioControl;
import javax.media.control.FrameRateControl;

import gov.nist.applet.phone.media.util.*;
import gov.nist.applet.phone.media.transmitter.*;
import gov.nist.applet.phone.media.protocol.transport.*;

/**
 * Class to receive RTP transmission using the JMF RTP API.
 * @author DERUELLE Jean
 */
public class Receiver implements ReceiveStreamListener, SessionListener, ControllerListener
{
    RTPManager mgrs[] = null;
    Vector playerWindows = null;
    private static boolean bye=false;
    boolean dataReceived = false;    
    SessionDescription sessionDescription=null;    
    Transmit transmitter=null;
    Socket socketRTPReceiver=null;
    Socket socketRTCPReceiver=null;
    /**
     * Constructor for Receiver 
     * @param session - the concatened parameters of the session stored in a string
     */
    public Receiver(String session) throws IllegalArgumentException{
        playerWindows = new Vector();
        //the session Label containing the address, the port and the Time To Live
        try {
           //create a session label on the session given in argument
           // and parse the session address.
           sessionDescription=new SessionDescription(session);
           sessionDescription.setAudioFormat("mpegaudio/rtp, 48000.0 hz, 16-bit, mono");
           sessionDescription.setVideoFormat("h263/rtp");
           sessionDescription.setTransportProtocol("tcp");
           if(sessionDescription.getVideoFormat()!=null && 
                sessionDescription.getAudioFormat()!=null)
               mgrs=new RTPManager[2];
           else if (sessionDescription.getVideoFormat()!=null ||
                sessionDescription.getAudioFormat()!=null)
               mgrs=new RTPManager[1];
           
        } catch (IllegalArgumentException e) {
            System.err.println("Failed to parse the session address given: " + session);
            throw e;
        }
    }

    /**
     * Constructor for Receiver
     * @param session - the session Description containing the address, the port, the Time To Live
     * the video format, the audio format and the transport protocol
     */
    public Receiver(SessionDescription session,Transmit transmitter) throws IllegalArgumentException{
        this.sessionDescription=session;
        if(sessionDescription.getVideoFormat()!=null && 
            sessionDescription.getAudioFormat()!=null)
           mgrs=new RTPManager[2];
       else if (sessionDescription.getVideoFormat()!=null ||
            sessionDescription.getAudioFormat()!=null)
           mgrs=new RTPManager[1];
        playerWindows = new Vector();
        this.transmitter=transmitter;
    }
    
    /**
     * Initialize the RTP Mamagers an wait for the data
     * There is one by stream
     * @return false if the rtpmanagers can't be initialized or if no data was received
     */
    protected boolean initialize(String localIpAddress) {
		if(mgrs==null)
			return false;
        try {
            for(int i=0;i<mgrs.length;i++){
                if(i==0){
                //Creates a new instance of RTPManager
                //which will allow us to create, maintain and close an RTP session.
                mgrs[i] = (RTPManager) RTPManager.newInstance();
                // create the local endpoint for the local interface on the port given in parameter
                int localPort=sessionDescription.getLocalPort()+2*i;
                // specify the remote endpoint of this unicast session on the port given in parameter
                int destPort=sessionDescription.getDestinationPort()+2*i;
                SessionAddress localAddr = new SessionAddress(
                	InetAddress.getByName(localIpAddress),
                	localPort);
				mgrs[i].addSessionListener(this);
				// add the ReceiveStreamListener to receive data
				mgrs[i].addReceiveStreamListener(this);
                // initialize the RTPManager, so the session
                if(sessionDescription.getTransportProtocol().toLowerCase().equals("tcp")){
                    if(transmitter==null){
                        TCPConnectionListener listener;
                        TCPConnectionListener ctrlListener;                        
                        int rtcpLocalPort=localPort+1;    
                        try {	    
                            //Start the serverSocket for the RTP 
                            ServerSocket serverSocket = new ServerSocket(localPort);
                            System.out.println("TCP Listening Point created on port: "+localPort);
                            listener=new TCPConnectionListener(serverSocket,  false);
                            listener.start();
                        } catch(SocketException e) {
                            System.out.println(localPort+","+destPort);
                            throw new IOException(e.getMessage());
                        }        
                        try{                            
                            //Start the serverSocket for the RTCP 
                            ServerSocket ctrlServerSocket = new ServerSocket(rtcpLocalPort);
                            System.out.println("TCP Control Listening Point created on port: "+rtcpLocalPort);
                            ctrlListener=new TCPConnectionListener(ctrlServerSocket,  true);
                            ctrlListener.start();
                        } catch(SocketException e) {
                            System.out.println(rtcpLocalPort+","+destPort);
                            throw new IOException(e.getMessage());
                        }        
                        //Wait for connections
                        socketRTPReceiver=listener.waitForConnections();
                        socketRTCPReceiver=ctrlListener.waitForConnections();                                             
                    }
                    else{
                        socketRTPReceiver=transmitter.getSocketRTPTransmit();
                        socketRTCPReceiver=transmitter.getSocketRTCPTransmit();
                    }
                    mgrs[i].initialize(new TCPReceiveAdapter(socketRTPReceiver,socketRTCPReceiver));
                }
                else{
					System.out.println("Init UDP Transmitter");           					
					mgrs[i].initialize(localAddr);					    
                }                                                
  			    InetAddress remoteIPAddress = InetAddress.getByName(sessionDescription.getAddress());
                SessionAddress remoteDestinationAddressAndPort = new SessionAddress(remoteIPAddress, destPort);
                // You can try out some other buffer size to see
                // if you can get better smoothness.
                BufferControl bc = (BufferControl) mgrs[i].getControl(
                        "javax.media.control.BufferControl");
                if (bc != null){
                        if(i==0){
                                bc.setBufferLength(0);
                                //bc.setMinimumThreshold(0);
                                System.out.println("Threshold enabled : "+bc.getEnabledThreshold());
                                System.out.println("buf length : "+bc.getBufferLength());
                                System.out.println("minimum Threshold : "+bc.getMinimumThreshold());
                        }
                        else{
                                bc.setBufferLength(BufferControl.MAX_VALUE);
                                //bc.setMinimumThreshold(BufferControl.MAX_VALUE);
                                System.out.println("buf length : "+bc.getBufferLength());
                                System.out.println("minimum Threshold : "+bc.getMinimumThreshold());
                        }
                }
				if(sessionDescription.getTransportProtocol().toLowerCase().equals("udp")){					
					SessionAddress destAddr = new SessionAddress(
							InetAddress.getByName(sessionDescription.getAddress()),
							 destPort);                
					mgrs[i].addTarget(destAddr);
				}
                System.out.println("  - Open RTP session for: Address: " + sessionDescription.getAddress() +
                                                   " localPort: " + localPort + 
                                                   " destPort : " + destPort +                                                  
                                                   " Time To Live: " + sessionDescription.getTimeToLive());
                }
            }
        } catch (Exception e){
            System.err.println("Cannot create the RTP Session: ");
			e.printStackTrace();
            return false;
        }

        // Wait for data to arrive before moving on.
        /*long then = System.currentTimeMillis();
        long waitingPeriod = 30000;  // wait for a maximum of 30 secs.

        try{
            synchronized (dataSync) {
                while (!dataReceived && System.currentTimeMillis() - then < waitingPeriod) {
                    if (!dataReceived)
                        System.err.println("  - Waiting for RTP data to arrive...");
                    dataSync.wait(1000);
                }
            }
        } catch (Exception e) {}

        if (!dataReceived) {
            System.err.println("No RTP data was received.");
            close();
            return false;
        }*/
        System.err.println("  - Waiting for RTP data to arrive...");
        return true;
    }


    /**
     * Close the players and the session managers.
     */
    protected void close() {

        for (int i = 0; i < playerWindows.size(); i++) {
            try {
                ((PlayerWindow)playerWindows.elementAt(i)).close();
            } catch (Exception e) {}
        }

        playerWindows.removeAllElements();

        //close the RTP session.
        for(int i=0;i<mgrs.length;i++){
            if (mgrs[i] != null) {
                mgrs[i].removeTargets( "Closing session from Receiver");
                mgrs[i].dispose();
                mgrs[i] = null;
            }
        }
    }


    PlayerWindow find(Player p) {
        for (int i = 0; i < playerWindows.size(); i++) {
            PlayerWindow pw = (PlayerWindow)playerWindows.elementAt(i);
            if (pw.player == p)
                return pw;
        }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91网址在线看| 成人免费一区二区三区在线观看| 亚洲三级视频在线观看| 欧美日本一区二区三区四区| 精品亚洲成a人在线观看| 国产精品久久久久久久久快鸭| 日本高清不卡一区| 国产精品自在在线| 亚洲影院免费观看| 国产三级三级三级精品8ⅰ区| 91女厕偷拍女厕偷拍高清| 日韩影院免费视频| 久久久777精品电影网影网 | 国产麻豆精品theporn| 亚洲欧美国产高清| 日韩精品一区二区在线| 粉嫩av亚洲一区二区图片| 亚洲高清视频的网址| 国产精品毛片高清在线完整版| 在线观看日韩一区| 国产精品888| 日日摸夜夜添夜夜添国产精品| 中文字幕日本乱码精品影院| 欧美一三区三区四区免费在线看| 99国产精品一区| 国产精品18久久久久久久网站| 奇米一区二区三区av| 一区二区三区在线观看欧美| 亚洲精品一区二区三区蜜桃下载| 在线观看精品一区| 99久久久国产精品免费蜜臀| 成人免费高清在线观看| 国产一区二区福利视频| 免费在线观看一区| 午夜亚洲福利老司机| 一区二区三区欧美视频| 亚洲人成在线播放网站岛国| 日本一区二区高清| 久久蜜桃av一区二区天堂| 欧美一区二区三区白人 | 日韩免费看网站| 欧美日韩精品一区二区三区四区| 99精品视频中文字幕| 国产高清成人在线| 秋霞影院一区二区| 日本中文在线一区| 婷婷一区二区三区| 日韩vs国产vs欧美| 午夜精品久久久久久久久久久| 一区二区三区欧美亚洲| 一区二区三区中文字幕精品精品| 亚洲欧洲日韩一区二区三区| 亚洲精品在线电影| 精品国产91乱码一区二区三区| 欧美片网站yy| 91女人视频在线观看| 精品成人一区二区| 色综合久久中文综合久久牛| 91浏览器入口在线观看| 91蜜桃在线观看| 欧美中文字幕一二三区视频| www.欧美色图| 一本到三区不卡视频| 91久久精品网| 欧美乱熟臀69xxxxxx| 欧美精品成人一区二区三区四区| 欧美精三区欧美精三区| 91精品在线免费| 欧美一区二区三区免费在线看| 日韩欧美卡一卡二| 久久这里只有精品视频网| 欧美老年两性高潮| 91成人免费网站| 91九色最新地址| 欧美日韩另类国产亚洲欧美一级| 欧美美女网站色| 久久久久久久久久久黄色| 久久久激情视频| 中文字幕一区二区日韩精品绯色| 国产精品成人网| 亚洲成a人v欧美综合天堂| 免费看欧美女人艹b| 国产麻豆视频一区| 91蜜桃传媒精品久久久一区二区| 欧美色综合影院| 欧美大片免费久久精品三p | 欧美精品乱码久久久久久按摩| 在线亚洲欧美专区二区| 欧美日韩国产高清一区二区 | 91久久精品一区二区二区| 欧美日韩国产片| www国产成人| 亚洲人成精品久久久久久| 午夜精品一区二区三区三上悠亚| 国内精品伊人久久久久av一坑| www..com久久爱| 欧美一区二区视频在线观看2022 | 欧美电影在哪看比较好| 国产午夜精品一区二区三区嫩草| 一区二区在线看| 国产在线视视频有精品| 欧美在线影院一区二区| 精品久久久久香蕉网| 亚洲六月丁香色婷婷综合久久 | 成人国产精品视频| 色婷婷久久久综合中文字幕| 欧美日韩第一区日日骚| 国产精品色婷婷久久58| 美女脱光内衣内裤视频久久网站| 成人精品在线视频观看| 欧美一区二区三区系列电影| 1000部国产精品成人观看| 日本成人在线电影网| 一本到三区不卡视频| 久久久美女艺术照精彩视频福利播放| 亚洲一区二区三区四区的 | 美国毛片一区二区| 92国产精品观看| 国产视频亚洲色图| 日韩高清国产一区在线| 国产米奇在线777精品观看| 欧美日韩免费观看一区三区| 国产精品麻豆一区二区| 国内精品第一页| 日韩亚洲欧美成人一区| 亚洲精品伦理在线| 国产999精品久久| 精品国产网站在线观看| 中文字幕制服丝袜一区二区三区 | 国产老女人精品毛片久久| 欧美欧美欧美欧美首页| 又紧又大又爽精品一区二区| 国产福利精品一区| 精品成人a区在线观看| 日韩精品亚洲专区| 欧美日韩电影在线| 亚洲mv在线观看| av电影在线观看一区| 中文乱码免费一区二区| 国产传媒日韩欧美成人| 久久精品一区二区三区四区| 另类欧美日韩国产在线| 91精品国产综合久久精品| 欧美激情在线看| 国产·精品毛片| 久久久99精品免费观看| 国产裸体歌舞团一区二区| 精品国产一区二区精华| 精品一区二区免费| 久久综合色婷婷| 国精品**一区二区三区在线蜜桃| 久久综合色8888| 99re亚洲国产精品| 亚洲午夜久久久久久久久电影院 | 99国产精品99久久久久久| 亚洲一区视频在线观看视频| 91精品国产一区二区三区蜜臀| 美女www一区二区| 欧美激情在线免费观看| 欧美怡红院视频| 久久精品免费观看| 国产精品日日摸夜夜摸av| 91成人看片片| 精品一区二区三区免费视频| 一区二区中文字幕在线| 欧美久久婷婷综合色| 国产一区二区三区蝌蚪| 亚洲精品自拍动漫在线| 日韩亚洲欧美中文三级| 99re8在线精品视频免费播放| 亚洲国产婷婷综合在线精品| 精品国产乱码久久久久久蜜臀 | 91色视频在线| 免费美女久久99| 国产精品高潮呻吟| 在线播放亚洲一区| 岛国精品在线观看| 日韩黄色在线观看| 中文一区一区三区高中清不卡| 欧美亚洲一区二区三区四区| 久草中文综合在线| 一区二区三区.www| 久久久午夜电影| 欧美伊人精品成人久久综合97| 国内外精品视频| 亚洲va国产天堂va久久en| 久久婷婷国产综合精品青草| 欧美日韩国产一级二级| 成人ar影院免费观看视频| 日韩专区中文字幕一区二区| 国产精品福利一区二区三区| 日韩欧美国产综合一区| 一本大道久久精品懂色aⅴ| 国产在线乱码一区二区三区| 亚洲一线二线三线视频| 国产农村妇女精品| 精品日韩欧美在线| 欧美美女bb生活片| 日本道精品一区二区三区| 国产91富婆露脸刺激对白|