webrtc_m130/sdk/android/api/org/webrtc/CameraVideoCapturer.java

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

173 lines
6.4 KiB
Java
Raw Normal View History

Reland of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1994013004/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1994893002/ ) > > Reason for revert: > Still breaks downstream import. > > Original issue's description: > > Reland of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1979583002/ ) > > > > Reason for revert: > > Downstream code has been updated. > > > > Original issue's description: > > > Revert of Android: Make base interface for camera1 and camera2 (patchset #3 id:80001 of https://codereview.webrtc.org/1895483002/ ) > > > > > > Reason for revert: > > > Breaks downstream import. > > > > > > Original issue's description: > > > > Android: Make base interface for camera1 and camera2 > > > > > > > > This CL adds a new interface CameraVideoCapturer that extends VideoCapturer with a switchCamera() function. It also moves moves CameraEventsHandler, CameraStatistics, and CameraSwitchHandler from VideoCapturerAndroid to this new interface. The purpose is to prepare for a camera2 implementation that will use the same interfaces and helper class. > > > > > > > > BUG=webrtc:5519 > > > > > > > > Committed: https://crrev.com/6bdacaddfb18edef1f0cdd778209f6b05a8f9210 > > > > Cr-Commit-Position: refs/heads/master@{#12723} > > > > > > TBR=perkj@webrtc.org > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > NOPRESUBMIT=true > > > NOTREECHECKS=true > > > NOTRY=true > > > BUG=webrtc:5519 > > > > > > Committed: https://crrev.com/181b5ffdf036427d92929667d9d43bbcff560435 > > > Cr-Commit-Position: refs/heads/master@{#12727} > > > > TBR=perkj@webrtc.org > > # Not skipping CQ checks because original CL landed more than 1 days ago. > > BUG=webrtc:5519 > > > > Committed: https://crrev.com/d269b023bfe1c321798fe9c8dbd631a562914fe1 > > Cr-Commit-Position: refs/heads/master@{#12807} > > TBR=perkj@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:5519 > > Committed: https://crrev.com/bd76607abb712f98c01709f240f147e4bd49df6d > Cr-Commit-Position: refs/heads/master@{#12809} TBR=perkj@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:5519 Review URL: https://codereview.webrtc.org/1999053002 . Cr-Commit-Position: refs/heads/master@{#12830}
2016-05-20 17:22:12 +02:00
/*
* Copyright 2016 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
package org.webrtc;
Reland of Support adding and removing MediaRecorder to camera 2 session. (patchset #1 id:1 of https://codereview.webrtc.org/2844233002/ ) Reason for revert: Revert "Revert of Support adding and removing MediaRecorder to camera 2 session. (patchset #5 id:80001 of https://codereview.webrtc.org/2833773003/ )" Will fix external bots by cherry picking this CL and updating external functions which depend on CameraVideoCapturer interface Original issue's description: > Revert of Support adding and removing MediaRecorder to camera 2 session. (patchset #5 id:80001 of https://codereview.webrtc.org/2833773003/ ) > > Reason for revert: > Breaks external bot > > Original issue's description: > > Support adding and removing MediaRecorder to camera 2 session. > > > > Camera 1 API is not supported. > > > > BUG=b/36684011 > > > > Review-Url: https://codereview.webrtc.org/2833773003 > > Cr-Commit-Position: refs/heads/master@{#17901} > > Committed: https://chromium.googlesource.com/external/webrtc/+/2fc04769faec0031a202963eaeb602420a082c07 > > TBR=sakal@webrtc.org,glaznev@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=b/36684011 > > Review-Url: https://codereview.webrtc.org/2844233002 > Cr-Commit-Position: refs/heads/master@{#17905} > Committed: https://chromium.googlesource.com/external/webrtc/+/6702739862e292f3556a9e63c71367f49c3895b4 TBR=sakal@webrtc.org,magjed@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=b/36684011 Review-Url: https://codereview.webrtc.org/2844393002 Cr-Commit-Position: refs/heads/master@{#17915}
2017-04-27 13:38:29 -07:00
import android.media.MediaRecorder;
Reland of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1994013004/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1994893002/ ) > > Reason for revert: > Still breaks downstream import. > > Original issue's description: > > Reland of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1979583002/ ) > > > > Reason for revert: > > Downstream code has been updated. > > > > Original issue's description: > > > Revert of Android: Make base interface for camera1 and camera2 (patchset #3 id:80001 of https://codereview.webrtc.org/1895483002/ ) > > > > > > Reason for revert: > > > Breaks downstream import. > > > > > > Original issue's description: > > > > Android: Make base interface for camera1 and camera2 > > > > > > > > This CL adds a new interface CameraVideoCapturer that extends VideoCapturer with a switchCamera() function. It also moves moves CameraEventsHandler, CameraStatistics, and CameraSwitchHandler from VideoCapturerAndroid to this new interface. The purpose is to prepare for a camera2 implementation that will use the same interfaces and helper class. > > > > > > > > BUG=webrtc:5519 > > > > > > > > Committed: https://crrev.com/6bdacaddfb18edef1f0cdd778209f6b05a8f9210 > > > > Cr-Commit-Position: refs/heads/master@{#12723} > > > > > > TBR=perkj@webrtc.org > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > NOPRESUBMIT=true > > > NOTREECHECKS=true > > > NOTRY=true > > > BUG=webrtc:5519 > > > > > > Committed: https://crrev.com/181b5ffdf036427d92929667d9d43bbcff560435 > > > Cr-Commit-Position: refs/heads/master@{#12727} > > > > TBR=perkj@webrtc.org > > # Not skipping CQ checks because original CL landed more than 1 days ago. > > BUG=webrtc:5519 > > > > Committed: https://crrev.com/d269b023bfe1c321798fe9c8dbd631a562914fe1 > > Cr-Commit-Position: refs/heads/master@{#12807} > > TBR=perkj@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:5519 > > Committed: https://crrev.com/bd76607abb712f98c01709f240f147e4bd49df6d > Cr-Commit-Position: refs/heads/master@{#12809} TBR=perkj@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:5519 Review URL: https://codereview.webrtc.org/1999053002 . Cr-Commit-Position: refs/heads/master@{#12830}
2016-05-20 17:22:12 +02:00
/**
* Base interface for camera1 and camera2 implementations. Extends VideoCapturer with a
* switchCamera() function. Also provides subinterfaces for handling camera events, and a helper
* class for detecting camera freezes.
*/
public interface CameraVideoCapturer extends VideoCapturer {
/**
* Camera events handler - can be used to be notifed about camera events. The callbacks are
* executed from an arbitrary thread.
*/
public interface CameraEventsHandler {
// Camera error handler - invoked when camera can not be opened
// or any camera exception happens on camera thread.
void onCameraError(String errorDescription);
// Called when camera is disconnected.
void onCameraDisconnected();
Reland of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1994013004/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1994893002/ ) > > Reason for revert: > Still breaks downstream import. > > Original issue's description: > > Reland of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1979583002/ ) > > > > Reason for revert: > > Downstream code has been updated. > > > > Original issue's description: > > > Revert of Android: Make base interface for camera1 and camera2 (patchset #3 id:80001 of https://codereview.webrtc.org/1895483002/ ) > > > > > > Reason for revert: > > > Breaks downstream import. > > > > > > Original issue's description: > > > > Android: Make base interface for camera1 and camera2 > > > > > > > > This CL adds a new interface CameraVideoCapturer that extends VideoCapturer with a switchCamera() function. It also moves moves CameraEventsHandler, CameraStatistics, and CameraSwitchHandler from VideoCapturerAndroid to this new interface. The purpose is to prepare for a camera2 implementation that will use the same interfaces and helper class. > > > > > > > > BUG=webrtc:5519 > > > > > > > > Committed: https://crrev.com/6bdacaddfb18edef1f0cdd778209f6b05a8f9210 > > > > Cr-Commit-Position: refs/heads/master@{#12723} > > > > > > TBR=perkj@webrtc.org > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > NOPRESUBMIT=true > > > NOTREECHECKS=true > > > NOTRY=true > > > BUG=webrtc:5519 > > > > > > Committed: https://crrev.com/181b5ffdf036427d92929667d9d43bbcff560435 > > > Cr-Commit-Position: refs/heads/master@{#12727} > > > > TBR=perkj@webrtc.org > > # Not skipping CQ checks because original CL landed more than 1 days ago. > > BUG=webrtc:5519 > > > > Committed: https://crrev.com/d269b023bfe1c321798fe9c8dbd631a562914fe1 > > Cr-Commit-Position: refs/heads/master@{#12807} > > TBR=perkj@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:5519 > > Committed: https://crrev.com/bd76607abb712f98c01709f240f147e4bd49df6d > Cr-Commit-Position: refs/heads/master@{#12809} TBR=perkj@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:5519 Review URL: https://codereview.webrtc.org/1999053002 . Cr-Commit-Position: refs/heads/master@{#12830}
2016-05-20 17:22:12 +02:00
// Invoked when camera stops receiving frames.
void onCameraFreezed(String errorDescription);
// Callback invoked when camera is opening.
void onCameraOpening(String cameraName);
Reland of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1994013004/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1994893002/ ) > > Reason for revert: > Still breaks downstream import. > > Original issue's description: > > Reland of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1979583002/ ) > > > > Reason for revert: > > Downstream code has been updated. > > > > Original issue's description: > > > Revert of Android: Make base interface for camera1 and camera2 (patchset #3 id:80001 of https://codereview.webrtc.org/1895483002/ ) > > > > > > Reason for revert: > > > Breaks downstream import. > > > > > > Original issue's description: > > > > Android: Make base interface for camera1 and camera2 > > > > > > > > This CL adds a new interface CameraVideoCapturer that extends VideoCapturer with a switchCamera() function. It also moves moves CameraEventsHandler, CameraStatistics, and CameraSwitchHandler from VideoCapturerAndroid to this new interface. The purpose is to prepare for a camera2 implementation that will use the same interfaces and helper class. > > > > > > > > BUG=webrtc:5519 > > > > > > > > Committed: https://crrev.com/6bdacaddfb18edef1f0cdd778209f6b05a8f9210 > > > > Cr-Commit-Position: refs/heads/master@{#12723} > > > > > > TBR=perkj@webrtc.org > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > NOPRESUBMIT=true > > > NOTREECHECKS=true > > > NOTRY=true > > > BUG=webrtc:5519 > > > > > > Committed: https://crrev.com/181b5ffdf036427d92929667d9d43bbcff560435 > > > Cr-Commit-Position: refs/heads/master@{#12727} > > > > TBR=perkj@webrtc.org > > # Not skipping CQ checks because original CL landed more than 1 days ago. > > BUG=webrtc:5519 > > > > Committed: https://crrev.com/d269b023bfe1c321798fe9c8dbd631a562914fe1 > > Cr-Commit-Position: refs/heads/master@{#12807} > > TBR=perkj@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:5519 > > Committed: https://crrev.com/bd76607abb712f98c01709f240f147e4bd49df6d > Cr-Commit-Position: refs/heads/master@{#12809} TBR=perkj@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:5519 Review URL: https://codereview.webrtc.org/1999053002 . Cr-Commit-Position: refs/heads/master@{#12830}
2016-05-20 17:22:12 +02:00
// Callback invoked when first camera frame is available after camera is started.
void onFirstFrameAvailable();
// Callback invoked when camera is closed.
void onCameraClosed();
}
/**
* Camera switch handler - one of these functions are invoked with the result of switchCamera().
* The callback may be called on an arbitrary thread.
*/
public interface CameraSwitchHandler {
// Invoked on success. `isFrontCamera` is true if the new camera is front facing.
Reland of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1994013004/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1994893002/ ) > > Reason for revert: > Still breaks downstream import. > > Original issue's description: > > Reland of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1979583002/ ) > > > > Reason for revert: > > Downstream code has been updated. > > > > Original issue's description: > > > Revert of Android: Make base interface for camera1 and camera2 (patchset #3 id:80001 of https://codereview.webrtc.org/1895483002/ ) > > > > > > Reason for revert: > > > Breaks downstream import. > > > > > > Original issue's description: > > > > Android: Make base interface for camera1 and camera2 > > > > > > > > This CL adds a new interface CameraVideoCapturer that extends VideoCapturer with a switchCamera() function. It also moves moves CameraEventsHandler, CameraStatistics, and CameraSwitchHandler from VideoCapturerAndroid to this new interface. The purpose is to prepare for a camera2 implementation that will use the same interfaces and helper class. > > > > > > > > BUG=webrtc:5519 > > > > > > > > Committed: https://crrev.com/6bdacaddfb18edef1f0cdd778209f6b05a8f9210 > > > > Cr-Commit-Position: refs/heads/master@{#12723} > > > > > > TBR=perkj@webrtc.org > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > NOPRESUBMIT=true > > > NOTREECHECKS=true > > > NOTRY=true > > > BUG=webrtc:5519 > > > > > > Committed: https://crrev.com/181b5ffdf036427d92929667d9d43bbcff560435 > > > Cr-Commit-Position: refs/heads/master@{#12727} > > > > TBR=perkj@webrtc.org > > # Not skipping CQ checks because original CL landed more than 1 days ago. > > BUG=webrtc:5519 > > > > Committed: https://crrev.com/d269b023bfe1c321798fe9c8dbd631a562914fe1 > > Cr-Commit-Position: refs/heads/master@{#12807} > > TBR=perkj@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:5519 > > Committed: https://crrev.com/bd76607abb712f98c01709f240f147e4bd49df6d > Cr-Commit-Position: refs/heads/master@{#12809} TBR=perkj@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:5519 Review URL: https://codereview.webrtc.org/1999053002 . Cr-Commit-Position: refs/heads/master@{#12830}
2016-05-20 17:22:12 +02:00
void onCameraSwitchDone(boolean isFrontCamera);
// Invoked on failure, e.g. camera is stopped or only one camera available.
void onCameraSwitchError(String errorDescription);
}
/**
* Switch camera to the next valid camera id. This can only be called while the camera is running.
* This function can be called from any thread.
*/
void switchCamera(CameraSwitchHandler switchEventsHandler);
/**
* Switch camera to the specified camera id. This can only be called while the camera is running.
* This function can be called from any thread.
*/
void switchCamera(CameraSwitchHandler switchEventsHandler, String cameraName);
Reland of Support adding and removing MediaRecorder to camera 2 session. (patchset #1 id:1 of https://codereview.webrtc.org/2844233002/ ) Reason for revert: Revert "Revert of Support adding and removing MediaRecorder to camera 2 session. (patchset #5 id:80001 of https://codereview.webrtc.org/2833773003/ )" Will fix external bots by cherry picking this CL and updating external functions which depend on CameraVideoCapturer interface Original issue's description: > Revert of Support adding and removing MediaRecorder to camera 2 session. (patchset #5 id:80001 of https://codereview.webrtc.org/2833773003/ ) > > Reason for revert: > Breaks external bot > > Original issue's description: > > Support adding and removing MediaRecorder to camera 2 session. > > > > Camera 1 API is not supported. > > > > BUG=b/36684011 > > > > Review-Url: https://codereview.webrtc.org/2833773003 > > Cr-Commit-Position: refs/heads/master@{#17901} > > Committed: https://chromium.googlesource.com/external/webrtc/+/2fc04769faec0031a202963eaeb602420a082c07 > > TBR=sakal@webrtc.org,glaznev@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=b/36684011 > > Review-Url: https://codereview.webrtc.org/2844233002 > Cr-Commit-Position: refs/heads/master@{#17905} > Committed: https://chromium.googlesource.com/external/webrtc/+/6702739862e292f3556a9e63c71367f49c3895b4 TBR=sakal@webrtc.org,magjed@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=b/36684011 Review-Url: https://codereview.webrtc.org/2844393002 Cr-Commit-Position: refs/heads/master@{#17915}
2017-04-27 13:38:29 -07:00
/**
* MediaRecorder add/remove handler - one of these functions are invoked with the result of
* addMediaRecorderToCamera() or removeMediaRecorderFromCamera calls.
* The callback may be called on an arbitrary thread.
*/
@Deprecated
Reland of Support adding and removing MediaRecorder to camera 2 session. (patchset #1 id:1 of https://codereview.webrtc.org/2844233002/ ) Reason for revert: Revert "Revert of Support adding and removing MediaRecorder to camera 2 session. (patchset #5 id:80001 of https://codereview.webrtc.org/2833773003/ )" Will fix external bots by cherry picking this CL and updating external functions which depend on CameraVideoCapturer interface Original issue's description: > Revert of Support adding and removing MediaRecorder to camera 2 session. (patchset #5 id:80001 of https://codereview.webrtc.org/2833773003/ ) > > Reason for revert: > Breaks external bot > > Original issue's description: > > Support adding and removing MediaRecorder to camera 2 session. > > > > Camera 1 API is not supported. > > > > BUG=b/36684011 > > > > Review-Url: https://codereview.webrtc.org/2833773003 > > Cr-Commit-Position: refs/heads/master@{#17901} > > Committed: https://chromium.googlesource.com/external/webrtc/+/2fc04769faec0031a202963eaeb602420a082c07 > > TBR=sakal@webrtc.org,glaznev@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=b/36684011 > > Review-Url: https://codereview.webrtc.org/2844233002 > Cr-Commit-Position: refs/heads/master@{#17905} > Committed: https://chromium.googlesource.com/external/webrtc/+/6702739862e292f3556a9e63c71367f49c3895b4 TBR=sakal@webrtc.org,magjed@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=b/36684011 Review-Url: https://codereview.webrtc.org/2844393002 Cr-Commit-Position: refs/heads/master@{#17915}
2017-04-27 13:38:29 -07:00
public interface MediaRecorderHandler {
// Invoked on success.
void onMediaRecorderSuccess();
// Invoked on failure, e.g. camera is stopped or any exception happens.
void onMediaRecorderError(String errorDescription);
}
/**
* Add MediaRecorder to camera pipeline. This can only be called while the camera is running.
* Once MediaRecorder is added to camera pipeline camera switch is not allowed.
* This function can be called from any thread.
*/
@Deprecated
default void addMediaRecorderToCamera(
MediaRecorder mediaRecorder, MediaRecorderHandler resultHandler) {
throw new UnsupportedOperationException("Deprecated and not implemented.");
}
Reland of Support adding and removing MediaRecorder to camera 2 session. (patchset #1 id:1 of https://codereview.webrtc.org/2844233002/ ) Reason for revert: Revert "Revert of Support adding and removing MediaRecorder to camera 2 session. (patchset #5 id:80001 of https://codereview.webrtc.org/2833773003/ )" Will fix external bots by cherry picking this CL and updating external functions which depend on CameraVideoCapturer interface Original issue's description: > Revert of Support adding and removing MediaRecorder to camera 2 session. (patchset #5 id:80001 of https://codereview.webrtc.org/2833773003/ ) > > Reason for revert: > Breaks external bot > > Original issue's description: > > Support adding and removing MediaRecorder to camera 2 session. > > > > Camera 1 API is not supported. > > > > BUG=b/36684011 > > > > Review-Url: https://codereview.webrtc.org/2833773003 > > Cr-Commit-Position: refs/heads/master@{#17901} > > Committed: https://chromium.googlesource.com/external/webrtc/+/2fc04769faec0031a202963eaeb602420a082c07 > > TBR=sakal@webrtc.org,glaznev@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=b/36684011 > > Review-Url: https://codereview.webrtc.org/2844233002 > Cr-Commit-Position: refs/heads/master@{#17905} > Committed: https://chromium.googlesource.com/external/webrtc/+/6702739862e292f3556a9e63c71367f49c3895b4 TBR=sakal@webrtc.org,magjed@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=b/36684011 Review-Url: https://codereview.webrtc.org/2844393002 Cr-Commit-Position: refs/heads/master@{#17915}
2017-04-27 13:38:29 -07:00
/**
* Remove MediaRecorder from camera pipeline. This can only be called while the camera is running.
* This function can be called from any thread.
*/
@Deprecated
default void removeMediaRecorderFromCamera(MediaRecorderHandler resultHandler) {
throw new UnsupportedOperationException("Deprecated and not implemented.");
}
Reland of Support adding and removing MediaRecorder to camera 2 session. (patchset #1 id:1 of https://codereview.webrtc.org/2844233002/ ) Reason for revert: Revert "Revert of Support adding and removing MediaRecorder to camera 2 session. (patchset #5 id:80001 of https://codereview.webrtc.org/2833773003/ )" Will fix external bots by cherry picking this CL and updating external functions which depend on CameraVideoCapturer interface Original issue's description: > Revert of Support adding and removing MediaRecorder to camera 2 session. (patchset #5 id:80001 of https://codereview.webrtc.org/2833773003/ ) > > Reason for revert: > Breaks external bot > > Original issue's description: > > Support adding and removing MediaRecorder to camera 2 session. > > > > Camera 1 API is not supported. > > > > BUG=b/36684011 > > > > Review-Url: https://codereview.webrtc.org/2833773003 > > Cr-Commit-Position: refs/heads/master@{#17901} > > Committed: https://chromium.googlesource.com/external/webrtc/+/2fc04769faec0031a202963eaeb602420a082c07 > > TBR=sakal@webrtc.org,glaznev@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=b/36684011 > > Review-Url: https://codereview.webrtc.org/2844233002 > Cr-Commit-Position: refs/heads/master@{#17905} > Committed: https://chromium.googlesource.com/external/webrtc/+/6702739862e292f3556a9e63c71367f49c3895b4 TBR=sakal@webrtc.org,magjed@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=b/36684011 Review-Url: https://codereview.webrtc.org/2844393002 Cr-Commit-Position: refs/heads/master@{#17915}
2017-04-27 13:38:29 -07:00
/**
* Helper class to log framerate and detect if the camera freezes. It will run periodic callbacks
* on the SurfaceTextureHelper thread passed in the ctor, and should only be operated from that
* thread.
*/
public static class CameraStatistics {
private final static String TAG = "CameraStatistics";
private final static int CAMERA_OBSERVER_PERIOD_MS = 2000;
private final static int CAMERA_FREEZE_REPORT_TIMOUT_MS = 4000;
private final SurfaceTextureHelper surfaceTextureHelper;
private final CameraEventsHandler eventsHandler;
private int frameCount;
private int freezePeriodCount;
// Camera observer - monitors camera framerate. Observer is executed on camera thread.
private final Runnable cameraObserver = new Runnable() {
@Override
public void run() {
final int cameraFps = Math.round(frameCount * 1000.0f / CAMERA_OBSERVER_PERIOD_MS);
Logging.d(TAG, "Camera fps: " + cameraFps + ".");
if (frameCount == 0) {
++freezePeriodCount;
if (CAMERA_OBSERVER_PERIOD_MS * freezePeriodCount >= CAMERA_FREEZE_REPORT_TIMOUT_MS
&& eventsHandler != null) {
Logging.e(TAG, "Camera freezed.");
if (surfaceTextureHelper.isTextureInUse()) {
// This can only happen if we are capturing to textures.
eventsHandler.onCameraFreezed("Camera failure. Client must return video buffers.");
} else {
eventsHandler.onCameraFreezed("Camera failure.");
}
return;
}
} else {
freezePeriodCount = 0;
}
frameCount = 0;
surfaceTextureHelper.getHandler().postDelayed(this, CAMERA_OBSERVER_PERIOD_MS);
}
};
public CameraStatistics(
SurfaceTextureHelper surfaceTextureHelper, CameraEventsHandler eventsHandler) {
if (surfaceTextureHelper == null) {
throw new IllegalArgumentException("SurfaceTextureHelper is null");
}
this.surfaceTextureHelper = surfaceTextureHelper;
this.eventsHandler = eventsHandler;
this.frameCount = 0;
this.freezePeriodCount = 0;
surfaceTextureHelper.getHandler().postDelayed(cameraObserver, CAMERA_OBSERVER_PERIOD_MS);
}
private void checkThread() {
if (Thread.currentThread() != surfaceTextureHelper.getHandler().getLooper().getThread()) {
throw new IllegalStateException("Wrong thread");
}
}
public void addFrame() {
checkThread();
++frameCount;
}
public void release() {
surfaceTextureHelper.getHandler().removeCallbacks(cameraObserver);
}
}
Reland of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1994013004/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1994893002/ ) > > Reason for revert: > Still breaks downstream import. > > Original issue's description: > > Reland of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1979583002/ ) > > > > Reason for revert: > > Downstream code has been updated. > > > > Original issue's description: > > > Revert of Android: Make base interface for camera1 and camera2 (patchset #3 id:80001 of https://codereview.webrtc.org/1895483002/ ) > > > > > > Reason for revert: > > > Breaks downstream import. > > > > > > Original issue's description: > > > > Android: Make base interface for camera1 and camera2 > > > > > > > > This CL adds a new interface CameraVideoCapturer that extends VideoCapturer with a switchCamera() function. It also moves moves CameraEventsHandler, CameraStatistics, and CameraSwitchHandler from VideoCapturerAndroid to this new interface. The purpose is to prepare for a camera2 implementation that will use the same interfaces and helper class. > > > > > > > > BUG=webrtc:5519 > > > > > > > > Committed: https://crrev.com/6bdacaddfb18edef1f0cdd778209f6b05a8f9210 > > > > Cr-Commit-Position: refs/heads/master@{#12723} > > > > > > TBR=perkj@webrtc.org > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > NOPRESUBMIT=true > > > NOTREECHECKS=true > > > NOTRY=true > > > BUG=webrtc:5519 > > > > > > Committed: https://crrev.com/181b5ffdf036427d92929667d9d43bbcff560435 > > > Cr-Commit-Position: refs/heads/master@{#12727} > > > > TBR=perkj@webrtc.org > > # Not skipping CQ checks because original CL landed more than 1 days ago. > > BUG=webrtc:5519 > > > > Committed: https://crrev.com/d269b023bfe1c321798fe9c8dbd631a562914fe1 > > Cr-Commit-Position: refs/heads/master@{#12807} > > TBR=perkj@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:5519 > > Committed: https://crrev.com/bd76607abb712f98c01709f240f147e4bd49df6d > Cr-Commit-Position: refs/heads/master@{#12809} TBR=perkj@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:5519 Review URL: https://codereview.webrtc.org/1999053002 . Cr-Commit-Position: refs/heads/master@{#12830}
2016-05-20 17:22:12 +02:00
}