• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java RecorderEndpoint类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.kurento.client.RecorderEndpoint的典型用法代码示例。如果您正苦于以下问题:Java RecorderEndpoint类的具体用法?Java RecorderEndpoint怎么用?Java RecorderEndpoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

RecorderEndpoint类属于org.kurento.client包,在下文中一共展示了RecorderEndpoint类的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: CallMediaPipeline

点赞 3

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public CallMediaPipeline(KurentoClient kurento, String from, String to) {

    // Media pipeline
    pipeline = kurento.createMediaPipeline();

    // Media Elements (WebRtcEndpoint, RecorderEndpoint)
    webRtcCaller = new WebRtcEndpoint.Builder(pipeline).build();
    webRtcCallee = new WebRtcEndpoint.Builder(pipeline).build();

    recorderCaller = new RecorderEndpoint.Builder(pipeline, RECORDING_PATH + from + RECORDING_EXT)
        .build();
    recorderCallee = new RecorderEndpoint.Builder(pipeline, RECORDING_PATH + to + RECORDING_EXT)
        .build();

    // Connections
    webRtcCaller.connect(webRtcCallee);
    webRtcCaller.connect(recorderCaller);

    webRtcCallee.connect(webRtcCaller);
    webRtcCallee.connect(recorderCallee);
  }
 

开发者ID:jake-kent,
项目名称:TLIVideoConferencingv2,
代码行数:22,
代码来源:CallMediaPipeline.java

示例2: connectAccordingToProfile

点赞 3

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
private void connectAccordingToProfile(WebRtcEndpoint webRtcEndpoint, RecorderEndpoint recorder,
    MediaProfileSpecType profile) {
  switch (profile) {
    case WEBM:
      webRtcEndpoint.connect(recorder, MediaType.AUDIO);
      webRtcEndpoint.connect(recorder, MediaType.VIDEO);
      break;
    case WEBM_AUDIO_ONLY:
      webRtcEndpoint.connect(recorder, MediaType.AUDIO);
      break;
    case WEBM_VIDEO_ONLY:
      webRtcEndpoint.connect(recorder, MediaType.VIDEO);
      break;
    default:
      throw new UnsupportedOperationException("Unsupported profile for this tutorial: " + profile);
  }
}
 

开发者ID:usmanullah,
项目名称:kurento-testing,
代码行数:18,
代码来源:HelloWorldRecHandler.java

示例3: CallMediaPipeline

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public CallMediaPipeline(KurentoClient kurento, String from, String to) {

    // Media pipeline
    pipeline = kurento.createMediaPipeline();

    // Media Elements (WebRtcEndpoint, RecorderEndpoint, FaceOverlayFilter)
    webRtcCaller = new WebRtcEndpoint.Builder(pipeline).build();
    webRtcCallee = new WebRtcEndpoint.Builder(pipeline).build();

    recorderCaller = new RecorderEndpoint.Builder(pipeline, RECORDING_PATH + from + RECORDING_EXT)
        .build();
    recorderCallee = new RecorderEndpoint.Builder(pipeline, RECORDING_PATH + to + RECORDING_EXT)
        .build();

    String appServerUrl = System.getProperty("app.server.url",
        One2OneCallAdvApp.DEFAULT_APP_SERVER_URL);
    FaceOverlayFilter faceOverlayFilterCaller = new FaceOverlayFilter.Builder(pipeline).build();
    faceOverlayFilterCaller.setOverlayedImage(appServerUrl + "/img/mario-wings.png", -0.35F, -1.2F,
        1.6F, 1.6F);

    FaceOverlayFilter faceOverlayFilterCallee = new FaceOverlayFilter.Builder(pipeline).build();
    faceOverlayFilterCallee.setOverlayedImage(appServerUrl + "/img/Hat.png", -0.2F, -1.35F, 1.5F,
        1.5F);

    // Connections
    webRtcCaller.connect(faceOverlayFilterCaller);
    faceOverlayFilterCaller.connect(webRtcCallee);
    faceOverlayFilterCaller.connect(recorderCaller);

    webRtcCallee.connect(faceOverlayFilterCallee);
    faceOverlayFilterCallee.connect(webRtcCaller);
    faceOverlayFilterCallee.connect(recorderCallee);
  }
 

开发者ID:usmanullah,
项目名称:kurento-testing,
代码行数:34,
代码来源:CallMediaPipeline.java

示例4: CallMediaPipeline

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public CallMediaPipeline(KurentoClient kurento, String from, String to) {
	// Media pipeline
	pipeline = kurento.createMediaPipeline();

	// Media Elements (WebRtcEndpoint, RecorderEndpoint, FaceOverlayFilter)
	webRtcCaller = new WebRtcEndpoint.Builder(pipeline).build();
	webRtcCallee = new WebRtcEndpoint.Builder(pipeline).build();

	recorderCaller = new RecorderEndpoint.Builder(pipeline, RECORDING_PATH
			+ from + RECORDING_EXT).build();
	recorderCallee = new RecorderEndpoint.Builder(pipeline, RECORDING_PATH
			+ to + RECORDING_EXT).build();

	FaceOverlayFilter faceOverlayFilterCaller = new FaceOverlayFilter.Builder(
			pipeline).build();
	faceOverlayFilterCaller.setOverlayedImage(
			"http://files.kurento.org/imgs/mario-wings.png", -0.35F, -1.2F,
			1.6F, 1.6F);

	FaceOverlayFilter faceOverlayFilterCallee = new FaceOverlayFilter.Builder(
			pipeline).build();
	faceOverlayFilterCallee.setOverlayedImage(
			"http://files.kurento.org/imgs/Hat.png", -0.2F, -1.35F, 1.5F,
			1.5F);

	// Connections
	webRtcCaller.connect(faceOverlayFilterCaller);
	faceOverlayFilterCaller.connect(webRtcCallee);
	faceOverlayFilterCaller.connect(recorderCaller);

	webRtcCallee.connect(faceOverlayFilterCallee);
	faceOverlayFilterCallee.connect(webRtcCaller);
	faceOverlayFilterCallee.connect(recorderCallee);
}
 

开发者ID:Invisibi,
项目名称:kurento-tutorial-java
代码行数:35,
代码来源:CallMediaPipeline.java

示例5: launchBrowser

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
private void launchBrowser(WebRtcEndpoint webRtcEp, PlayerEndpoint playerEp,
    RecorderEndpoint recorderEp) throws InterruptedException {

  getPage().subscribeEvents("playing");
  getPage().initWebRtc(webRtcEp, WebRtcChannel.AUDIO_AND_VIDEO, WebRtcMode.RCV_ONLY);
  playerEp.play();
  final CountDownLatch eosLatch = new CountDownLatch(1);
  playerEp.addEndOfStreamListener(new EventListener<EndOfStreamEvent>() {
    @Override
    public void onEvent(EndOfStreamEvent event) {
      eosLatch.countDown();
    }
  });

  if (recorderEp != null) {
    recorderEp.record();
  }

  // Assertions
  Assert.assertTrue("Not received media (timeout waiting playing event)",
      getPage().waitForEvent("playing"));
  Assert.assertTrue("The color of the video should be black",
      getPage().similarColor(Color.BLACK));
  Assert.assertTrue("Not received EOS event in player",
      eosLatch.await(getPage().getTimeout(), TimeUnit.SECONDS));
  double currentTime = getPage().getCurrentTime();
  Assert.assertTrue(
      "Error in play time (expected: " + PLAYTIME + " sec, real: " + currentTime + " sec)",
      getPage().compare(PLAYTIME, currentTime));
}
 

开发者ID:Kurento,
项目名称:kurento-java
代码行数:31,
代码来源:RepositoryRecorderTest.java

示例6: setRecorderEndpoint

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public void setRecorderEndpoint(RecorderEndpoint recorderEndpoint) {
  this.recorderEndpoint = recorderEndpoint;
}
 

开发者ID:usmanullah,
项目名称:kurento-testing,
代码行数:4,
代码来源:UserSession.java

示例7: testRepositoryRecorder

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
@Test
public void testRepositoryRecorder() throws Exception {

  final CountDownLatch recorderLatch = new CountDownLatch(1);

  // Media Pipeline
  MediaPipeline mp = kurentoClient.createMediaPipeline();
  PlayerEndpoint playerEp = new PlayerEndpoint.Builder(mp,
      "http://" + getTestFilesHttpPath() + "/video/10sec/ball.webm").build();
  WebRtcEndpoint webRtcEp1 = new WebRtcEndpoint.Builder(mp).build();

  RepositoryItem repositoryItem = repository.createRepositoryItem();
  RepositoryHttpRecorder recorder = repositoryItem.createRepositoryHttpRecorder();

  RecorderEndpoint recorderEp = new RecorderEndpoint.Builder(mp, recorder.getURL()).build();
  playerEp.connect(webRtcEp1);
  playerEp.connect(recorderEp);

  final CountDownLatch eosLatch = new CountDownLatch(1);
  playerEp.addEndOfStreamListener(new EventListener<EndOfStreamEvent>() {
    @Override
    public void onEvent(EndOfStreamEvent event) {
      eosLatch.countDown();
    }
  });

  // Test execution #1. Play the video while it is recorded
  launchBrowser(webRtcEp1, playerEp, recorderEp);

  // Wait for EOS
  Assert.assertTrue("Not received EOS event in player",
      eosLatch.await(getPage().getTimeout(), TimeUnit.SECONDS));

  // Release Media Pipeline #1
  recorderEp.stopAndWait(new Continuation<Void>() {

    @Override
    public void onSuccess(Void result) throws Exception {
      recorderLatch.countDown();
    }

    @Override
    public void onError(Throwable cause) throws Exception {
      recorderLatch.countDown();
    }
  });

  Assert.assertTrue("Not stop properly",
      recorderLatch.await(getPage().getTimeout(), TimeUnit.SECONDS));

  mp.release();
  Thread.sleep(500);
}
 

开发者ID:Kurento,
项目名称:kurento-java
代码行数:54,
代码来源:RepositoryRecorderTest.java

示例8: doTest

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public void doTest(MediaProfileSpecType mediaProfileSpecType, String expectedVideoCodec,
    String expectedAudioCodec, String extension) throws Exception {

  // Media Pipeline #1
  MediaPipeline mp = kurentoClient.createMediaPipeline();
  PlayerEndpoint playerEp =
      new PlayerEndpoint.Builder(mp, getPlayerUrl("/video/10sec/green.webm")).build();
  WebRtcEndpoint webRtcEp1 = new WebRtcEndpoint.Builder(mp).build();

  String recordingFile = getRecordUrl(extension);

  RecorderEndpoint recorderEp = new RecorderEndpoint.Builder(mp, recordingFile)
      .withMediaProfile(mediaProfileSpecType).build();
  playerEp.connect(webRtcEp1);

  playerEp.connect(recorderEp);

  final CountDownLatch eosLatch = new CountDownLatch(1);
  playerEp.addEndOfStreamListener(new EventListener<EndOfStreamEvent>() {
    @Override
    public void onEvent(EndOfStreamEvent event) {
      eosLatch.countDown();
    }
  });

  // Test execution #1. Play the video while it is recorded
  launchBrowser(mp, webRtcEp1, playerEp, recorderEp, expectedVideoCodec, expectedAudioCodec,
      recordingFile, EXPECTED_COLOR, 0, 0, PLAYTIME);

  // Wait for EOS
  Assert.assertTrue("No EOS event", eosLatch.await(getPage().getTimeout(), TimeUnit.SECONDS));

  // Release Media Pipeline #1
  mp.release();

  // Reloading browser
  getPage().reload();

  // Media Pipeline #2
  MediaPipeline mp2 = kurentoClient.createMediaPipeline();
  PlayerEndpoint playerEp2 = new PlayerEndpoint.Builder(mp2, recordingFile).build();
  WebRtcEndpoint webRtcEp2 = new WebRtcEndpoint.Builder(mp2).build();
  playerEp2.connect(webRtcEp2);

  // Playing the recording
  launchBrowser(null, webRtcEp2, playerEp2, null, expectedVideoCodec, expectedAudioCodec,
      recordingFile, EXPECTED_COLOR, 0, 0, PLAYTIME);

  // Release Media Pipeline #2
  mp2.release();

  success = true;
}
 

开发者ID:Kurento,
项目名称:kurento-java
代码行数:54,
代码来源:RecorderPlayerTest.java

示例9: doTest

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public void doTest(MediaProfileSpecType mediaProfileSpecType, String expectedVideoCodec,
    String expectedAudioCodec, String extension) throws Exception {

  // Media Pipeline #1
  MediaPipeline mp = kurentoClient.createMediaPipeline();
  PlayerEndpoint playerEp =
      new PlayerEndpoint.Builder(mp, getPlayerUrl("/video/filter/fiwarecut.mp4")).build();
  WebRtcEndpoint webRtcEp1 = new WebRtcEndpoint.Builder(mp).build();

  FaceOverlayFilter filter = new FaceOverlayFilter.Builder(mp).build();
  filter.setOverlayedImage("http://" + getTestFilesHttpPath() + "/img/red-square.png", -0.2F,
      -1.2F, 1.6F, 1.6F);

  String recordingFile = getRecordUrl(extension);
  RecorderEndpoint recorderEp = new RecorderEndpoint.Builder(mp, recordingFile)
      .withMediaProfile(mediaProfileSpecType).build();
  playerEp.connect(filter);
  filter.connect(webRtcEp1);
  filter.connect(recorderEp);

  // Test execution #1. Play and record
  getPage().setThresholdTime(THRESHOLD);
  launchBrowser(mp, webRtcEp1, playerEp, recorderEp, expectedVideoCodec, expectedAudioCodec,
      recordingFile, EXPECTED_COLOR, EXPECTED_COLOR_X, EXPECTED_COLOR_Y, PLAYTIME);

  // Release Media Pipeline #1
  mp.release();

  // Reloading browser
  getPage().reload();

  // Media Pipeline #2
  MediaPipeline mp2 = kurentoClient.createMediaPipeline();
  PlayerEndpoint playerEp2 = new PlayerEndpoint.Builder(mp2, recordingFile).build();
  WebRtcEndpoint webRtcEp2 = new WebRtcEndpoint.Builder(mp2).build();
  playerEp2.connect(webRtcEp2);

  // Playing the recording
  launchBrowser(mp, webRtcEp2, playerEp2, null, expectedVideoCodec, expectedAudioCodec,
      recordingFile, EXPECTED_COLOR, EXPECTED_COLOR_X, EXPECTED_COLOR_Y, PLAYTIME);

  // Release Media Pipeline #2
  mp2.release();

  success = true;
}
 

开发者ID:Kurento,
项目名称:kurento-java
代码行数:47,
代码来源:RecorderFaceOverlayTest.java

示例10: doTest

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public void doTest(MediaProfileSpecType mediaProfileSpecType, String expectedVideoCodec,
    String expectedAudioCodec, String extension) throws Exception {

  final CountDownLatch recorderLatch = new CountDownLatch(1);

  MediaPipeline mp = kurentoClient.createMediaPipeline();
  WebRtcEndpoint webRtcEp = new WebRtcEndpoint.Builder(mp).build();

  String recordingFile = getRecordUrl(extension);

  recordingFile = recordingFile.replace(getSimpleTestName(),
      new Date().getTime() + File.separator + getSimpleTestName());

  log.debug("The path non existing is {} ", recordingFile);

  RecorderEndpoint recorderEp = new RecorderEndpoint.Builder(mp, recordingFile)
      .withMediaProfile(mediaProfileSpecType).build();
  webRtcEp.connect(webRtcEp);
  webRtcEp.connect(recorderEp);

  getPage().subscribeEvents("playing");
  getPage().initWebRtc(webRtcEp, AUDIO_AND_VIDEO, WebRtcMode.SEND_RCV);
  recorderEp.record();

  // Wait until event playing in the remote stream
  Assert.assertTrue("Not received media (timeout waiting playing event)",
      getPage().waitForEvent("playing"));

  Thread.sleep(SECONDS.toMillis(PLAYTIME));

  recorderEp.stopAndWait(new Continuation<Void>() {

    @Override
    public void onSuccess(Void result) throws Exception {
      recorderLatch.countDown();
    }

    @Override
    public void onError(Throwable cause) throws Exception {
      recorderLatch.countDown();
    }
  });

  Assert.assertTrue("Not stop properly",
      recorderLatch.await(getPage().getTimeout(), TimeUnit.SECONDS));

  // Wait until file exists
  waitForFileExists(recordingFile);

  AssertMedia.assertCodecs(recordingFile, expectedVideoCodec, expectedAudioCodec);
  mp.release();
}
 

开发者ID:Kurento,
项目名称:kurento-java
代码行数:53,
代码来源:RecorderNonExistingDirectoryTest.java

示例11: doTest

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public void doTest(MediaProfileSpecType mediaProfileSpecType, String expectedVideoCodec,
    String expectedAudioCodec, String extension, String[] mediaUrls, Color[] expectedColors)
        throws Exception {

  // Media Pipeline #1
  MediaPipeline mp = kurentoClient.createMediaPipeline();
  final CountDownLatch errorPipelinelatch = new CountDownLatch(1);

  mp.addErrorListener(new EventListener<ErrorEvent>() {

    @Override
    public void onEvent(ErrorEvent event) {
      msgError = "Description:" + event.getDescription() + "; Error code:" + event.getType();
      errorPipelinelatch.countDown();
    }
  });

  int numPlayers = mediaUrls.length;
  PlayerEndpoint[] players = new PlayerEndpoint[numPlayers];

  for (int i = 0; i < numPlayers; i++) {
    players[i] = new PlayerEndpoint.Builder(mp, mediaUrls[i]).build();
  }

  WebRtcEndpoint webRtcEp = new WebRtcEndpoint.Builder(mp).build();

  final CountDownLatch recorderLatch = new CountDownLatch(1);
  String recordingFile = getRecordUrl(extension);
  RecorderEndpoint recorderEp = new RecorderEndpoint.Builder(mp, recordingFile)
      .withMediaProfile(mediaProfileSpecType).build();

  // Test execution
  getPage().subscribeEvents("playing");
  getPage().initWebRtc(webRtcEp, WebRtcChannel.AUDIO_AND_VIDEO, WebRtcMode.RCV_ONLY);

  boolean startRecord = false;
  for (int i = 0; i < numPlayers; i++) {
    players[i].connect(webRtcEp);
    players[i].connect(recorderEp);
    players[i].play();

    if (!startRecord) {

      Assert.assertTrue("Not received media (timeout waiting playing event)",
          getPage().waitForEvent("playing"));
      recorderEp.record();
      startRecord = true;
    }

    waitSeconds(PLAYTIME / numPlayers);
  }

  // Release Media Pipeline #1
  saveGstreamerDot(mp);
  recorderEp.stopAndWait(new Continuation<Void>() {

    @Override
    public void onSuccess(Void result) throws Exception {
      recorderLatch.countDown();
    }

    @Override
    public void onError(Throwable cause) throws Exception {
      recorderLatch.countDown();
    }
  });

  Assert.assertTrue("Not stop properly",
      recorderLatch.await(getPage().getTimeout(), TimeUnit.SECONDS));

  mp.release();

  Assert.assertTrue(msgError, errorPipelinelatch.getCount() == 1);

  // Reloading browser
  getPage().reload();

  checkRecordingFile(recordingFile, "browser", expectedColors, PLAYTIME, expectedVideoCodec,
      expectedAudioCodec);
  success = true;
}
 

开发者ID:Kurento,
项目名称:kurento-java,
代码行数:82,
代码来源:RecorderSwitchPlayerTest.java

示例12: doTestWithPlayer

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public void doTestWithPlayer(MediaProfileSpecType mediaProfileSpecType, String expectedVideoCodec,
    String expectedAudioCodec, String extension, String mediaUrlPlayer) throws Exception {
  // Media Pipeline #1
  getPage(BROWSER2).close();
  MediaPipeline mp = kurentoClient.createMediaPipeline();
  final CountDownLatch errorPipelinelatch = new CountDownLatch(1);

  mp.addErrorListener(new EventListener<ErrorEvent>() {

    @Override
    public void onEvent(ErrorEvent event) {
      msgError = "Description:" + event.getDescription() + "; Error code:" + event.getType();
      errorPipelinelatch.countDown();
    }
  });

  WebRtcEndpoint webRtcEpRed = new WebRtcEndpoint.Builder(mp).build();
  PlayerEndpoint playerEp = new PlayerEndpoint.Builder(mp, mediaUrlPlayer).build();

  String recordingFile = getRecordUrl(extension);
  RecorderEndpoint recorderEp = new RecorderEndpoint.Builder(mp, recordingFile)
      .withMediaProfile(mediaProfileSpecType).build();

  PassThrough passThrough = new PassThrough.Builder(mp).build();
  passThrough.connect(recorderEp);

  // Test execution
  getPage(BROWSER1).subscribeLocalEvents("playing");
  long startWebrtc = System.currentTimeMillis();
  getPage(BROWSER1).initWebRtc(webRtcEpRed, WebRtcChannel.AUDIO_AND_VIDEO, WebRtcMode.SEND_ONLY);

  webRtcEpRed.connect(passThrough);
  recorderEp.record();

  Assert.assertTrue("Not received media (timeout waiting playing event)",
      getPage(BROWSER1).waitForEvent("playing"));
  long webrtcRedConnectionTime = System.currentTimeMillis() - startWebrtc;
  Thread.sleep(TimeUnit.SECONDS.toMillis(PLAYTIME) / N_PLAYER);

  startWebrtc = System.currentTimeMillis();

  playerEp.play();
  playerEp.connect(passThrough);
  long playerEpConnectionTime = System.currentTimeMillis() - startWebrtc;
  Thread.sleep(TimeUnit.SECONDS.toMillis(PLAYTIME) / N_PLAYER);

  webRtcEpRed.connect(passThrough);
  Thread.sleep(TimeUnit.SECONDS.toMillis(PLAYTIME) / N_PLAYER);

  // Release Media Pipeline #1
  saveGstreamerDot(mp);

  final CountDownLatch recorderLatch = new CountDownLatch(1);
  recorderEp.stopAndWait(new Continuation<Void>() {

    @Override
    public void onSuccess(Void result) throws Exception {
      recorderLatch.countDown();
    }

    @Override
    public void onError(Throwable cause) throws Exception {
      recorderLatch.countDown();
    }
  });

  Assert.assertTrue("Not stop properly",
      recorderLatch.await(getPage(BROWSER1).getTimeout(), TimeUnit.SECONDS));
  mp.release();

  Assert.assertTrue(msgError, errorPipelinelatch.getCount() == 1);

  final long playtime = PLAYTIME
      + TimeUnit.MILLISECONDS.toSeconds((2 * webrtcRedConnectionTime) + playerEpConnectionTime);

  checkRecordingFile(recordingFile, BROWSER3, EXPECTED_COLORS, playtime, expectedVideoCodec,
      expectedAudioCodec);
  success = true;
}
 

开发者ID:Kurento,
项目名称:kurento-java,
代码行数:80,
代码来源:RecorderSwitchWebRtcWebRtcPlayerWithPassThroughTest.java

示例13: doTestWithPlayer

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public void doTestWithPlayer(MediaProfileSpecType mediaProfileSpecType, String expectedVideoCodec,
    String expectedAudioCodec, String extension, String mediaUrlPlayer) throws Exception {
  // Media Pipeline #1
  getPage(BROWSER2).close();
  MediaPipeline mp = kurentoClient.createMediaPipeline();
  final CountDownLatch errorPipelinelatch = new CountDownLatch(1);

  mp.addErrorListener(new EventListener<ErrorEvent>() {

    @Override
    public void onEvent(ErrorEvent event) {
      msgError = "Description:" + event.getDescription() + "; Error code:" + event.getType();
      errorPipelinelatch.countDown();
    }
  });

  WebRtcEndpoint webRtcEpRed = new WebRtcEndpoint.Builder(mp).build();
  PlayerEndpoint playerEp = new PlayerEndpoint.Builder(mp, mediaUrlPlayer).build();

  String recordingFile = getRecordUrl(extension);
  RecorderEndpoint recorderEp = new RecorderEndpoint.Builder(mp, recordingFile)
      .withMediaProfile(mediaProfileSpecType).build();

  // Test execution
  getPage(BROWSER1).subscribeLocalEvents("playing");
  long startWebrtc = System.currentTimeMillis();
  getPage(BROWSER1).initWebRtc(webRtcEpRed, WebRtcChannel.AUDIO_AND_VIDEO, WebRtcMode.SEND_ONLY);

  webRtcEpRed.connect(recorderEp);
  recorderEp.record();

  Assert.assertTrue("Not received media (timeout waiting playing event)",
      getPage(BROWSER1).waitForEvent("playing"));
  long webrtcRedConnectionTime = System.currentTimeMillis() - startWebrtc;
  Thread.sleep(TimeUnit.SECONDS.toMillis(PLAYTIME) / N_PLAYER);

  startWebrtc = System.currentTimeMillis();

  playerEp.play();
  playerEp.connect(recorderEp);
  long playerEpConnectionTime = System.currentTimeMillis() - startWebrtc;
  Thread.sleep(TimeUnit.SECONDS.toMillis(PLAYTIME) / N_PLAYER);

  webRtcEpRed.connect(recorderEp);
  Thread.sleep(TimeUnit.SECONDS.toMillis(PLAYTIME) / N_PLAYER);

  // Release Media Pipeline #1
  saveGstreamerDot(mp);

  final CountDownLatch recorderLatch = new CountDownLatch(1);
  recorderEp.stopAndWait(new Continuation<Void>() {

    @Override
    public void onSuccess(Void result) throws Exception {
      recorderLatch.countDown();
    }

    @Override
    public void onError(Throwable cause) throws Exception {
      recorderLatch.countDown();
    }
  });

  Assert.assertTrue("Not stop properly",
      recorderLatch.await(getPage(BROWSER1).getTimeout(), TimeUnit.SECONDS));
  mp.release();

  Assert.assertTrue(msgError, errorPipelinelatch.getCount() == 1);

  final long playtime = PLAYTIME
      + TimeUnit.MILLISECONDS.toSeconds((2 * webrtcRedConnectionTime) + playerEpConnectionTime);

  checkRecordingFile(recordingFile, BROWSER3, EXPECTED_COLORS, playtime, expectedVideoCodec,
      expectedAudioCodec);
  success = true;
}
 

开发者ID:Kurento,
项目名称:kurento-java,
代码行数:77,
代码来源:RecorderSwitchWebRtcWebRtcAndPlayerTest.java

示例14: doTest

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public void doTest(MediaProfileSpecType mediaProfileSpecType, String expectedVideoCodec,
    String expectedAudioCodec, String extension) throws Exception {
  // Media Pipeline #1
  MediaPipeline mp = kurentoClient.createMediaPipeline();
  WebRtcEndpoint webRtcEp = new WebRtcEndpoint.Builder(mp).build();
  PlayerEndpoint playerRed =
      new PlayerEndpoint.Builder(mp, getPlayerUrl("/video/10sec/red.webm")).build();
  playerRed.connect(webRtcEp);

  // Test execution
  getPage(0).subscribeLocalEvents("playing");
  getPage(0).initWebRtc(webRtcEp, WebRtcChannel.AUDIO_AND_VIDEO, WebRtcMode.SEND_ONLY);
  playerRed.play();

  // red
  Assert.assertTrue("Not received media (timeout waiting playing event)",
      getPage(0).waitForEvent("playing"));

  PlayerEndpoint playerGreen =
      new PlayerEndpoint.Builder(mp, getPlayerUrl("/video/10sec/green.webm")).build();

  String recordingFile = getRecordUrl(extension);
  RecorderEndpoint recorderEp = new RecorderEndpoint.Builder(mp, recordingFile)
      .withMediaProfile(mediaProfileSpecType).build();

  playerGreen.play();
  recorderEp.record();
  for (int i = 0; i < NUM_SWAPS; i++) {
    if (i % 2 == 0) {
      playerRed.connect(recorderEp);
    } else {
      playerGreen.connect(recorderEp);
    }

    Thread.sleep(TimeUnit.SECONDS.toMillis(PLAYTIME) / NUM_SWAPS);
  }

  // Release Media Pipeline #1
  saveGstreamerDot(mp);

  final CountDownLatch recorderLatch = new CountDownLatch(1);
  recorderEp.stopAndWait(new Continuation<Void>() {

    @Override
    public void onSuccess(Void result) throws Exception {
      recorderLatch.countDown();
    }

    @Override
    public void onError(Throwable cause) throws Exception {
      recorderLatch.countDown();
    }
  });

  Assert.assertTrue("Not stop properly",
      recorderLatch.await(getPage(0).getTimeout(), TimeUnit.SECONDS));
  mp.release();

  // Reloading browser
  getPage(0).close();

  checkRecordingFile(recordingFile, "browser1", EXPECTED_COLORS, PLAYTIME, expectedVideoCodec,
      expectedAudioCodec);
  success = true;
}
 

开发者ID:Kurento,
项目名称:kurento-java,
代码行数:66,
代码来源:RecorderSwitchPlayerWebRtcTest.java

示例15: doTest

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public void doTest(MediaProfileSpecType mediaProfileSpecType, String expectedVideoCodec,
    String expectedAudioCodec, String extension) throws Exception {

  String multiSlashses = File.separator + File.separator + File.separator;
  final CountDownLatch recorderLatch = new CountDownLatch(1);

  MediaPipeline mp = kurentoClient.createMediaPipeline();
  WebRtcEndpoint webRtcEp = new WebRtcEndpoint.Builder(mp).build();

  String recordingFile = getRecordUrl(extension).replace(getSimpleTestName(),
      new Date().getTime() + File.separator + getSimpleTestName());

  String recordingFileWithMultiSlashes = recordingFile.replace(File.separator, multiSlashses);

  log.debug("The path with multi slash is {} ", recordingFileWithMultiSlashes);

  RecorderEndpoint recorderEp = new RecorderEndpoint.Builder(mp, recordingFileWithMultiSlashes)
      .withMediaProfile(mediaProfileSpecType).build();
  webRtcEp.connect(webRtcEp);
  webRtcEp.connect(recorderEp);

  getPage().subscribeEvents("playing");
  getPage().initWebRtc(webRtcEp, AUDIO_AND_VIDEO, WebRtcMode.SEND_RCV);
  recorderEp.record();

  // Wait until event playing in the remote stream
  Assert.assertTrue("Not received media (timeout waiting playing event)",
      getPage().waitForEvent("playing"));

  Thread.sleep(SECONDS.toMillis(PLAYTIME));

  recorderEp.stopAndWait(new Continuation<Void>() {

    @Override
    public void onSuccess(Void result) throws Exception {
      recorderLatch.countDown();
    }

    @Override
    public void onError(Throwable cause) throws Exception {
      recorderLatch.countDown();
    }
  });

  Assert.assertTrue("Not stop properly",
      recorderLatch.await(getPage().getTimeout(), TimeUnit.SECONDS));

  // Wait until file exists
  waitForFileExists(recordingFile);

  AssertMedia.assertCodecs(recordingFile, expectedVideoCodec, expectedAudioCodec);
  mp.release();
}
 

开发者ID:Kurento,
项目名称:kurento-java,
代码行数:54,
代码来源:RecorderMultiSlashesDirectoryTest.java

示例16: doTest

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public void doTest(MediaProfileSpecType mediaProfileSpecType, String expectedVideoCodec,
    String expectedAudioCodec, String extension) throws Exception {

  // Media Pipeline #1
  final MediaPipeline mp = kurentoClient.createMediaPipeline();
  PlayerEndpoint playerEp =
      new PlayerEndpoint.Builder(mp, getPlayerUrl("/video/10sec/green.webm")).build();
  WebRtcEndpoint webRtcEp1 = new WebRtcEndpoint.Builder(mp).build();

  String recordingFile = getRecordUrl(extension);

  final RecorderEndpoint recorderEp = new RecorderEndpoint.Builder(mp, recordingFile)
      .withMediaProfile(mediaProfileSpecType).build();
  playerEp.connect(webRtcEp1);

  playerEp.connect(recorderEp);

  // Test execution #1. Play the video while it is recorded
  launchBrowser(mp, webRtcEp1, playerEp, recorderEp, expectedVideoCodec, expectedAudioCodec,
      recordingFile, EXPECTED_COLOR, 0, 0, PLAYTIME);

  final CountDownLatch latch = new CountDownLatch(1);
  ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
  executor.schedule(new Runnable() {

    @Override
    public void run() {
      // Release Media Pipeline #1
      mp.release();
      latch.countDown();
    }
  }, PLAYTIME / 2, TimeUnit.SECONDS);

  latch.await(getPage().getTimeout(), TimeUnit.SECONDS);

  // Reloading browser
  getPage().reload();

  // Media Pipeline #2
  MediaPipeline mp2 = kurentoClient.createMediaPipeline();
  PlayerEndpoint playerEp2 = new PlayerEndpoint.Builder(mp2, recordingFile).build();
  WebRtcEndpoint webRtcEp2 = new WebRtcEndpoint.Builder(mp2).build();
  playerEp2.connect(webRtcEp2);

  // Playing the recording
  launchBrowser(null, webRtcEp2, playerEp2, null, expectedVideoCodec, expectedAudioCodec,
      recordingFile, EXPECTED_COLOR, 0, 0, PLAYTIME / 2);

  // Release Media Pipeline #2
  mp2.release();

  executor.shutdown();

  success = true;
}
 

开发者ID:Kurento,
项目名称:kurento-java,
代码行数:56,
代码来源:RecorderPipelineDestroyTest.java

示例17: testCompositeRecorder

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
@Test
public void testCompositeRecorder() throws Exception {

  // MediaPipeline
  MediaPipeline mp = kurentoClient.createMediaPipeline();

  Composite composite = new Composite.Builder(mp).build();

  HubPort hubPort1 = new HubPort.Builder(composite).build();
  WebRtcEndpoint webRtcEpRed = new WebRtcEndpoint.Builder(mp).build();
  webRtcEpRed.connect(hubPort1);

  HubPort hubPort2 = new HubPort.Builder(composite).build();
  WebRtcEndpoint webRtcEpGreen = new WebRtcEndpoint.Builder(mp).build();
  webRtcEpGreen.connect(hubPort2, MediaType.AUDIO);

  HubPort hubPort3 = new HubPort.Builder(composite).build();
  WebRtcEndpoint webRtcEpBlue = new WebRtcEndpoint.Builder(mp).build();
  webRtcEpBlue.connect(hubPort3, MediaType.AUDIO);

  HubPort hubPort4 = new HubPort.Builder(composite).build();
  WebRtcEndpoint webRtcEpWhite = new WebRtcEndpoint.Builder(mp).build();
  webRtcEpWhite.connect(hubPort4, MediaType.AUDIO);

  String recordingFile = getDefaultOutputFile(EXTENSION_WEBM);
  RecorderEndpoint recorderEp =
      new RecorderEndpoint.Builder(mp, Protocol.FILE + recordingFile).build();
  HubPort hubPort5 = new HubPort.Builder(composite).build();
  hubPort5.connect(recorderEp);

  // WebRTC browsers
  getPage(BROWSER2).initWebRtc(webRtcEpRed, WebRtcChannel.AUDIO_AND_VIDEO, WebRtcMode.SEND_ONLY);
  getPage(BROWSER3).initWebRtc(webRtcEpGreen, WebRtcChannel.AUDIO_AND_VIDEO,
      WebRtcMode.SEND_ONLY);
  getPage(BROWSER4).initWebRtc(webRtcEpBlue, WebRtcChannel.AUDIO_AND_VIDEO, WebRtcMode.SEND_ONLY);
  getPage(BROWSER5).initWebRtc(webRtcEpWhite, WebRtcChannel.AUDIO_AND_VIDEO,
      WebRtcMode.SEND_ONLY);

  recorderEp.record();

  Thread.sleep(PLAYTIME * 1000);

  final CountDownLatch recorderLatch = new CountDownLatch(1);
  recorderEp.stopAndWait(new Continuation<Void>() {

    @Override
    public void onSuccess(Void result) throws Exception {
      recorderLatch.countDown();
    }

    @Override
    public void onError(Throwable cause) throws Exception {
      recorderLatch.countDown();
    }
  });

  Assert.assertTrue("Not stop properly",
      recorderLatch.await(getPage(BROWSER1).getTimeout(), TimeUnit.SECONDS));

  mp.release();

  // Media Pipeline #2
  MediaPipeline mp2 = kurentoClient.createMediaPipeline();
  PlayerEndpoint playerEp2 =
      new PlayerEndpoint.Builder(mp2, Protocol.FILE + recordingFile).build();
  WebRtcEndpoint webRtcEp2 = new WebRtcEndpoint.Builder(mp2).build();
  playerEp2.connect(webRtcEp2);

  // Playing the recorded file
  launchBrowser(mp2, webRtcEp2, playerEp2, null, EXPECTED_VIDEO_CODEC_WEBM,
      EXPECTED_AUDIO_CODEC_WEBM, recordingFile, Color.RED, 0, 0, PLAYTIME);

  // Release Media Pipeline #2
  mp2.release();

  success = true;
}
 

开发者ID:Kurento,
项目名称:kurento-java,
代码行数:78,
代码来源:CompositeWebRtcRecorderTest.java

示例18: doTest

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public void doTest(final MediaProfileSpecType mediaProfileSpecType, String expectedVideoCodec,
    String expectedAudioCodec, final String extension) throws Exception {

  MediaPipeline mp = null;

  // Media Pipeline
  mp = kurentoClient.createMediaPipeline();

  final WebRtcEndpoint[] webRtcSender = new WebRtcEndpoint[NUM_BROWSERS];
  final RecorderEndpoint[] recorder = new RecorderEndpoint[NUM_BROWSERS];
  final String[] recordingFile = new String[NUM_BROWSERS];

  ExecutorService executor = Executors.newFixedThreadPool(NUM_BROWSERS);
  final CountDownLatch latch = new CountDownLatch(NUM_BROWSERS);
  final MediaPipeline pipeline = mp;
  for (int j = 0; j < NUM_BROWSERS; j++) {
    final int i = j;
    executor.execute(new Runnable() {
      @Override
      public void run() {
        try {
          // N viewer
          webRtcSender[i] = new WebRtcEndpoint.Builder(pipeline).build();
          // N recorders
          recordingFile[i] = getRecordUrl("-receiver" + i + extension);
          recorder[i] = new RecorderEndpoint.Builder(pipeline, recordingFile[i])
              .withMediaProfile(mediaProfileSpecType).build();

          // WebRTC receiver negotiation
          getPage(i).subscribeLocalEvents("playing");
          getPage(i).initWebRtc(webRtcSender[i], WebRtcChannel.AUDIO_AND_VIDEO,
              WebRtcMode.SEND_ONLY);
          Assert.assertTrue("Not received media in sender" + i,
              getPage(i).waitForEvent("playing"));

          webRtcSender[i].connect(recorder[i]);

          // Start record
          recorder[i].record();

          // Wait play time
          Thread.sleep(RECORD_MS);

          // Stop record
          recorder[i].stopAndWait();

          // Guard time to stop recording
          Thread.sleep(4000);
          getPage(i).reload();
        } catch (Throwable e) {
          log.error("Exception in receiver " + i, e);

        } finally {
          latch.countDown();
        }
      }
    });
  }

  // Wait to finish all recorders
  latch.await();

  // Assessment
  for (int j = 0; j < NUM_BROWSERS; j++) {
    AssertMedia.assertCodecs(recordingFile[j], expectedVideoCodec, expectedAudioCodec);
    AssertMedia.assertDuration(recordingFile[j], RECORD_MS, THRESHOLD_MS);
  }

  // Release Media Pipeline
  if (mp != null) {
    mp.release();
  }
}
 

开发者ID:Kurento,
项目名称:kurento-java,
代码行数:74,
代码来源:RecorderThreeWebRtcSimultaneous.java

示例19: doTest

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public void doTest(final MediaProfileSpecType mediaProfileSpecType, String expectedVideoCodec,
    String expectedAudioCodec, final String extension) throws Exception {

  final CountDownLatch recorderLatch = new CountDownLatch(1);

  long testDurationMillis =
      PropertiesManager.getProperty(TEST_DURATION_PROPERTY, DEFAULT_TEST_DURATION);

  endTestTime = System.currentTimeMillis() + testDurationMillis;

  MediaPipeline pipeline = kurentoClient.createMediaPipeline();
  final WebRtcEndpoint webRtcSender = new WebRtcEndpoint.Builder(pipeline).build();
  final String recordingFile = getRecordUrl(extension);
  final RecorderEndpoint recorder = new RecorderEndpoint.Builder(pipeline, recordingFile)
      .withMediaProfile(mediaProfileSpecType).build();

  // WebRTC sender negotiation
  getPage().subscribeLocalEvents("playing");
  getPage().initWebRtc(webRtcSender, WebRtcChannel.AUDIO_AND_VIDEO, WebRtcMode.SEND_ONLY);
  Assert.assertTrue("Not received media in sender", getPage().waitForEvent("playing"));

  webRtcSender.connect(recorder);

  while (!isTimeToFinishTest()) {
    // Start record
    recorder.record();
    // Wait play time
    Thread.sleep(RECORD_MS);
    // Pause record
    recorder.pause();
    Thread.sleep(RECORD_MS);
  }

  // Stop record
  recorder.stopAndWait(new Continuation<Void>() {

    @Override
    public void onSuccess(Void result) throws Exception {
      recorderLatch.countDown();
    }

    @Override
    public void onError(Throwable cause) throws Exception {
      recorderLatch.countDown();
    }
  });

  Assert.assertTrue("Not stop properly",
      recorderLatch.await(getPage().getTimeout(), TimeUnit.SECONDS));

  AssertMedia.assertCodecs(recordingFile, expectedVideoCodec, expectedAudioCodec);
  AssertMedia.assertDuration(recordingFile, testDurationMillis / 2,
      (testDurationMillis / 2) + THRESHOLD_MS);

  // Release Media Pipeline
  if (pipeline != null) {
    pipeline.release();
  }
}
 

开发者ID:Kurento,
项目名称:kurento-java,
代码行数:60,
代码来源:RecorderWebRtcShortFileTest.java

示例20: doTest

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public void doTest(MediaProfileSpecType mediaProfileSpecType, String expectedVideoCodec,
    String expectedAudioCodec, String extension) throws Exception {

  final CountDownLatch recorderLatch = new CountDownLatch(1);

  MediaPipeline mp = null;

  // Media Pipeline
  mp = kurentoClient.createMediaPipeline();
  WebRtcEndpoint webRtcEp1 = new WebRtcEndpoint.Builder(mp).build();
  WebRtcEndpoint webRtcEp2 = new WebRtcEndpoint.Builder(mp).build();

  // WebRTC negotiation
  getPage(0).subscribeLocalEvents("playing");
  getPage(0).initWebRtc(webRtcEp1, WebRtcChannel.AUDIO_AND_VIDEO, WebRtcMode.SEND_ONLY);
  getPage(1).subscribeLocalEvents("playing");
  getPage(1).initWebRtc(webRtcEp2, WebRtcChannel.AUDIO_AND_VIDEO, WebRtcMode.SEND_ONLY);

  // Start record
  String recordingFile = getRecordUrl(extension);
  RecorderEndpoint recorderEp = new RecorderEndpoint.Builder(mp, recordingFile)
      .withMediaProfile(mediaProfileSpecType).build();
  recorderEp.record();

  // Switch webrtcs
  for (int i = 0; i < SWITCH_TIMES; i++) {
    if (i % 2 == 0) {
      webRtcEp1.connect(recorderEp);
    } else {
      webRtcEp2.connect(recorderEp);
    }

    Thread.sleep(SWITCH_RATE_MS);
  }

  // Stop record
  recorderEp.stopAndWait(new Continuation<Void>() {

    @Override
    public void onSuccess(Void result) throws Exception {
      recorderLatch.countDown();
    }

    @Override
    public void onError(Throwable cause) throws Exception {
      recorderLatch.countDown();
    }
  });

  // Assessment
  Assert.assertTrue("Not received media in browser 1", getPage(0).waitForEvent("playing"));
  Assert.assertTrue("Not received media in browser 2", getPage(1).waitForEvent("playing"));

  Assert.assertTrue("Not stop properly",
      recorderLatch.await(getPage().getTimeout(), TimeUnit.SECONDS));

  long expectedTimeMs = SWITCH_TIMES * SWITCH_RATE_MS;
  AssertMedia.assertCodecs(recordingFile, expectedVideoCodec, expectedAudioCodec);
  AssertMedia.assertDuration(recordingFile, expectedTimeMs, THRESHOLD_MS);

  // Release Media Pipeline
  if (mp != null) {
    mp.release();
  }

}
 

开发者ID:Kurento,
项目名称:kurento-java,
代码行数:67,
代码来源:RecorderWebRtcSwitchSequentialTest.java

示例21: doTest

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public void doTest(final MediaProfileSpecType mediaProfileSpecType, String expectedVideoCodec,
    String expectedAudioCodec, final String extension) throws Exception {

  MediaPipeline mp = null;

  // Media Pipeline
  mp = kurentoClient.createMediaPipeline();
  final WebRtcEndpoint webRtcSender = new WebRtcEndpoint.Builder(mp).build();
  final WebRtcEndpoint[] webRtcReceiver = new WebRtcEndpoint[numViewers];
  final RecorderEndpoint[] recorder = new RecorderEndpoint[numViewers];
  final String[] recordingFile = new String[numViewers];

  // WebRTC sender negotiation
  getPage(0).subscribeLocalEvents("playing");
  getPage(0).initWebRtc(webRtcSender, WebRtcChannel.AUDIO_AND_VIDEO, WebRtcMode.SEND_ONLY);
  Assert.assertTrue("Not received media in sender", getPage(0).waitForEvent("playing"));

  ExecutorService executor = Executors.newFixedThreadPool(numViewers);
  final CountDownLatch latch = new CountDownLatch(numViewers);
  final MediaPipeline pipeline = mp;
  for (int j = 1; j <= numViewers; j++) {
    final int i = j;
    executor.execute(new Runnable() {
      @Override
      public void run() {
        // N Receiver WebRTC and Recorder
        webRtcReceiver[i - 1] = new WebRtcEndpoint.Builder(pipeline).build();
        recordingFile[i - 1] = getRecordUrl("-receiver" + i + extension);
        recorder[i - 1] = new RecorderEndpoint.Builder(pipeline, recordingFile[i - 1])
            .withMediaProfile(mediaProfileSpecType).build();

        webRtcSender.connect(webRtcReceiver[i - 1]);
        webRtcSender.connect(recorder[i - 1]);

        try {
          // WebRTC receiver negotiation
          getPage(i).subscribeEvents("playing");
          getPage(i).initWebRtc(webRtcReceiver[i - 1], WebRtcChannel.AUDIO_AND_VIDEO,
              WebRtcMode.RCV_ONLY);
          Assert.assertTrue("Not received media in receiver " + i,
              getPage(i).waitForEvent("playing"));

          // Start record
          recorder[i - 1].record();

          // Wait play time
          Thread.sleep(PLAYTIME_MS);

          // Stop record
          recorder[i - 1].stopAndWait();

          // Guard time to stop recording
          Thread.sleep(4000);

        } catch (InterruptedException e) {
          log.error("InterruptedException in receiver " + i, e);
        }

        latch.countDown();
      }
    });
  }

  // Wait to finish all receivers
  latch.await(getPage(0).getTimeout(), TimeUnit.SECONDS);

  // Assessments
  for (int j = 1; j <= numViewers; j++) {
    AssertMedia.assertCodecs(recordingFile[j - 1], expectedVideoCodec, expectedAudioCodec);
    AssertMedia.assertDuration(recordingFile[j - 1], PLAYTIME_MS, THRESHOLD_MS);
  }

  // Release Media Pipeline
  if (mp != null) {
    mp.release();
  }

}
 

开发者ID:Kurento,
项目名称:kurento-java,
代码行数:79,
代码来源:RecorderWebRtcOneToManyTest.java

示例22: doTest

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public void doTest(final MediaProfileSpecType mediaProfileSpecType, String expectedVideoCodec,
    String expectedAudioCodec, final String extension) throws Exception {

  MediaPipeline mp = null;

  // Media Pipeline
  mp = kurentoClient.createMediaPipeline();
  final PlayerEndpoint playerEp =
      new PlayerEndpoint.Builder(mp, getPlayerUrl("/video/60sec/ball.webm")).build();

  final RecorderEndpoint[] recorder = new RecorderEndpoint[numViewers];
  final String[] recordingFile = new String[numViewers];
  playerEp.play();

  ExecutorService executor = Executors.newFixedThreadPool(numViewers);
  final CountDownLatch latch = new CountDownLatch(numViewers);
  final MediaPipeline pipeline = mp;
  for (int j = 0; j < numViewers; j++) {
    final int i = j;
    executor.execute(new Runnable() {
      @Override
      public void run() {
        try {
          // N recorders
          recordingFile[i] = getRecordUrl("-recorder" + i + extension);
          recorder[i] = new RecorderEndpoint.Builder(pipeline, recordingFile[i])
              .withMediaProfile(mediaProfileSpecType).build();
          playerEp.connect(recorder[i]);

          // Start record
          recorder[i].record();

          // Wait play time
          Thread.sleep(PLAYTIME_MS);

          // Stop record
          recorder[i].stopAndWait();

          // Guard time to stop recording
          Thread.sleep(4000);

        } catch (Throwable t) {
          log.error("Exception in receiver " + i, t);
        }

        latch.countDown();
      }
    });
  }

  // Wait to finish all recordings
  latch.await();

  // Assessments
  for (int j = 0; j < numViewers; j++) {
    AssertMedia.assertCodecs(recordingFile[j], expectedVideoCodec, expectedAudioCodec);
    AssertMedia.assertDuration(recordingFile[j], PLAYTIME_MS, THRESHOLD_MS);
  }

  // Release Media Pipeline
  if (mp != null) {
    mp.release();
  }

}
 

开发者ID:Kurento,
项目名称:kurento-java,
代码行数:66,
代码来源:RecorderPlayerOneToManyTest.java

示例23: doTest

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public void doTest(MediaProfileSpecType mediaProfileSpecType, String expectedVideoCodec,
    String expectedAudioCodec, String extension) throws Exception {

  final CountDownLatch recorderLatch = new CountDownLatch(1);

  MediaPipeline mp = null;

  // Media Pipeline
  mp = kurentoClient.createMediaPipeline();
  PlayerEndpoint playerEp1 =
      new PlayerEndpoint.Builder(mp, getPlayerUrl("/video/60sec/ball.webm")).build();
  PlayerEndpoint playerEp2 =
      new PlayerEndpoint.Builder(mp, getPlayerUrl("/video/60sec/smpte.webm")).build();

  String recordingFile = getRecordUrl(extension);
  RecorderEndpoint recorderEp = new RecorderEndpoint.Builder(mp, recordingFile)
      .withMediaProfile(mediaProfileSpecType).build();

  // Start play and record
  playerEp1.play();
  playerEp2.play();
  recorderEp.record();

  // Switch players
  for (int i = 0; i < SWITCH_TIMES; i++) {
    if (i % 2 == 0) {
      playerEp1.connect(recorderEp);
    } else {
      playerEp2.connect(recorderEp);
    }

    Thread.sleep(SWITCH_RATE_MS);
  }

  // Stop play and record
  playerEp1.stop();
  playerEp2.stop();
  recorderEp.stop(new Continuation<Void>() {

    @Override
    public void onSuccess(Void result) throws Exception {
      recorderLatch.countDown();
    }

    @Override
    public void onError(Throwable cause) throws Exception {
      recorderLatch.countDown();
    }
  });

  Assert.assertTrue("Not stop properly",
      recorderLatch.await(TIMEOUT, TimeUnit.SECONDS));

  // Assessments
  long expectedTimeMs = SWITCH_TIMES * SWITCH_RATE_MS;
  AssertMedia.assertCodecs(recordingFile, expectedVideoCodec, expectedAudioCodec);
  AssertMedia.assertDuration(recordingFile, expectedTimeMs, THRESHOLD_MS);

  // Release Media Pipeline
  if (mp != null) {
    mp.release();
  }

}
 

开发者ID:Kurento,
项目名称:kurento-java,
代码行数:65,
代码来源:RecorderPlayerSwitchSequentialTest.java

示例24: doTest

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public void doTest(final MediaProfileSpecType mediaProfileSpecType, String expectedVideoCodec,
    String expectedAudioCodec, final String extension) throws Exception {

  MediaPipeline mp = null;

  // Media Pipeline
  mp = kurentoClient.createMediaPipeline();
  final WebRtcEndpoint webRtcSender = new WebRtcEndpoint.Builder(mp).build();

  // WebRTC sender negotiation
  getPage().subscribeLocalEvents("playing");
  getPage().initWebRtc(webRtcSender, WebRtcChannel.AUDIO_AND_VIDEO, WebRtcMode.SEND_ONLY);
  Assert.assertTrue("Not received media in sender webrtc", getPage().waitForEvent("playing"));

  // Recorder
  String recordingFile = getRecordUrl(extension);
  RecorderEndpoint recorder = new RecorderEndpoint.Builder(mp, recordingFile)
      .withMediaProfile(mediaProfileSpecType).build();
  webRtcSender.connect(recorder);

  // Start recorder
  recorder.record();

  // Wait recording time
  Thread.sleep(RECORD_MS);

  // Stop recorder
  recorder.stopAndWait();

  // Guard time to stop recording
  Thread.sleep(4000);

  // Assessments
  AssertMedia.assertCodecs(recordingFile, expectedVideoCodec, expectedAudioCodec);
  AssertMedia.assertDuration(recordingFile, RECORD_MS, THRESHOLD_MS);

  // Release Media Pipeline
  if (mp != null) {
    mp.release();
  }

}
 

开发者ID:Kurento,
项目名称:kurento-java,
代码行数:43,
代码来源:RecorderWebRtcLongFileTest.java

示例25: doTest

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
public void doTest(final MediaProfileSpecType mediaProfileSpecType, String expectedAudioCodec,
    final String extension) throws Exception {

  long testDurationMillis =
      PropertiesManager.getProperty(TEST_DURATION_PROPERTY, DEFAULT_TEST_DURATION);

  MediaPipeline mp = kurentoClient.createMediaPipeline();

  final CountDownLatch errorPipelinelatch = new CountDownLatch(1);

  mp.addErrorListener(new EventListener<ErrorEvent>() {

    @Override
    public void onEvent(ErrorEvent event) {
      msgError = "Description:" + event.getDescription() + "; Error code:" + event.getType();
      log.error(msgError);
      errorPipelinelatch.countDown();
    }
  });
  final WebRtcEndpoint webRtcSender = new WebRtcEndpoint.Builder(mp).build();

  // WebRTC sender negotiation
  getPage().subscribeLocalEvents("playing");
  getPage().initWebRtc(webRtcSender, WebRtcChannel.AUDIO_ONLY, WebRtcMode.SEND_ONLY);
  Assert.assertTrue("Not received media in sender webrtc", getPage().waitForEvent("playing"));

  // Recorder
  String recordingFile = getRecordUrl(extension);
  RecorderEndpoint recorder = new RecorderEndpoint.Builder(mp, recordingFile)
      .withMediaProfile(mediaProfileSpecType).build();
  webRtcSender.connect(recorder);

  // Start recorder
  recorder.record();

  // Wait recording time
  Thread.sleep(testDurationMillis);

  // Stop recorder
  final CountDownLatch recorderLatch = new CountDownLatch(1);
  recorder.stopAndWait(new Continuation<Void>() {

    @Override
    public void onSuccess(Void result) throws Exception {
      recorderLatch.countDown();
    }

    @Override
    public void onError(Throwable cause) throws Exception {
      recorderLatch.countDown();
    }
  });

  // Release Media Pipeline
  Assert.assertTrue("Not stop properly",
      recorderLatch.await(getPage().getTimeout(), TimeUnit.SECONDS));
  if (mp != null) {
    mp.release();
  }

  Assert.assertTrue(msgError, errorPipelinelatch.getCount() == 1);

  waitForFileExists(recordingFile);

  // Assessments
  AssertMedia.assertDuration(recordingFile, testDurationMillis, THRESHOLD_MS);

}
 

开发者ID:Kurento,
项目名称:kurento-java,
代码行数:69,
代码来源:LongStabilityRecorderS3Test.java

示例26: setupMediaElements

点赞 2

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
@Before
public void setupMediaElements() {
  recorder = new RecorderEndpoint.Builder(pipeline, URL_SMALL).build();

}
 

开发者ID:Kurento,
项目名称:kurento-java,
代码行数:6,
代码来源:RecorderEndpointTest.java

示例27: setupMediaElements

点赞 1

import org.kurento.client.RecorderEndpoint; //导入依赖的package包/类
@Before
public void setupMediaElements() throws InterruptedException {

  AsyncResultManager<RecorderEndpoint> async =
      new AsyncResultManager<>("RecorderEndpoint creation");

  new RecorderEndpoint.Builder(pipeline, URL_SMALL).buildAsync(async.getContinuation());

  recorder = async.waitForResult();

  Assert.assertNotNull(recorder);
}
 

开发者ID:Kurento,
项目名称:kurento-java,
代码行数:13,
代码来源:RecorderEndpointAsyncTest.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)