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

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

Issue 1486423003: Fix error prone code in VideoCapturerAndroid (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased Created 5 years 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/android/org/webrtc/CameraEnumerationAndroid.java ('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/android/org/webrtc/VideoCapturerAndroid.java
diff --git a/talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java b/talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java
index d85f2c5588c879b32aed083a046700f13b29968c..caeb389137361cf4fcc7faa8df7a321624be8f73 100644
--- a/talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java
+++ b/talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java
@@ -359,7 +359,7 @@ public class VideoCapturerAndroid extends VideoCapturer implements
videoBuffers = new FramePool(cameraThread);
isCapturingToTexture = (sharedContext != null);
cameraStatistics =
- new CameraStatistics(isCapturingToTexture ? 1 : videoBuffers.numCaptureBuffers);
+ new CameraStatistics(isCapturingToTexture ? 1 : FramePool.NUMBER_OF_CAPTURE_BUFFERS);
surfaceHelper = SurfaceTextureHelper.create(sharedContext, cameraThreadHandler);
if (isCapturingToTexture) {
surfaceHelper.setListener(this);
@@ -535,7 +535,7 @@ public class VideoCapturerAndroid extends VideoCapturer implements
range[android.hardware.Camera.Parameters.PREVIEW_FPS_MAX_INDEX]);
// Check if we are already using this capture format, then we don't need to do anything.
- if (captureFormat.equals(this.captureFormat)) {
+ if (captureFormat.isSameFormat(this.captureFormat)) {
return;
}
@@ -777,7 +777,7 @@ public class VideoCapturerAndroid extends VideoCapturer implements
// Arbitrary queue depth. Higher number means more memory allocated & held,
// lower number means more sensitivity to processing time in the client (and
// potentially stalling the capturer if it runs out of buffers to write to).
- public static final int numCaptureBuffers = 3;
+ public static final int NUMBER_OF_CAPTURE_BUFFERS = 3;
// This container tracks the buffers added as camera callback buffers. It is needed for finding
// the corresponding ByteBuffer given a byte[].
private final Map<byte[], ByteBuffer> queuedBuffers = new IdentityHashMap<byte[], ByteBuffer>();
@@ -804,12 +804,12 @@ public class VideoCapturerAndroid extends VideoCapturer implements
this.frameSize = frameSize;
queuedBuffers.clear();
- for (int i = 0; i < numCaptureBuffers; ++i) {
+ for (int i = 0; i < NUMBER_OF_CAPTURE_BUFFERS; ++i) {
final ByteBuffer buffer = ByteBuffer.allocateDirect(frameSize);
camera.addCallbackBuffer(buffer.array());
queuedBuffers.put(buffer.array(), buffer);
}
- Logging.d(TAG, "queueCameraBuffers enqueued " + numCaptureBuffers
+ Logging.d(TAG, "queueCameraBuffers enqueued " + NUMBER_OF_CAPTURE_BUFFERS
+ " buffers of size " + frameSize + ".");
}
« no previous file with comments | « talk/app/webrtc/java/android/org/webrtc/CameraEnumerationAndroid.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698