コード例 #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
  @Before
  public void setUp() throws IOException {
    clock = new DefaultClock();

    scheduler = new Scheduler();
    scheduler.setClock(clock);
    scheduler.start();

    udpInterface = new UdpManager();
    udpInterface.setBindAddress("localhost");
    udpInterface.start();

    mgcpProvider = new MgcpProvider(udpInterface, 1024, scheduler);
    address = new InetSocketAddress("localhost", 2425);

    selector = new ActionSelector(scheduler);
  }
コード例 #3
0
 @After
 public void tearDown() {
   channel.close();
   audioMixer.stop();
   oobMixer.stop();
   udpManager.stop();
   mediaScheduler.stop();
   scheduler.stop();
   sender.close();
 }
コード例 #4
0
  @After
  public void tearDown() {
    source1.deactivate();
    channel1.close();

    source2.deactivate();
    channel2.close();

    audioMixer1.stop();
    audioMixer2.stop();

    udpManager.stop();
    mediaScheduler.stop();
    scheduler.stop();
  }
コード例 #5
0
  public void setup() throws IOException {
    // use default clock
    clock = new WallClock();

    dspFactory.addCodec("org.mobicents.media.server.impl.dsp.audio.g711.alaw.Encoder");
    dspFactory.addCodec("org.mobicents.media.server.impl.dsp.audio.g711.alaw.Decoder");

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

    udpManager = new UdpManager(scheduler);
    udpManager.setBindAddress("127.0.0.1");
    scheduler.start();
    udpManager.start();

    channelsManager = new ChannelsManager(udpManager);
    channelsManager.setScheduler(mediaScheduler);
  }
コード例 #6
0
 @After
 public void tearDown() {
   mgcpProvider.shutdown();
   scheduler.stop();
 }
コード例 #7
0
  @Before
  public void setUp() throws Exception {
    // given
    DtlsSrtpServerProvider mockedDtlsServerProvider = mock(DtlsSrtpServerProvider.class);
    DtlsSrtpServer mockedDtlsSrtpServer = mock(DtlsSrtpServer.class);

    // when
    when(mockedDtlsServerProvider.provide()).thenReturn(mockedDtlsSrtpServer);
    when(mockedDtlsSrtpServer.getCipherSuites()).thenReturn(cipherSuites);

    // then
    AudioFormat pcma = FormatFactory.createAudioFormat("pcma", 8000, 8, 1);
    Formats fmts = new Formats();
    fmts.add(pcma);

    Formats dstFormats = new Formats();
    dstFormats.add(FormatFactory.createAudioFormat("LINEAR", 8000, 16, 1));

    dspFactory.addCodec("org.mobicents.media.server.impl.dsp.audio.g711.alaw.Encoder");
    dspFactory.addCodec("org.mobicents.media.server.impl.dsp.audio.g711.alaw.Decoder");

    dsp11 = dspFactory.newProcessor();
    dsp12 = dspFactory.newProcessor();

    dsp21 = dspFactory.newProcessor();
    dsp22 = dspFactory.newProcessor();

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

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

    udpManager = new UdpManager(scheduler);
    scheduler.start();
    udpManager.start();

    channelsManager = new ChannelsManager(udpManager, mockedDtlsServerProvider);
    channelsManager.setScheduler(mediaScheduler);

    detector = new DetectorImpl("dtmf", mediaScheduler);
    detector.setVolume(-35);
    detector.setDuration(40);
    detector.addListener(this);

    channel = channelsManager.getChannel();
    channel.bind(false);

    sender = new Sender(channel.getLocalPort());

    channel.setPeer(new InetSocketAddress("127.0.0.1", 9200));
    channel.setInputDsp(dsp11);
    channel.setFormatMap(AVProfile.audio);

    audioMixer = new AudioMixer(mediaScheduler);
    audioMixer.addComponent(channel.getAudioComponent());

    detectorComponent = new AudioComponent(1);
    detectorComponent.addOutput(detector.getAudioOutput());
    detectorComponent.updateMode(true, true);
    audioMixer.addComponent(detectorComponent);

    oobMixer = new OOBMixer(mediaScheduler);
    oobMixer.addComponent(channel.getOOBComponent());

    oobComponent = new OOBComponent(1);
    oobComponent.addOutput(detector.getOOBOutput());
    oobComponent.updateMode(true, true);
    oobMixer.addComponent(oobComponent);
  }
コード例 #8
0
  @Before
  public void setUp() throws Exception {
    AudioFormat pcma = FormatFactory.createAudioFormat("pcma", 8000, 8, 1);
    Formats fmts = new Formats();
    fmts.add(pcma);

    Formats dstFormats = new Formats();
    dstFormats.add(FormatFactory.createAudioFormat("LINEAR", 8000, 16, 1));

    dspFactory.addCodec("org.mobicents.media.server.impl.dsp.audio.g711.alaw.Encoder");
    dspFactory.addCodec("org.mobicents.media.server.impl.dsp.audio.g711.alaw.Decoder");

    dsp11 = dspFactory.newProcessor();
    dsp12 = dspFactory.newProcessor();

    dsp21 = dspFactory.newProcessor();
    dsp22 = dspFactory.newProcessor();

    // use default clock
    clock = new WallClock();
    rtpClock1 = new RtpClock(clock);
    rtpClock2 = new RtpClock(clock);
    oobClock1 = new RtpClock(clock);
    oobClock2 = new RtpClock(clock);

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

    udpManager = new UdpManager(scheduler);
    scheduler.start();
    udpManager.start();

    channelsManager = new ChannelsManager(udpManager);
    channelsManager.setScheduler(mediaScheduler);

    source1 = new Sine(mediaScheduler);
    source1.setFrequency(100);

    source2 = new Sine(mediaScheduler);
    source2.setFrequency(50);

    analyzer1 = new SpectraAnalyzer("analyzer", mediaScheduler);
    analyzer2 = new SpectraAnalyzer("analyzer", mediaScheduler);

    this.statistics1 = new RtpStatistics(rtpClock1);
    this.statistics2 = new RtpStatistics(rtpClock2);

    channel1 = channelsManager.getRtpChannel(statistics1, rtpClock1, oobClock1);
    channel1.updateMode(ConnectionMode.SEND_RECV);
    channel1.setOutputDsp(dsp11);
    channel1.setOutputFormats(fmts);
    channel1.setInputDsp(dsp12);

    channel2 = channelsManager.getRtpChannel(statistics2, rtpClock2, oobClock2);
    channel2.updateMode(ConnectionMode.SEND_RECV);
    channel2.setOutputDsp(dsp21);
    channel2.setOutputFormats(fmts);
    channel2.setInputDsp(dsp22);

    channel1.bind(false);
    channel2.bind(false);

    channel1.setRemotePeer(new InetSocketAddress("127.0.0.1", channel2.getLocalPort()));
    channel2.setRemotePeer(new InetSocketAddress("127.0.0.1", channel1.getLocalPort()));

    channel1.setFormatMap(AVProfile.audio);
    channel2.setFormatMap(AVProfile.audio);

    audioMixer1 = new AudioMixer(mediaScheduler);
    audioMixer2 = new AudioMixer(mediaScheduler);

    component1 = new AudioComponent(1);
    component1.addInput(source1.getAudioInput());
    component1.addOutput(analyzer1.getAudioOutput());
    component1.updateMode(true, true);

    audioMixer1.addComponent(component1);
    audioMixer1.addComponent(channel1.getAudioComponent());

    component2 = new AudioComponent(2);
    component2.addInput(source2.getAudioInput());
    component2.addOutput(analyzer2.getAudioOutput());
    component2.updateMode(true, true);

    audioMixer2.addComponent(component2);
    audioMixer2.addComponent(channel2.getAudioComponent());
  }
コード例 #9
0
 @After
 public void tearDown() {
   endpoint.stop();
   scheduler.stop();
 }
コード例 #10
0
 @After
 public void tearDown() {
   endpoint.deleteAllConnections();
   endpoint.stop();
   scheduler.stop();
 }
コード例 #11
0
 public void tearDown() {
   udpManager.stop();
   scheduler.stop();
   mediaScheduler.stop();
 }