aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTest.java6
-rw-r--r--talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java6
-rw-r--r--talk/app/webrtc/java/jni/peerconnection_jni.cc44
-rw-r--r--talk/app/webrtc/java/src/org/webrtc/VideoRenderer.java2
-rw-r--r--talk/app/webrtc/java/testcommon/src/org/webrtc/PeerConnectionTest.java32
-rw-r--r--webrtc/examples/androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java11
6 files changed, 11 insertions, 90 deletions
diff --git a/talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTest.java b/talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTest.java
index e8d616f272..5c700ef635 100644
--- a/talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTest.java
+++ b/talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTest.java
@@ -50,12 +50,6 @@ public class VideoCapturerAndroidTest extends ActivityTestCase {
}
}
- // TODO(guoweis): Remove this once chrome code base is updated.
- @Override
- public boolean canApplyRotation() {
- return false;
- }
-
public int WaitForNextFrameToRender() throws InterruptedException {
synchronized (frameLock) {
frameLock.wait();
diff --git a/talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java b/talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java
index a685c397c8..adee98bb5b 100644
--- a/talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java
+++ b/talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java
@@ -454,12 +454,6 @@ public class VideoRendererGui implements GLSurfaceView.Renderer {
// Request rendering.
surface.requestRender();
}
-
- // TODO(guoweis): Remove this once chrome code base is updated.
- @Override
- public boolean canApplyRotation() {
- return true;
- }
}
/** Passes GLSurfaceView to video renderer. */
diff --git a/talk/app/webrtc/java/jni/peerconnection_jni.cc b/talk/app/webrtc/java/jni/peerconnection_jni.cc
index bf0f006629..c326ccff6b 100644
--- a/talk/app/webrtc/java/jni/peerconnection_jni.cc
+++ b/talk/app/webrtc/java/jni/peerconnection_jni.cc
@@ -740,9 +740,6 @@ class JavaVideoRendererWrapper : public VideoRendererInterface {
j_render_frame_id_(GetMethodID(
jni, GetObjectClass(jni, j_callbacks), "renderFrame",
"(Lorg/webrtc/VideoRenderer$I420Frame;)V")),
- j_can_apply_rotation_id_(GetMethodID(
- jni, GetObjectClass(jni, j_callbacks),
- "canApplyRotation", "()Z")),
j_frame_class_(jni,
FindClass(jni, "org/webrtc/VideoRenderer$I420Frame")),
j_i420_frame_ctor_id_(GetMethodID(
@@ -750,9 +747,7 @@ class JavaVideoRendererWrapper : public VideoRendererInterface {
j_texture_frame_ctor_id_(GetMethodID(
jni, *j_frame_class_, "<init>",
"(IIILjava/lang/Object;I)V")),
- j_byte_buffer_class_(jni, FindClass(jni, "java/nio/ByteBuffer")),
- can_apply_rotation_set_(false),
- can_apply_rotation_(false) {
+ j_byte_buffer_class_(jni, FindClass(jni, "java/nio/ByteBuffer")) {
CHECK_EXCEPTION(jni);
}
@@ -760,38 +755,16 @@ class JavaVideoRendererWrapper : public VideoRendererInterface {
void RenderFrame(const cricket::VideoFrame* video_frame) override {
ScopedLocalRefFrame local_ref_frame(jni());
-
- // Calling CanApplyRotation here to ensure can_apply_rotation_ is set.
- CanApplyRotation();
-
- const cricket::VideoFrame* frame =
- can_apply_rotation_ ? video_frame
- : video_frame->GetCopyWithRotationApplied();
- if (frame->GetNativeHandle() != NULL) {
- jobject j_frame = CricketToJavaTextureFrame(frame);
- jni()->CallVoidMethod(*j_callbacks_, j_render_frame_id_, j_frame);
- CHECK_EXCEPTION(jni());
- } else {
- jobject j_frame = CricketToJavaI420Frame(frame);
- jni()->CallVoidMethod(*j_callbacks_, j_render_frame_id_, j_frame);
- CHECK_EXCEPTION(jni());
- }
+ jobject j_frame = (video_frame->GetNativeHandle() != nullptr)
+ ? CricketToJavaTextureFrame(video_frame)
+ : CricketToJavaI420Frame(video_frame);
+ jni()->CallVoidMethod(*j_callbacks_, j_render_frame_id_, j_frame);
+ CHECK_EXCEPTION(jni());
}
// TODO(guoweis): Report that rotation is supported as RenderFrame calls
// GetCopyWithRotationApplied.
- virtual bool CanApplyRotation() override {
- if (can_apply_rotation_set_) {
- return can_apply_rotation_;
- }
- ScopedLocalRefFrame local_ref_frame(jni());
- jboolean ret =
- jni()->CallBooleanMethod(*j_callbacks_, j_can_apply_rotation_id_);
- CHECK_EXCEPTION(jni());
- can_apply_rotation_ = ret;
- can_apply_rotation_set_ = true;
- return ret;
- }
+ virtual bool CanApplyRotation() override { return true; }
private:
// Return a VideoRenderer.I420Frame referring to the data in |frame|.
@@ -839,13 +812,10 @@ class JavaVideoRendererWrapper : public VideoRendererInterface {
ScopedGlobalRef<jobject> j_callbacks_;
jmethodID j_render_frame_id_;
- jmethodID j_can_apply_rotation_id_;
ScopedGlobalRef<jclass> j_frame_class_;
jmethodID j_i420_frame_ctor_id_;
jmethodID j_texture_frame_ctor_id_;
ScopedGlobalRef<jclass> j_byte_buffer_class_;
- bool can_apply_rotation_set_;
- bool can_apply_rotation_;
};
diff --git a/talk/app/webrtc/java/src/org/webrtc/VideoRenderer.java b/talk/app/webrtc/java/src/org/webrtc/VideoRenderer.java
index 596d3779a9..b496f3ebcc 100644
--- a/talk/app/webrtc/java/src/org/webrtc/VideoRenderer.java
+++ b/talk/app/webrtc/java/src/org/webrtc/VideoRenderer.java
@@ -172,8 +172,6 @@ public class VideoRenderer {
// |frame| might have pending rotation and implementation of Callbacks
// should handle that by applying rotation during rendering.
public void renderFrame(I420Frame frame);
- // TODO(guoweis): Remove this once chrome code base is updated.
- public boolean canApplyRotation();
}
// |this| either wraps a native (GUI) renderer or a client-supplied Callbacks
diff --git a/talk/app/webrtc/java/testcommon/src/org/webrtc/PeerConnectionTest.java b/talk/app/webrtc/java/testcommon/src/org/webrtc/PeerConnectionTest.java
index e7b24b17ba..5133723ea6 100644
--- a/talk/app/webrtc/java/testcommon/src/org/webrtc/PeerConnectionTest.java
+++ b/talk/app/webrtc/java/testcommon/src/org/webrtc/PeerConnectionTest.java
@@ -134,16 +134,10 @@ public class PeerConnectionTest {
@Override
public synchronized void renderFrame(VideoRenderer.I420Frame frame) {
- setSize(frame.width, frame.height);
+ setSize(frame.rotatedWidth(), frame.rotatedHeight());
--expectedFramesDelivered;
}
- // TODO(guoweis): Remove this once chrome code base is updated.
- @Override
- public boolean canApplyRotation() {
- return false;
- }
-
public synchronized void expectSignalingChange(SignalingState newState) {
expectedSignalingChanges.add(newState);
}
@@ -438,30 +432,6 @@ public class PeerConnectionTest {
static int videoWindowsMapped = -1;
- private static class TestRenderer implements VideoRenderer.Callbacks {
- public int width = -1;
- public int height = -1;
- public int numFramesDelivered = 0;
-
- private void setSize(int width, int height) {
- assertEquals(this.width, -1);
- assertEquals(this.height, -1);
- this.width = width;
- this.height = height;
- }
-
- @Override
- public void renderFrame(VideoRenderer.I420Frame frame) {
- ++numFramesDelivered;
- }
-
- // TODO(guoweis): Remove this once chrome code base is updated.
- @Override
- public boolean canApplyRotation() {
- return false;
- }
- }
-
private static VideoRenderer createVideoRenderer(
VideoRenderer.Callbacks videoCallbacks) {
if (!RENDER_TO_GUI) {
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 00a8187f9a..d7df8d7f1f 100644
--- a/webrtc/examples/androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java
+++ b/webrtc/examples/androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java
@@ -83,19 +83,14 @@ public class PeerConnectionClientTest extends InstrumentationTestCase
doneRendering = new CountDownLatch(expectedFrames);
}
- // TODO(guoweis): Remove this once chrome code base is updated.
- @Override
- public boolean canApplyRotation() {
- return false;
- }
-
@Override
public synchronized void renderFrame(VideoRenderer.I420Frame frame) {
if (!renderFrameCalled) {
if (rendererName != null) {
- Log.d(TAG, rendererName + " render frame: " + frame.width + " x " + frame.height);
+ Log.d(TAG, rendererName + " render frame: "
+ + frame.rotatedWidth() + " x " + frame.rotatedHeight());
} else {
- Log.d(TAG, "Render frame: " + frame.width + " x " + frame.height);
+ Log.d(TAG, "Render frame: " + frame.rotatedWidth() + " x " + frame.rotatedHeight());
}
}
renderFrameCalled = true;