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

Side by Side Diff: webrtc/api/android/java/src/org/webrtc/VideoCapturerAndroid.java

Issue 2373353002: Android: Remove onOutputFormatRequest from the VideoCapturer interface (Closed)
Patch Set: Created 4 years, 2 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 switchEventsHandler.onCameraSwitchDone( 164 switchEventsHandler.onCameraSwitchDone(
165 info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_FR ONT); 165 info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_FR ONT);
166 } 166 }
167 } 167 }
168 }); 168 });
169 if (!didPost && switchEventsHandler != null) { 169 if (!didPost && switchEventsHandler != null) {
170 switchEventsHandler.onCameraSwitchError("Camera is stopped."); 170 switchEventsHandler.onCameraSwitchError("Camera is stopped.");
171 } 171 }
172 } 172 }
173 173
174 // Requests a new output format from the video capturer. Captured frames
175 // by the camera will be scaled/or dropped by the video capturer.
176 // It does not matter if width and height are flipped. I.E, |width| = 640, |he ight| = 480 produce
177 // the same result as |width| = 480, |height| = 640.
178 // TODO(magjed/perkj): Document what this function does. Change name?
179 @Override
180 public void onOutputFormatRequest(final int width, final int height, final int framerate) {
181 maybePostOnCameraThread(new Runnable() {
182 @Override public void run() {
183 onOutputFormatRequestOnCameraThread(width, height, framerate);
184 }
185 });
186 }
187
188 // Reconfigure the camera to capture in a new format. This should only be call ed while the camera 174 // Reconfigure the camera to capture in a new format. This should only be call ed while the camera
189 // is running. 175 // is running.
190 @Override 176 @Override
191 public void changeCaptureFormat(final int width, final int height, final int f ramerate) { 177 public void changeCaptureFormat(final int width, final int height, final int f ramerate) {
192 maybePostOnCameraThread(new Runnable() { 178 maybePostOnCameraThread(new Runnable() {
193 @Override public void run() { 179 @Override public void run() {
194 startPreviewOnCameraThread(width, height, framerate); 180 startPreviewOnCameraThread(width, height, framerate);
195 } 181 }
196 }); 182 });
197 } 183 }
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 } 525 }
540 Logging.d(TAG, "switchCameraOnCameraThread"); 526 Logging.d(TAG, "switchCameraOnCameraThread");
541 stopCaptureOnCameraThread(false /* stopHandler */); 527 stopCaptureOnCameraThread(false /* stopHandler */);
542 synchronized (cameraIdLock) { 528 synchronized (cameraIdLock) {
543 id = (id + 1) % android.hardware.Camera.getNumberOfCameras(); 529 id = (id + 1) % android.hardware.Camera.getNumberOfCameras();
544 } 530 }
545 startCaptureOnCameraThread(requestedWidth, requestedHeight, requestedFramera te); 531 startCaptureOnCameraThread(requestedWidth, requestedHeight, requestedFramera te);
546 Logging.d(TAG, "switchCameraOnCameraThread done"); 532 Logging.d(TAG, "switchCameraOnCameraThread done");
547 } 533 }
548 534
549 private void onOutputFormatRequestOnCameraThread(int width, int height, int fr amerate) {
550 checkIsOnCameraThread();
551 Logging.d(TAG, "onOutputFormatRequestOnCameraThread: " + width + "x" + heigh t +
552 "@" + framerate);
553 frameObserver.onOutputFormatRequest(width, height, framerate);
554 }
555
556 private int getDeviceOrientation() { 535 private int getDeviceOrientation() {
557 int orientation = 0; 536 int orientation = 0;
558 537
559 WindowManager wm = (WindowManager) applicationContext.getSystemService( 538 WindowManager wm = (WindowManager) applicationContext.getSystemService(
560 Context.WINDOW_SERVICE); 539 Context.WINDOW_SERVICE);
561 switch(wm.getDefaultDisplay().getRotation()) { 540 switch(wm.getDefaultDisplay().getRotation()) {
562 case Surface.ROTATION_90: 541 case Surface.ROTATION_90:
563 orientation = 90; 542 orientation = 90;
564 break; 543 break;
565 case Surface.ROTATION_180: 544 case Surface.ROTATION_180:
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 cameraStatistics.addFrame(); 617 cameraStatistics.addFrame();
639 frameObserver.onTextureFrameCaptured(captureFormat.width, captureFormat.heig ht, oesTextureId, 618 frameObserver.onTextureFrameCaptured(captureFormat.width, captureFormat.heig ht, oesTextureId,
640 transformMatrix, rotation, timestampNs); 619 transformMatrix, rotation, timestampNs);
641 } 620 }
642 621
643 @Override 622 @Override
644 public boolean isScreencast() { 623 public boolean isScreencast() {
645 return false; 624 return false;
646 } 625 }
647 } 626 }
OLDNEW
« no previous file with comments | « webrtc/api/android/java/src/org/webrtc/VideoCapturer.java ('k') | webrtc/api/android/jni/androidvideotracksource_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698