Package org.bigbluebutton.voiceconf.red5.media

Examples of org.bigbluebutton.voiceconf.red5.media.FlashToSipAudioStream


public class CallStreamFactory {
  private IScope scope;
 
  public CallStream createCallStream(Codec sipCodec, SipConnectInfo connInfo) {
    return new CallStream(sipCodec, connInfo, scope);
  }
View Full Code Here


   
    public void sendAudio(byte[] audioData, long timestamp) {
      byte[] transcodedAudioDataBuffer = new byte[audioData.length + RTP_HEADER_SIZE];
      System.arraycopy(audioData, 0, transcodedAudioDataBuffer, RTP_HEADER_SIZE, audioData.length);
      RtpPacket rtpPacket = new RtpPacket(transcodedAudioDataBuffer, transcodedAudioDataBuffer.length);
      if (!marked) {
        rtpPacket.setMarker(true);
        marked = true;
        startTimestamp = System.currentTimeMillis();
      }
      rtpPacket.setPadding(false);
      rtpPacket.setExtension(false);
        rtpPacket.setPayloadType(codecId);
      rtpPacket.setSeqNum(sequenceNum++);  
      rtpPacket.setTimestamp(timestamp);
        rtpPacket.setPayloadLength(audioData.length);
        try {
    rtpSocketSend(rtpPacket);
  } catch (StreamException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
View Full Code Here

   
    public void receiveRtpPackets() {   
        int packetReceivedCounter = 0;
        int internalBufferLength = payloadLength + RTP_HEADER_SIZE;
        byte[] internalBuffer = new byte[internalBufferLength];
        RtpPacket rtpPacket = new RtpPacket(internalBuffer, internalBufferLength);;
       
        while (receivePackets) {
          try {            
            rtpSocket.receive(rtpPacket);           
            packetReceivedCounter++; 
            if (shouldDropDelayedPacket(rtpPacket)) {
              continue;
            }
            if (rtpPacket.isRtcpPacket()) {
              /**
               * Asterisk (1.6.2.5) send RTCP packets. We just ignore them (for now).
               * It could be for KeepAlive (http://tools.ietf.org/html/draft-ietf-avt-app-rtp-keepalive-09)
               */
              if (log.isDebugEnabled())
                log.debug("RTCP packet [" + rtpPacket.getRtcpPayloadType() + ", length=" + rtpPacket.getPayloadLength() + "] seqNum[rtpSeqNum=" + rtpPacket.getSeqNum() + ",lastSeqNum=" + lastSequenceNumber
                  + "][rtpTS=" + rtpPacket.getTimestamp() + ",lastTS=" + lastPacketTimestamp + "][port=" + rtpSocket.getDatagramSocket().getLocalPort() + "]");               
            } else {
                if (shouldHandlePacket(rtpPacket)) {                               
                  lastSequenceNumber = rtpPacket.getSeqNum();
                  lastPacketTimestamp = rtpPacket.getTimestamp();
                  processRtpPacket(internalBuffer, RTP_HEADER_SIZE, rtpPacket.getPayloadLength());
                } else {
                  if (log.isDebugEnabled())
                    log.debug("Corrupt packet [" + rtpPacket.getRtcpPayloadType() + "," + rtpPacket.getPayloadType() + ", length=" + rtpPacket.getPayloadLength() + "] seqNum[rtpSeqNum=" + rtpPacket.getSeqNum() + ",lastSeqNum=" + lastSequenceNumber
                      + "][rtpTS=" + rtpPacket.getTimestamp() + ",lastTS=" + lastPacketTimestamp + "][port=" + rtpSocket.getDatagramSocket().getLocalPort() + "]");                            

                  if (lastPacketDropped) successivePacketDroppedCount++;
                  else lastPacketDropped = true;                
                }
              }
View Full Code Here

    }
   
    public void sendAudio(byte[] audioData, int codecId, long timestamp) {
      byte[] transcodedAudioDataBuffer = new byte[audioData.length + RTP_HEADER_SIZE];
      System.arraycopy(audioData, 0, transcodedAudioDataBuffer, RTP_HEADER_SIZE, audioData.length);
      RtpPacket rtpPacket = new RtpPacket(transcodedAudioDataBuffer, transcodedAudioDataBuffer.length);
      if (!marked) {
        rtpPacket.setMarker(true);
        marked = true;
        startTimestamp = System.currentTimeMillis();
      }
      rtpPacket.setPadding(false);
      rtpPacket.setExtension(false);
        rtpPacket.setPayloadType(codecId);
      rtpPacket.setSeqNum(sequenceNum++);  
      rtpPacket.setTimestamp(timestamp);
        rtpPacket.setPayloadLength(audioData.length);
        try {
      rtpSocketSend(rtpPacket);
    } catch (StreamException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

  connect();
    }

    public void connect() {
        try {
      rtpSocket = new RtpSocket(srcSocket, InetAddress.getByName(connInfo.getRemoteAddr()), connInfo.getRemotePort());
            Random rgen = new Random();
      sequenceNum = rgen.nextInt();   
    } catch (UnknownHostException e) {
      log.error("Failed to connect to {}", connInfo.getRemoteAddr());
      log.error(StackTraceUtil.getStackTrace(e));
View Full Code Here

   
    private long lastPacketReceived = 0;
   
    public RtpStreamReceiver(DatagramSocket socket, int expectedPayloadLength) {
      this.payloadLength = expectedPayloadLength;
        rtpSocket = new RtpSocket(socket);

        initializeSocket();
    }
View Full Code Here

        this.connInfo = connInfo;
    }

    public void connect() throws StreamException {
      try {
      rtpSocket = new RtpSocket(srcSocket, InetAddress.getByName(connInfo.getRemoteAddr()), connInfo.getRemotePort());
          Random rgen = new Random();
      sequenceNum = rgen.nextInt(1000);   
    } catch (UnknownHostException e) {
      log.error("Failed to connect to {}", connInfo.getRemoteAddr());
      log.error(StackTraceUtil.getStackTrace(e));
View Full Code Here

      callStreamObserver = observer;
    }
   
    public void start() {       
      SipToFlashTranscoder sipToFlashTranscoder = new SpeexSipToFlashTranscoderImp(sipCodec);
      FlashToSipTranscoder flashToSipTranscoder = new SpeexFlashToSipTranscoderImp(sipCodec);

    if (sipCodec.getCodecId() != SpeexCodec.codecId) {     
      flashToSipTranscoder = new NellyFlashToSipTranscoderImp(sipCodec);
      sipToFlashTranscoder = new NellySipToFlashTranscoderImp(sipCodec);
    }
View Full Code Here

    public void start() {       
      SipToFlashTranscoder sipToFlashTranscoder = new SpeexSipToFlashTranscoderImp(sipCodec);
      FlashToSipTranscoder flashToSipTranscoder = new SpeexFlashToSipTranscoderImp(sipCodec);

    if (sipCodec.getCodecId() != SpeexCodec.codecId) {     
      flashToSipTranscoder = new NellyFlashToSipTranscoderImp(sipCodec);
      sipToFlashTranscoder = new NellySipToFlashTranscoderImp(sipCodec);
    }
   
    log.info("Using codec=" + sipCodec.getCodecName() + " id=" + sipCodec.getCodecId());
    log.debug("Packetization [" + sipCodec.getIncomingPacketization() + "," + sipCodec.getOutgoingPacketization() + "]");
View Full Code Here

      SipToFlashTranscoder sipToFlashTranscoder = new SpeexSipToFlashTranscoderImp(sipCodec);
      FlashToSipTranscoder flashToSipTranscoder = new SpeexFlashToSipTranscoderImp(sipCodec);

    if (sipCodec.getCodecId() != SpeexCodec.codecId) {     
      flashToSipTranscoder = new NellyFlashToSipTranscoderImp(sipCodec);
      sipToFlashTranscoder = new NellySipToFlashTranscoderImp(sipCodec);
    }
   
    log.info("Using codec=" + sipCodec.getCodecName() + " id=" + sipCodec.getCodecId());
    log.debug("Packetization [" + sipCodec.getIncomingPacketization() + "," + sipCodec.getOutgoingPacketization() + "]");
    log.debug("Outgoing Frame size [" + sipCodec.getOutgoingEncodedFrameSize() + ", " + sipCodec.getOutgoingDecodedFrameSize() + "]");
View Full Code Here

TOP

Related Classes of org.bigbluebutton.voiceconf.red5.media.FlashToSipAudioStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.