From ff9793c600d81af8a64e5610998763d2358bcb32 Mon Sep 17 00:00:00 2001 From: magjed Date: Thu, 29 Sep 2016 02:14:32 -0700 Subject: [PATCH] Android: Remove onOutputFormatRequest from the VideoCapturer interface Remove onOutputFormatRequest from the VideoCapturer interface and from all implementations of that interface. Apps should now use VideoSource.adaptOutputFormat() instead. BUG=webrtc:6391 Review-Url: https://codereview.webrtc.org/2373353002 Cr-Commit-Position: refs/heads/master@{#14428} --- .../java/src/org/webrtc/CameraCapturer.java | 11 ---------- .../src/org/webrtc/ScreenCapturerAndroid.java | 12 ----------- .../java/src/org/webrtc/VideoCapturer.java | 18 ---------------- .../src/org/webrtc/VideoCapturerAndroid.java | 21 ------------------- .../jni/androidvideotracksource_jni.cc | 8 ------- .../CameraVideoCapturerTestFixtures.java | 4 ---- 6 files changed, 74 deletions(-) diff --git a/webrtc/api/android/java/src/org/webrtc/CameraCapturer.java b/webrtc/api/android/java/src/org/webrtc/CameraCapturer.java index 6d4a1561c1..293022fad1 100644 --- a/webrtc/api/android/java/src/org/webrtc/CameraCapturer.java +++ b/webrtc/api/android/java/src/org/webrtc/CameraCapturer.java @@ -307,17 +307,6 @@ public abstract class CameraCapturer implements CameraVideoCapturer { Logging.d(TAG, "Stop capture done"); } - @Override - public void onOutputFormatRequest(final int width, final int height, final int framerate) { - cameraThreadHandler.post(new Runnable() { - @Override public void run() { - Logging.d(TAG, "onOutputFormatRequestOnCameraThread: " + width + "x" + height + - "@" + framerate); - capturerObserver.onOutputFormatRequest(width, height, framerate); - } - }); - } - @Override public void changeCaptureFormat(int width, int height, int framerate) { Logging.d(TAG, "changeCaptureFormat: " + width + "x" + height + "@" + framerate); diff --git a/webrtc/api/android/java/src/org/webrtc/ScreenCapturerAndroid.java b/webrtc/api/android/java/src/org/webrtc/ScreenCapturerAndroid.java index bd5f303aab..9b86fe3f56 100644 --- a/webrtc/api/android/java/src/org/webrtc/ScreenCapturerAndroid.java +++ b/webrtc/api/android/java/src/org/webrtc/ScreenCapturerAndroid.java @@ -149,18 +149,6 @@ public class ScreenCapturerAndroid implements isDisposed = true; } - @Override - public synchronized void onOutputFormatRequest( - final int width, final int height, final int framerate) { - checkNotDisposed(); - surfaceTextureHelper.getHandler().post(new Runnable() { - @Override - public void run() { - capturerObserver.onOutputFormatRequest(width, height, framerate); - } - }); - } - /** * Changes output video format. This method can be used to scale the output * video, or to change orientation when the captured screen is rotated for example. diff --git a/webrtc/api/android/java/src/org/webrtc/VideoCapturer.java b/webrtc/api/android/java/src/org/webrtc/VideoCapturer.java index 0a5e7d592a..706c43dc27 100644 --- a/webrtc/api/android/java/src/org/webrtc/VideoCapturer.java +++ b/webrtc/api/android/java/src/org/webrtc/VideoCapturer.java @@ -32,11 +32,6 @@ public interface VideoCapturer { void onTextureFrameCaptured( int width, int height, int oesTextureId, float[] transformMatrix, int rotation, long timestamp); - - // Requests an output format from the video capturer. Captured frames - // by the camera will be scaled/or dropped by the video capturer. - // Called on a Java thread owned by VideoCapturer. - void onOutputFormatRequest(int width, int height, int framerate); } // An implementation of CapturerObserver that forwards all calls from @@ -74,11 +69,6 @@ public interface VideoCapturer { rotation, timestamp); } - @Override - public void onOutputFormatRequest(int width, int height, int framerate) { - nativeOnOutputFormatRequest(nativeSource, width, height, framerate); - } - private native void nativeCapturerStarted(long nativeSource, boolean success); private native void nativeCapturerStopped(long nativeSource); @@ -86,8 +76,6 @@ public interface VideoCapturer { byte[] data, int length, int width, int height, int rotation, long timeStamp); private native void nativeOnTextureFrameCaptured(long nativeSource, int width, int height, int oesTextureId, float[] transformMatrix, int rotation, long timestamp); - private native void nativeOnOutputFormatRequest(long nativeSource, - int width, int height, int framerate); } /** @@ -112,12 +100,6 @@ public interface VideoCapturer { */ void stopCapture() throws InterruptedException; - /** - * Use VideoSource.adaptOutputFormat() instead. - */ - @Deprecated - void onOutputFormatRequest(int width, int height, int framerate); - void changeCaptureFormat(int width, int height, int framerate); /** diff --git a/webrtc/api/android/java/src/org/webrtc/VideoCapturerAndroid.java b/webrtc/api/android/java/src/org/webrtc/VideoCapturerAndroid.java index 9f90f5381f..ec447abf70 100644 --- a/webrtc/api/android/java/src/org/webrtc/VideoCapturerAndroid.java +++ b/webrtc/api/android/java/src/org/webrtc/VideoCapturerAndroid.java @@ -171,20 +171,6 @@ public class VideoCapturerAndroid implements } } - // Requests a new output format from the video capturer. Captured frames - // by the camera will be scaled/or dropped by the video capturer. - // It does not matter if width and height are flipped. I.E, |width| = 640, |height| = 480 produce - // the same result as |width| = 480, |height| = 640. - // TODO(magjed/perkj): Document what this function does. Change name? - @Override - public void onOutputFormatRequest(final int width, final int height, final int framerate) { - maybePostOnCameraThread(new Runnable() { - @Override public void run() { - onOutputFormatRequestOnCameraThread(width, height, framerate); - } - }); - } - // Reconfigure the camera to capture in a new format. This should only be called while the camera // is running. @Override @@ -546,13 +532,6 @@ public class VideoCapturerAndroid implements Logging.d(TAG, "switchCameraOnCameraThread done"); } - private void onOutputFormatRequestOnCameraThread(int width, int height, int framerate) { - checkIsOnCameraThread(); - Logging.d(TAG, "onOutputFormatRequestOnCameraThread: " + width + "x" + height + - "@" + framerate); - frameObserver.onOutputFormatRequest(width, height, framerate); - } - private int getDeviceOrientation() { int orientation = 0; diff --git a/webrtc/api/android/jni/androidvideotracksource_jni.cc b/webrtc/api/android/jni/androidvideotracksource_jni.cc index 9b251276b6..32ed5f8568 100644 --- a/webrtc/api/android/jni/androidvideotracksource_jni.cc +++ b/webrtc/api/android/jni/androidvideotracksource_jni.cc @@ -79,14 +79,6 @@ JOW_OBSERVER_METHOD(void, nativeCapturerStopped) source->SetState(webrtc::AndroidVideoTrackSource::SourceState::kEnded); } -JOW_OBSERVER_METHOD(void, nativeOnOutputFormatRequest) -(JNIEnv* jni, jclass, jlong j_source, jint j_width, jint j_height, jint j_fps) { - LOG(LS_INFO) << "AndroidVideoTrackSourceObserve_nativeOnOutputFormatRequest"; - webrtc::AndroidVideoTrackSource* source = - AndroidVideoTrackSourceFromJavaProxy(j_source); - source->OnOutputFormatRequest(j_width, j_height, j_fps); -} - JOW(void, VideoSource_nativeAdaptOutputFormat) (JNIEnv* jni, jclass, jlong j_source, jint j_width, jint j_height, jint j_fps) { LOG(LS_INFO) << "VideoSource_nativeAdaptOutputFormat"; diff --git a/webrtc/api/androidtests/src/org/webrtc/CameraVideoCapturerTestFixtures.java b/webrtc/api/androidtests/src/org/webrtc/CameraVideoCapturerTestFixtures.java index 9e41d21b22..cbab509286 100644 --- a/webrtc/api/androidtests/src/org/webrtc/CameraVideoCapturerTestFixtures.java +++ b/webrtc/api/androidtests/src/org/webrtc/CameraVideoCapturerTestFixtures.java @@ -139,9 +139,6 @@ class CameraVideoCapturerTestFixtures { } } - @Override - public void onOutputFormatRequest(int width, int height, int fps) {} - public boolean waitForCapturerToStart() throws InterruptedException { Logging.d(TAG, "Waiting for the capturer to start"); synchronized (capturerStartLock) { @@ -523,7 +520,6 @@ class CameraVideoCapturerTestFixtures { // We can't change |capturer| at this point, but we should not crash. capturerInstance.capturer.switchCamera(null /* switchEventsHandler */); - capturerInstance.capturer.onOutputFormatRequest(DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_FPS); capturerInstance.capturer.changeCaptureFormat(DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_FPS); disposeCapturer(capturerInstance);