亚洲欧美第一页_禁久久精品乱码_粉嫩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在线视频免费91| 国产精品亚洲人在线观看| 天天色 色综合| 亚洲三级久久久| 中文字幕免费观看一区| 久久影院电视剧免费观看| 欧美日韩专区在线| 本田岬高潮一区二区三区| 极品销魂美女一区二区三区| 午夜欧美大尺度福利影院在线看| 综合婷婷亚洲小说| 久久久久久久综合| 日韩一区二区精品| 欧美浪妇xxxx高跟鞋交| 在线观看免费视频综合| 91免费视频大全| av日韩在线网站| 成人av在线网站| 成人av网址在线| 粉嫩aⅴ一区二区三区四区| 国模娜娜一区二区三区| 免费久久精品视频| 免费在线观看视频一区| 日本三级韩国三级欧美三级| 图片区小说区国产精品视频| 国产精华液一区二区三区| 国产在线一区二区| 国产一区啦啦啦在线观看| 老司机午夜精品| 国产一区二区在线观看视频| 韩国精品在线观看| 国产一区福利在线| 国产福利一区二区| 国产91丝袜在线观看| 国产91丝袜在线播放九色| 大美女一区二区三区| 国产999精品久久久久久绿帽| 国产999精品久久久久久| 不卡一区二区中文字幕| 99久久久精品| 在线观看亚洲专区| 欧美日韩在线精品一区二区三区激情| 欧美日韩一二区| 欧美精品一二三| 日韩女优视频免费观看| 久久久久久久久久电影| 国产精品色眯眯| 综合久久综合久久| 亚洲成人第一页| 日韩国产精品久久久| 精品一区二区日韩| 丁香婷婷综合色啪| 94-欧美-setu| 欧美日韩精品电影| 精品999在线播放| 国产精品视频线看| 亚洲综合在线五月| 久久福利视频一区二区| 成人精品高清在线| 欧美少妇性性性| 精品国产一区二区亚洲人成毛片 | 色欧美片视频在线观看| 欧美亚洲另类激情小说| 欧美一级二级在线观看| 国产午夜亚洲精品午夜鲁丝片| 国产精品久久久久久久久果冻传媒| 亚洲免费资源在线播放| 日韩av电影免费观看高清完整版在线观看| 老司机精品视频导航| 99久久精品国产导航| 91麻豆精品国产91久久久久久久久| 久久免费看少妇高潮| 亚洲视频在线一区二区| 亚洲乱码日产精品bd | 亚洲黄色小说网站| 免费在线观看一区二区三区| 成人午夜电影小说| 国产精品午夜春色av| 亚洲123区在线观看| 国产宾馆实践打屁股91| 欧美日韩一区在线| 国产亚洲短视频| 天涯成人国产亚洲精品一区av| 国产福利一区二区| 制服丝袜亚洲精品中文字幕| 国产精品色哟哟| 欧美bbbbb| 色婷婷综合久久久中文一区二区| 26uuu亚洲综合色| 免费成人深夜小野草| 欧美日韩电影在线| 一区二区三区 在线观看视频| 91浏览器入口在线观看| 久久免费美女视频| 午夜精品久久一牛影视| 成人高清免费观看| 欧美日韩高清一区二区不卡| 26uuu国产日韩综合| 性久久久久久久久久久久| 中文字幕亚洲成人| 免费人成精品欧美精品| 在线观看一区二区精品视频| 中文字幕一区二区三区av| 久久99九九99精品| 在线91免费看| 亚洲一区二区在线播放相泽| www.亚洲精品| 国产一区福利在线| 欧美视频一区二区三区在线观看| 久久综合九色综合久久久精品综合 | 制服视频三区第一页精品| ...中文天堂在线一区| 国产精品一品二品| 精品国产青草久久久久福利| 日韩精品乱码免费| 欧美日韩精品久久久| 一区二区三区色| 91免费版在线| 亚洲欧美日韩国产综合| 91在线porny国产在线看| 国产精品毛片久久久久久久| 高清在线成人网| 欧美经典一区二区| 成人免费av资源| 国产精品乱码人人做人人爱 | 亚洲国产精品一区二区久久 | 欧美日韩免费视频| 亚洲国产日韩在线一区模特| 欧美色爱综合网| 午夜av电影一区| 91精品国产综合久久精品麻豆| 日韩在线播放一区二区| 日韩视频一区二区三区 | 亚洲bdsm女犯bdsm网站| 欧美日韩精品三区| 人人狠狠综合久久亚洲| 精品日韩在线一区| 国产一区在线观看麻豆| 国产精品视频一二| 色综合久久中文字幕综合网| 亚洲一区二区三区免费视频| 欧美人妖巨大在线| 狠狠v欧美v日韩v亚洲ⅴ| 久久久国产综合精品女国产盗摄| 国产成人亚洲综合色影视| 中文字幕亚洲不卡| 欧美日韩国产精品成人| 久久超碰97中文字幕| 国产精品美女久久久久aⅴ| 91网址在线看| 日本美女一区二区| 中文字幕国产精品一区二区| 在线免费不卡视频| 日韩av电影一区| 中文欧美字幕免费| 欧美亚洲国产一区二区三区 | 国产高清不卡一区二区| 亚洲男人天堂av| 欧美一卡二卡三卡| 成人免费看黄yyy456| 香蕉成人伊视频在线观看| 久久综合久久久久88| 色88888久久久久久影院按摩| 热久久国产精品| 国产欧美va欧美不卡在线| 欧美在线观看视频在线| 国内精品不卡在线| 国产美女娇喘av呻吟久久| √…a在线天堂一区| 欧美一级免费观看| av亚洲精华国产精华精| 天天操天天综合网| 亚洲国产精品国自产拍av| 在线免费观看成人短视频| 国产一区二区视频在线| 亚洲一区二区在线免费观看视频 | 欧美日韩激情一区二区| 东方欧美亚洲色图在线| 五月天中文字幕一区二区| 国产亚洲欧美日韩在线一区| 欧美午夜精品免费| 成人一区二区三区视频在线观看 | 欧美亚洲一区二区在线观看| 国产一区二区三区久久悠悠色av | 国产成人亚洲综合色影视| 日日夜夜一区二区| 日韩美女久久久| 久久综合色播五月| 欧美肥胖老妇做爰|