コード例 #1
0
  @Before
  public void setUp()
      throws ResourceUnavailableException, IOException, TooManyConnectionsException {
    ConnectionState.OPEN.setTimeout(5);

    // use default clock
    clock = new DefaultClock();

    // create single thread scheduler
    scheduler = new Scheduler();
    scheduler.setClock(clock);
    scheduler.start();

    channelsManager = new ChannelsManager(new UdpManager(scheduler));
    channelsManager.setScheduler(scheduler);

    resourcesPool = new ResourcesPool(scheduler, channelsManager, dspFactory);

    // assign scheduler to the endpoint
    endpoint = new MyTestEndpoint("test");
    endpoint.setScheduler(scheduler);
    endpoint.setResourcesPool(resourcesPool);
    endpoint.start();

    connection = (BaseConnection) endpoint.createConnection(ConnectionType.LOCAL, false);
  }
コード例 #2
0
  @After
  public void tearDown() {
    endpoint.deleteAllConnections();

    endpoint.stop();
    scheduler.stop();
  }
コード例 #3
0
 @Test
 public void testDuration() throws Exception {
   long s = System.nanoTime();
   for (int i = 0; i < 9; i++) {
     connection = (LocalConnectionImpl) endpoint.createConnection(ConnectionType.LOCAL, false);
     //            connection.bind();
   }
   System.out.println("Duration=" + (System.nanoTime() - s));
 }
コード例 #4
0
ファイル: BridgeTest.java プロジェクト: pospisil/mediaserver
  @After
  @Override
  public void tearDown() {
    if (endpoint1 != null) {
      endpoint1.stop();
    }

    if (endpoint2 != null) {
      endpoint2.stop();
    }

    if (endpoint3 != null) {
      endpoint3.stop();
    }

    if (endpoint4 != null) {
      endpoint4.stop();
    }

    super.tearDown();
  }
コード例 #5
0
  @Before
  public void setUp()
      throws ResourceUnavailableException, IOException, TooManyConnectionsException {
    // use default clock
    clock = new WallClock();

    // create single thread scheduler
    scheduler = new PriorityQueueScheduler();
    scheduler.setClock(clock);
    scheduler.start();

    channelsManager = new ChannelsManager(new UdpManager(new ServiceScheduler()));
    channelsManager.setScheduler(scheduler);

    resourcesPool = new ResourcesPool(scheduler, channelsManager, dspFactory);
    // assign scheduler to the endpoint
    endpoint = new MyTestEndpoint("test");
    endpoint.setScheduler(scheduler);
    endpoint.setResourcesPool(resourcesPool);
    endpoint.start();

    connection = (BaseConnection) endpoint.createConnection(ConnectionType.LOCAL, false);
    connection.addListener(this);
  }
コード例 #6
0
ファイル: BridgeTest.java プロジェクト: pospisil/mediaserver
  @Before
  public void setUp()
      throws ResourceUnavailableException, TooManyConnectionsException, IOException {
    super.setup();

    resourcesPool = new ResourcesPool(mediaScheduler, channelsManager, dspFactory);
    // assign scheduler to the endpoint
    endpoint1 = new MyTestEndpoint("test-1");
    endpoint1.setScheduler(mediaScheduler);
    endpoint1.setResourcesPool(resourcesPool);
    endpoint1.setFreq(400);
    endpoint1.start();

    endpoint2 = new MyTestEndpoint("test-2");
    endpoint2.setScheduler(mediaScheduler);
    endpoint2.setResourcesPool(resourcesPool);
    endpoint2.setFreq(200);
    endpoint2.start();

    endpoint3 = new MyTestEndpoint("test-3");
    endpoint3.setScheduler(mediaScheduler);
    endpoint3.setResourcesPool(resourcesPool);
    endpoint3.setFreq(600);
    endpoint3.start();

    endpoint4 = new MyTestEndpoint("test-4");
    endpoint4.setScheduler(mediaScheduler);
    endpoint4.setResourcesPool(resourcesPool);
    endpoint4.setFreq(800);
    endpoint4.start();

    sine1 = endpoint1.getResource(MediaType.AUDIO, ComponentType.SINE);
    sine2 = endpoint2.getResource(MediaType.AUDIO, ComponentType.SINE);
    sine3 = endpoint3.getResource(MediaType.AUDIO, ComponentType.SINE);
    sine4 = endpoint4.getResource(MediaType.AUDIO, ComponentType.SINE);

    analyzer1 = endpoint1.getResource(MediaType.AUDIO, ComponentType.SPECTRA_ANALYZER);
    analyzer2 = endpoint2.getResource(MediaType.AUDIO, ComponentType.SPECTRA_ANALYZER);
    analyzer3 = endpoint3.getResource(MediaType.AUDIO, ComponentType.SPECTRA_ANALYZER);
    analyzer4 = endpoint4.getResource(MediaType.AUDIO, ComponentType.SPECTRA_ANALYZER);
  }
コード例 #7
0
ファイル: BridgeTest.java プロジェクト: pospisil/mediaserver
  /** Test of setOtherParty method, of class LocalConnectionImpl. */
  @Test
  public void testTransmission() throws Exception {
    sine1.activate();
    sine2.activate();
    sine3.activate();
    sine4.activate();

    analyzer1.activate();
    analyzer2.activate();
    analyzer3.activate();
    analyzer4.activate();

    Connection connection1 = endpoint1.createConnection(ConnectionType.RTP, false);
    Connection connection3 = endpoint3.createConnection(ConnectionType.RTP, false);

    connection1.generateOffer(false);
    connection1.setMode(ConnectionMode.SEND_ONLY);

    connection3.setOtherParty(new Text(connection1.getLocalDescriptor()));
    connection1.setOtherParty(new Text(connection3.getLocalDescriptor()));

    // make inactive first

    connection3.setMode(ConnectionMode.CONFERENCE);
    connection1.setMode(ConnectionMode.CONFERENCE);

    Connection connection12 = endpoint1.createConnection(ConnectionType.LOCAL, false);
    Connection connection2 = endpoint2.createConnection(ConnectionType.LOCAL, false);

    connection12.setOtherParty(connection2);

    // initial mode
    connection12.setMode(ConnectionMode.SEND_RECV);

    // working mode
    connection12.setMode(ConnectionMode.CONFERENCE);
    connection2.setMode(ConnectionMode.SEND_RECV);

    Connection connection34 = endpoint3.createConnection(ConnectionType.LOCAL, false);
    Connection connection4 = endpoint4.createConnection(ConnectionType.LOCAL, false);

    connection34.setOtherParty(connection4);
    connection34.setMode(ConnectionMode.CONFERENCE);

    connection4.setMode(ConnectionMode.SEND_RECV);
    Thread.sleep(100);
    connection4.setMode(ConnectionMode.SEND_RECV);

    Thread.sleep(5000);

    sine1.deactivate();
    sine2.deactivate();
    sine3.deactivate();
    sine4.deactivate();

    analyzer1.deactivate();
    analyzer2.deactivate();
    analyzer3.deactivate();
    analyzer4.deactivate();

    SpectraAnalyzer a1 = (SpectraAnalyzer) analyzer1;
    SpectraAnalyzer a2 = (SpectraAnalyzer) analyzer2;
    SpectraAnalyzer a3 = (SpectraAnalyzer) analyzer3;
    SpectraAnalyzer a4 = (SpectraAnalyzer) analyzer4;

    int[] s1 = a1.getSpectra();
    int[] s2 = a2.getSpectra();
    int[] s3 = a3.getSpectra();
    int[] s4 = a4.getSpectra();

    endpoint1.deleteConnection(connection1);
    endpoint1.deleteConnection(connection12);

    endpoint2.deleteConnection(connection2);

    endpoint3.deleteConnection(connection3);
    endpoint3.deleteConnection(connection34);

    endpoint4.deleteConnection(connection4);

    printSpectra("E1", s1);
    printSpectra("E2", s2);
    printSpectra("E3", s3);
    printSpectra("E4", s4);
    System.out.println("===============");

    assertEquals(3, s2.length);
    assertEquals(3, s4.length);
  }
コード例 #8
0
 @After
 public void tearDown() {
   endpoint.stop();
   scheduler.stop();
 }