Skip to content
This repository has been archived by the owner on Oct 26, 2019. It is now read-only.

Camera2 support and partial Usb Camera Support #54

Merged
merged 35 commits into from
Oct 27, 2018
Merged

Conversation

SkyeOfBreeze
Copy link
Owner

@SkyeOfBreeze SkyeOfBreeze commented Oct 6, 2018

Support newer camera api that was introduced in api21 and keep old method for devices under api21.

Using camera2 will allow for USB webcam support for the raspberry pi and other android microcontrollers

  • Camera abstraction layer

  • Camera1 Working still

  • Camera2 fully functional

  • USB Camera Support (Have to build from source currently)

@SkyeOfBreeze
Copy link
Owner Author

This would be part of:

@SkyeOfBreeze
Copy link
Owner Author

App currently tested to work as normal, since there is no camera2 yet

@SkyeOfBreeze
Copy link
Owner Author

camera2 implementation started. Currently does not close properly and size params are wrong. Not hooked up to ffmpeg yet

@SkyeOfBreeze
Copy link
Owner Author

Does not work with Dragonboard 410C, so probably will not work on stock android

@SkyeOfBreeze
Copy link
Owner Author

SkyeOfBreeze commented Oct 7, 2018

Works on Android Things on Raspberry Pi 3B. The camera has to be plugged in when it boots. Does some weird things with displaying it though, and currently is giving a temp warning

@SkyeOfBreeze
Copy link
Owner Author

Camera preview can be removed, which should save some battery life and processing power.

@SkyeOfBreeze
Copy link
Owner Author

Plan is to configure Android things not to show a camera preview by default

@SkyeOfBreeze
Copy link
Owner Author

Going to make sure no memory leaks are introduced before merging

@SkyeOfBreeze
Copy link
Owner Author

External webcam library works, just running into issues where the dragonboard looks like it cannot keep up

@SkyeOfBreeze
Copy link
Owner Author

Screen can be turned off with camera2. That might save some battery power, especially on LCD displays

@SkyeOfBreeze
Copy link
Owner Author

This should fix Travis?
https://stackoverflow.com/questions/25775846/android-mk-no-rule-to-make-target-c-needed-by-o-stop

@SkyeOfBreeze SkyeOfBreeze changed the title Camera2 support and Usb Camera support Camera2 support and partial Usb Camera Support Oct 27, 2018
@SkyeOfBreeze
Copy link
Owner Author

SkyeOfBreeze commented Oct 27, 2018

Just as note, Camera works as good as it did before. Phone will not get as hot and will use less battery if on API 21 or above. Some TODOs that should be done would be a fallback option for the older camera API, and make the flow faster and less CPU intensive.

This does not fix FFMPEG thread locks if it is taking too long to process and upload a frame

Camera Changes:
4.4 Kitkat: No change should be noticeable. Screen still has to be on, but that limitation may not be needed anymore
5.0 Lollipop: Screen can now be turned off. Preview not shown anymore
6.0 Marshmallow: Screen can now be turned off, but battery optimization will need to be disabled for the app to avoid being killed by the system. App Still has to remain in the foreground to avoid being killed by the system

@SkyeOfBreeze SkyeOfBreeze merged commit 1443f47 into devel Oct 27, 2018
@SkyeOfBreeze SkyeOfBreeze deleted the camera2-support branch October 27, 2018 00:09
@SkyeOfBreeze SkyeOfBreeze mentioned this pull request Oct 27, 2018
2 tasks
@SkyeOfBreeze SkyeOfBreeze added this to the 0.4 milestone Nov 4, 2018
private final static String TAG = "WebcamManager";

//usb摄像头设备
public final static String VIDEO = "/dev/video1";
Copy link
Owner Author

@SkyeOfBreeze SkyeOfBreeze Nov 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this to your camera path

}
}
cameraId?.let{
if(useMic) {
core.audio = AudioComponent(context, cameraId!!)
}
holder?.let {
core.camera = CameraComponent(context, cameraId!!, holder!!)
if(false/*TODO StoreUtil or autodetect*/){
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this to true for external camera

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant