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}
This commit is contained in:
parent
90ce01dbbe
commit
ff9793c600
@ -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);
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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);
|
||||
|
||||
/**
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user