Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(821)

Unified Diff: webrtc/examples/androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java

Issue 1482333002: Add simple end to end test for video capture and encode using textures. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/examples/androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java
diff --git a/webrtc/examples/androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java b/webrtc/examples/androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java
index afcab3ce3ac2ca6c0e1971d06adb301b71d02fda..5330bd2ea8014e0822f551a79daf61cbe0e2f749 100644
--- a/webrtc/examples/androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java
+++ b/webrtc/examples/androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java
@@ -22,6 +22,7 @@ import org.appspot.apprtc.PeerConnectionClient.PeerConnectionParameters;
import org.appspot.apprtc.util.LooperExecutor;
import org.webrtc.EglBase;
import org.webrtc.IceCandidate;
+import org.webrtc.MediaCodecVideoEncoder;
import org.webrtc.PeerConnection;
import org.webrtc.PeerConnectionFactory;
import org.webrtc.SessionDescription;
@@ -224,7 +225,7 @@ public class PeerConnectionClientTest extends InstrumentationTestCase
PeerConnectionClient createPeerConnectionClient(
MockRenderer localRenderer, MockRenderer remoteRenderer,
- PeerConnectionParameters peerConnectionParameters, boolean decodeToTexture) {
+ PeerConnectionParameters peerConnectionParameters, boolean useTexures) {
List<PeerConnection.IceServer> iceServers =
new LinkedList<PeerConnection.IceServer>();
SignalingParameters signalingParameters = new SignalingParameters(
@@ -239,18 +240,27 @@ public class PeerConnectionClientTest extends InstrumentationTestCase
client.setPeerConnectionFactoryOptions(options);
client.createPeerConnectionFactory(
getInstrumentation().getContext(), peerConnectionParameters, this);
- client.createPeerConnection(decodeToTexture ? eglBase.getContext() : null,
+ client.createPeerConnection(useTexures ? eglBase.getContext() : null,
localRenderer, remoteRenderer, signalingParameters);
client.createOffer();
return client;
}
- private PeerConnectionParameters createParameters(boolean enableVideo,
- String videoCodec) {
+ private PeerConnectionParameters createParametersForAudioCall() {
PeerConnectionParameters peerConnectionParameters =
new PeerConnectionParameters(
- enableVideo, true, // videoCallEnabled, loopback.
- 0, 0, 0, 0, videoCodec, true, false, // video codec parameters.
+ false, true, // videoCallEnabled, loopback.
+ 0, 0, 0, 0, "", true, false, // video codec parameters.
+ 0, "OPUS", false, false); // audio codec parameters.
+ return peerConnectionParameters;
+ }
+
+ private PeerConnectionParameters createParametersForVideoCall(
+ String videoCodec, boolean captureToTexture) {
+ PeerConnectionParameters peerConnectionParameters =
+ new PeerConnectionParameters(
+ true, true, // videoCallEnabled, loopback.
+ 0, 0, 0, 0, videoCodec, true, captureToTexture, // video codec parameters.
0, "OPUS", false, false); // audio codec parameters.
return peerConnectionParameters;
}
@@ -277,7 +287,8 @@ public class PeerConnectionClientTest extends InstrumentationTestCase
Log.d(TAG, "testSetLocalOfferMakesVideoFlowLocally");
MockRenderer localRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, LOCAL_RENDERER_NAME);
pcClient = createPeerConnectionClient(
- localRenderer, new MockRenderer(0, null), createParameters(true, VIDEO_CODEC_VP8), false);
+ localRenderer, new MockRenderer(0, null),
+ createParametersForVideoCall(VIDEO_CODEC_VP8, false), false);
// Wait for local SDP and ice candidates set events.
assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT));
@@ -337,46 +348,74 @@ public class PeerConnectionClientTest extends InstrumentationTestCase
}
public void testLoopbackAudio() throws InterruptedException {
- doLoopbackTest(createParameters(false, VIDEO_CODEC_VP8), false);
+ doLoopbackTest(createParametersForAudioCall(), false);
}
public void testLoopbackVp8() throws InterruptedException {
- doLoopbackTest(createParameters(true, VIDEO_CODEC_VP8), false);
+ doLoopbackTest(createParametersForVideoCall(VIDEO_CODEC_VP8, false), false);
}
public void DISABLED_testLoopbackVp9() throws InterruptedException {
- doLoopbackTest(createParameters(true, VIDEO_CODEC_VP9), false);
+ doLoopbackTest(createParametersForVideoCall(VIDEO_CODEC_VP9, false), false);
}
public void testLoopbackH264() throws InterruptedException {
- doLoopbackTest(createParameters(true, VIDEO_CODEC_H264), false);
+ doLoopbackTest(createParametersForVideoCall(VIDEO_CODEC_H264, false), false);
}
public void testLoopbackVp8DecodeToTexture() throws InterruptedException {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
- Log.i(TAG, "Decode to textures is not supported, requires EGL14.");
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
+ Log.i(TAG, "Decode to textures is not supported, requires SDK version 19.");
return;
}
-
- doLoopbackTest(createParameters(true, VIDEO_CODEC_VP8), true);
+ doLoopbackTest(createParametersForVideoCall(VIDEO_CODEC_VP8, false), true);
}
public void DISABLED_testLoopbackVp9DecodeToTexture() throws InterruptedException {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
- Log.i(TAG, "Decode to textures is not supported, requires EGL14.");
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
+ Log.i(TAG, "Decode to textures is not supported, requires SDK version 19.");
return;
}
- doLoopbackTest(createParameters(true, VIDEO_CODEC_VP9), true);
+ doLoopbackTest(createParametersForVideoCall(VIDEO_CODEC_VP9, false), true);
}
public void testLoopbackH264DecodeToTexture() throws InterruptedException {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
- Log.i(TAG, "Decode to textures is not supported, requires EGL14.");
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
+ Log.i(TAG, "Decode to textures is not supported, requires SDK version 19.");
+ return;
+ }
+ doLoopbackTest(createParametersForVideoCall(VIDEO_CODEC_H264, false), true);
+ }
+
+ public void testLoopbackVp8CaptureToTexture() throws InterruptedException {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
+ Log.i(TAG, "Encode to textures is not supported. Requires SDK version 19");
+ return;
+ }
+ // TODO(perkj): If we can always capture to textures, there is no need to check if the
+ // hardware encoder supports to encode from a texture.
+ if (!MediaCodecVideoEncoder.isVp8HwSupportedUsingTextures()) {
+ Log.i(TAG, "VP8 encode to textures is not supported.");
+ return;
+ }
+ doLoopbackTest(createParametersForVideoCall(VIDEO_CODEC_VP8, true), true);
+ }
+
+ public void testLoopbackH264CaptureToTexture() throws InterruptedException {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
+ Log.i(TAG, "Encode to textures is not supported. Requires KITKAT");
return;
}
- doLoopbackTest(createParameters(true, VIDEO_CODEC_H264), true);
+ // TODO(perkj): If we can always capture to textures, there is no need to check if the
+ // hardware encoder supports to encode from a texture.
+ if (!MediaCodecVideoEncoder.isH264HwSupportedUsingTextures()) {
+ Log.i(TAG, "H264 encode to textures is not supported.");
+ return;
+ }
+ doLoopbackTest(createParametersForVideoCall(VIDEO_CODEC_H264, true), true);
}
+
// Checks if default front camera can be switched to back camera and then
// again to front camera.
public void testCameraSwitch() throws InterruptedException {
@@ -387,7 +426,7 @@ public class PeerConnectionClientTest extends InstrumentationTestCase
MockRenderer remoteRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, REMOTE_RENDERER_NAME);
pcClient = createPeerConnectionClient(
- localRenderer, remoteRenderer, createParameters(true, VIDEO_CODEC_VP8), false);
+ localRenderer, remoteRenderer, createParametersForVideoCall(VIDEO_CODEC_VP8, false), false);
// Wait for local SDP, rename it to answer and set as remote SDP.
assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT));
@@ -433,7 +472,7 @@ public class PeerConnectionClientTest extends InstrumentationTestCase
MockRenderer remoteRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, REMOTE_RENDERER_NAME);
pcClient = createPeerConnectionClient(
- localRenderer, remoteRenderer, createParameters(true, VIDEO_CODEC_VP8), false);
+ localRenderer, remoteRenderer, createParametersForVideoCall(VIDEO_CODEC_VP8, false), false);
// Wait for local SDP, rename it to answer and set as remote SDP.
assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698