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

Unified Diff: talk/app/webrtc/java/src/org/webrtc/VideoCapturerAndroid.java

Issue 1178643006: VideoCapturerAndroid: Add possibility to request a new resolution from the video adapter. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: added log message Created 5 years, 6 months 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 | « talk/app/webrtc/java/jni/androidvideocapturer_jni.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/java/src/org/webrtc/VideoCapturerAndroid.java
diff --git a/talk/app/webrtc/java/src/org/webrtc/VideoCapturerAndroid.java b/talk/app/webrtc/java/src/org/webrtc/VideoCapturerAndroid.java
index e40cd1ac29cb9afac7eea536fa6681692f365d81..63388a22f675132af71b509d1582aa14f8f6d869 100644
--- a/talk/app/webrtc/java/src/org/webrtc/VideoCapturerAndroid.java
+++ b/talk/app/webrtc/java/src/org/webrtc/VideoCapturerAndroid.java
@@ -270,6 +270,21 @@ public class VideoCapturerAndroid extends VideoCapturer implements PreviewCallba
return true;
}
+ // Requests a new output format from the video capturer. Captured frames
+ // by the camera will be scaled/or dropped by the video capturer.
+ public synchronized void onOutputFormatRequest(
+ final int width, final int height, final int fps) {
+ if (cameraThreadHandler == null) {
+ Log.e(TAG, "Calling onOutputFormatRequest() for already stopped camera.");
+ return;
+ }
+ cameraThreadHandler.post(new Runnable() {
+ @Override public void run() {
+ onOutputFormatRequestOnCameraThread(width, height, fps);
+ }
+ });
+ }
+
private VideoCapturerAndroid() {
Log.d(TAG, "VideoCapturerAndroid");
}
@@ -641,6 +656,16 @@ public class VideoCapturerAndroid extends VideoCapturer implements PreviewCallba
}
}
+ private void onOutputFormatRequestOnCameraThread(
+ int width, int height, int fps) {
+ if (camera == null) {
+ return;
+ }
+ Log.d(TAG, "onOutputFormatRequestOnCameraThread: " + width + "x" + height +
+ "@" + fps);
+ frameObserver.OnOutputFormatRequest(width, height, fps);
+ }
+
synchronized void returnBuffer(final long timeStamp) {
if (cameraThreadHandler == null) {
// The camera has been stopped.
@@ -919,6 +944,11 @@ public class VideoCapturerAndroid extends VideoCapturer implements PreviewCallba
// VideoCapturerAndroid.
abstract void OnFrameCaptured(byte[] data, int length, 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 VideoCapturerAndroid.
+ abstract void OnOutputFormatRequest(int width, int height, int fps);
}
// An implementation of CapturerObserver that forwards all calls from
@@ -941,9 +971,16 @@ public class VideoCapturerAndroid extends VideoCapturer implements PreviewCallba
nativeOnFrameCaptured(nativeCapturer, data, length, rotation, timeStamp);
}
+ @Override
+ public void OnOutputFormatRequest(int width, int height, int fps) {
+ nativeOnOutputFormatRequest(nativeCapturer, width, height, fps);
+ }
+
private native void nativeCapturerStarted(long nativeCapturer,
boolean success);
private native void nativeOnFrameCaptured(long nativeCapturer,
byte[] data, int length, int rotation, long timeStamp);
+ private native void nativeOnOutputFormatRequest(long nativeCapturer,
+ int width, int height, int fps);
}
}
« no previous file with comments | « talk/app/webrtc/java/jni/androidvideocapturer_jni.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698