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

Side by Side Diff: webrtc/sdk/android/instrumentationtests/src/org/webrtc/CameraVideoCapturerTestFixtures.java

Issue 2982213002: Add support for capturers to capture VideoFrames. (Closed)
Patch Set: Minor changes Created 3 years, 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 byte[] frame, int width, int height, int rotation, long timeStamp) { 128 byte[] frame, int width, int height, int rotation, long timeStamp) {
129 synchronized (frameLock) { 129 synchronized (frameLock) {
130 ++framesCaptured; 130 ++framesCaptured;
131 frameSize = frame.length; 131 frameSize = frame.length;
132 frameWidth = width; 132 frameWidth = width;
133 frameHeight = height; 133 frameHeight = height;
134 timestamps.add(timeStamp); 134 timestamps.add(timeStamp);
135 frameLock.notify(); 135 frameLock.notify();
136 } 136 }
137 } 137 }
138
138 @Override 139 @Override
139 public void onTextureFrameCaptured(int width, int height, int oesTextureId, 140 public void onTextureFrameCaptured(int width, int height, int oesTextureId,
140 float[] transformMatrix, int rotation, long timeStamp) { 141 float[] transformMatrix, int rotation, long timeStamp) {
141 synchronized (frameLock) { 142 synchronized (frameLock) {
142 ++framesCaptured; 143 ++framesCaptured;
143 frameWidth = width; 144 frameWidth = width;
144 frameHeight = height; 145 frameHeight = height;
145 frameSize = 0; 146 frameSize = 0;
146 timestamps.add(timeStamp); 147 timestamps.add(timeStamp);
147 frameLock.notify(); 148 frameLock.notify();
148 } 149 }
149 } 150 }
150 151
152 @Override
153 public void onFrameCaptured(VideoFrame frame) {
154 // Empty on purpose.
155 }
156
151 public boolean waitForCapturerToStart() throws InterruptedException { 157 public boolean waitForCapturerToStart() throws InterruptedException {
152 Logging.d(TAG, "Waiting for the capturer to start"); 158 Logging.d(TAG, "Waiting for the capturer to start");
153 synchronized (capturerStartLock) { 159 synchronized (capturerStartLock) {
154 capturerStartLock.wait(); 160 capturerStartLock.wait();
155 return capturerStartResult; 161 return capturerStartResult;
156 } 162 }
157 } 163 }
158 164
159 public int waitForNextCapturedFrame() throws InterruptedException { 165 public int waitForNextCapturedFrame() throws InterruptedException {
160 Logging.d(TAG, "Waiting for the next captured frame"); 166 Logging.d(TAG, "Waiting for the next captured frame");
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 final CapturerInstance capturerInstance = createCapturer(cameraName, true /* initialize */); 844 final CapturerInstance capturerInstance = createCapturer(cameraName, true /* initialize */);
839 845
840 final Object competingCamera = testObjectFactory.rawOpenCamera(cameraName); 846 final Object competingCamera = testObjectFactory.rawOpenCamera(cameraName);
841 847
842 startCapture(capturerInstance); 848 startCapture(capturerInstance);
843 disposeCapturer(capturerInstance); 849 disposeCapturer(capturerInstance);
844 850
845 testObjectFactory.rawCloseCamera(competingCamera); 851 testObjectFactory.rawCloseCamera(competingCamera);
846 } 852 }
847 } 853 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698