Có thể nói rằng sau khi các trang mạng xã hội có hoạt động livestream được rất nhiều người sử dung. Nó dường như đóng một vai trò đặc biệt...
External USB Cameras | Android Open Source Project
With tư vấn for webcams, devices can be used in lightweight use cases such as video chatting and photo kiosks. This feature doesn’t replace typical internal camera HALs on Android phones and isn’t designed to tư vấn performance-intensive, complex tasks involving high-resolution and high-speed streaming, AR, and manual ISP / sensor / lens control .
The USB camera HAL process is part of the external camera provider that listens to USB device availability and enumerates external camera devices accordingly. The process has permissions and an SE policy similar to the built-in camera HAL process. Third-party webcam apps that communicate directly with USB devices require the same camera permissions to access UVC devices as with any regular camera app .
Examples and sources
For more information on how to implement USB cameras, see an external camera
provider reference implementation at
ExternalCameraProviderImpl_2_4
.
The external camera device and session implementations are included in
ExternalCameraDevice
and
ExternalCameraDeviceSession
.
Starting in API level 28, the Java client API includes the
EXTERNAL
hardware level.
Bạn đang đọc: External USB Cameras | Android Open Source Project
Implementation
The implementation must support the
android.hardware.usb.host
system feature.
Kernel support for UVC devices must also be enabled. You can enable this by
adding the following to the respective kernel deconfig
files.
+CONFIG_USB_VIDEO_CLASS=y
+CONFIG_MEDIA_USB_SUPPORT=y
Note:Make sure you also have this patch for UVC video .
To enable the external camera provider in the respective device build, which adds the necessary SELinux permissions, external camera configuration, and external camera provider dependency, complete the following steps :
-
Add the external camera config file and external camera library to
device.mk
.+PRODUCT_PACKAGES += [email protected] +PRODUCT_PACKAGES += [email protected] +PRODUCT_COPY_FILES += \ +device/manufacturerX/productY/external_camera_config.xml:$(TARGET_COPY_OUT_VENDOR)/etc/external_camera_config.xml
- Add the external camera provider name to the device Treble HAL manifest .
android.hardware.camera.provider passthrough 2.4 ICameraProvider legacy/0 +external/0 -
(Optional) If the device runs in Treble passthrough mode, update
sepolicy
socameraserver
can access the UVC camera.+# for external camera +allow cameraserver device:dir r_dir_perms; +allow cameraserver video_device:dir r_dir_perms; +allow cameraserver video_device:chr_file rw_file_perms;
Here’s an example of external_camera_config.xml
(copyright lines omitted).
0 1
Customization
You can enhance the Android camera either through general customization options or device-specific optimizations .
General customizations
You can customize the external camera provider by modifying the
external_camera_config.xml
file. Specifically, clients can customize the
following parameters:
- Excluding video nodes of internal cameras
- Supported image size and frame rate upper bound
- Number of inflight buffers (jank vs memory tradeoff)
In addition to these parameters, you can add your own parameters or develop your own configurations .
Device-specific optimizations
You can also improve performance by adding device-specific optimizations .
Buffer copy/scaling and JPEG decode/encode
Generic implementations use CPU ( libyuv / libjpeg ) but you can replace this with device-specific optimizations .
HAL output format
Generic implementations use the following output formats:
YUV_420_888
for videoIMPLEMENTATION_DEFINED
buffersYUV12
for all otherIMPLEMENTATION_DEFINED
buffers
To improve performance, you can replace output formats with device-specific efficient formats. You can also tư vấn additional formats in a customized implementation
Validation
Devices with external camera tư vấn must pass camera CTS. The external USB webcam must remain plugged in the specific device during the entire test run, otherwise some test cases will fail .
Note:media_profiles
entries aren’t available for external USB webcams, so
entries aren’t available for external USB webcams, so camcorder profiles are absent .
Source: https://vh2.com.vn
Category : Nghe Nhìn