Azure-Samples / Azure-Samples/communication-services-android-quickstarts

[BUG] Camera not working on Android Automotive 12

Open
#63 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
11
Forks
22
PR merge metrics
No merged PRs in 30d

Description

Subject: Bug in Azure Communication Services Calling Library regarding the video calling functionality - Issue on Android Automotive 12

Description:

I have encountered an issue in the Azure communications Service library regarding the camera while working on Android Automotive OS. The problem seems to occur under specific conditions, and I believe it might be a bug.

Steps to Reproduce:

Opening the App using Android Automotive OS environment.

Attempt to use the Azure communications service library to access the front cameras.

- Initializing Video Call

1. Initializing a CommunicationIdentifier
2. Initializing and setting StartTeamsCallOptions
3. Starting call

``` Java
private void createTeamsIndividualCall() {
CommunicationIdentifier calleeId = new MicrosoftTeamsUserIdentifier(teamsCallAddress);
StartTeamsCallOptions options = new StartTeamsCallOptions();
setCallOptions(options);
try {
teamsManager.call = ((TeamsCallAgent) teamsManager.callAgent).startCall(
getApplicationContext(),
calleeId,
options);
finishCallSetup();
} catch (Throwable throwable) {
...
}
}

private void setCallOptions(CallOptions callOptions) {
if (teamsManager.getDeviceManager() != null) {
List cameras = teamsManager.getDeviceManager().getCameras();
if (!cameras.isEmpty()) {
teamsManager.camera = chooseCamera(cameras);
teamsManager.currentVideoStream = new LocalVideoStream(teamsManager.camera, getApplicationContext());

if (videoOn.get()) {
List videoStreams = new ArrayList<>();
videoStreams.add(teamsManager.currentVideoStream);
OutgoingVideoOptions outgoingVideoOptions = new OutgoingVideoOptions();
outgoingVideoOptions.setOutgoingVideoStreams(videoStreams);
callOptions.setOutgoingVideoOptions(outgoingVideoOptions);
}
...
}

callOptions.setOutgoingAudioOptions(new OutgoingAudioOptions().setMuted(!audioOn.get()));
}
```

- Video Renderer Initialization

1. Initialize VideoStreamRenderer
2. Create a view with ScalingMode.Fit
3. Add the VideoStreamRenderer to a container view

``` Java
try {
previewRenderer = new VideoStreamRenderer(stream, this);
preview = previewRenderer.createView(new CreateViewOptions(ScalingMode.FIT));
} catch (Exception exception) {
...
}
runOnUiThread(() -> {
try {
if (rendererView != null) {
FrameLayout container = findViewById(R.id.video_container_cv);
ViewGroup dataRendererViewParent = (ViewGroup) rendererView.getParent();
if (dataRendererViewParent != null) {
dataRendererViewParent.removeView(rendererView);
}
container.addView(rendererView);
}
} catch (Exception exception) {
...
}
});
```

Observe that the camera does not function as expected.

Expected Behavior:
The camera should work properly on Android Automotive 12, allowing access to test bench's cameras, Front/0 and Front/1.

Actual Behavior:
The render view does not display the camera feed neither is any video stream sent to other participants in the call.

Environment Details:

Product Name & Version: Azure Communication Services Calling 2.11.0

OS Version: Android Automotive 12

Camera Details: The test bench used has two camera, Front/0 and Front/1.

Logs retrieved during the test
```txt
2024-11-14 11:50:46.080 16602-16602 CAMERA com...a.meetingsforteams.guest.aaos I setCallOptions start
2024-11-14 11:50:46.080 16602-16602 CAMERA com...a.meetingsforteams.guest.aaos I com.azure.android.communication.calling.DeviceManager@6a8bb71
2024-11-14 11:50:46.081 16602-16602 CAMERA com...a.meetingsforteams.guest.aaos I cameras is not empty
2024-11-14 11:50:46.081 16602-16602 CAMERA com...a.meetingsforteams.guest.aaos I chooseCamera start
2024-11-14 11:50:46.081 16602-16602 CAMERA com...a.meetingsforteams.guest.aaos I chooseCamera foreach start
2024-11-14 11:50:46.081 16602-16602 CAMERA com...a.meetingsforteams.guest.aaos I /FRONT/0 /FRONT/0 USB_CAMERA FRONT
2024-11-14 11:50:46.081 16602-16602 CAMERA com...a.meetingsforteams.guest.aaos I chooseCamera foreach end
2024-11-14 11:50:46.081 16602-16602 CAMERA com...a.meetingsforteams.guest.aaos I chooseCamera foreach start
2024-11-14 11:50:46.082 16602-16602 CAMERA com...a.meetingsforteams.guest.aaos I /FRONT/1 /FRONT/1 USB_CAMERA FRONT
2024-11-14 11:50:46.082 16602-16602 CAMERA com...a.meetingsforteams.guest.aaos I chooseCamera foreach end
2024-11-14 11:50:46.082 16602-16602 CAMERA com...a.meetingsforteams.guest.aaos I chooseCamera end
2024-11-14 11:50:46.083 16602-16602 CAMERA com...a.meetingsforteams.guest.aaos I setCallOptions endj
```

Device Properties
```txt
[init.svc.cameraserver]: [running]
[init.svc.media]: [running]
[init.svc.media.swcodec]: [running]
[init.svc.mediadrm]: [running]
[init.svc.mediaextractor]: [running]
[init.svc.mediametrics]: [running]
[ro.vendor..camera.rt_priority]: [1]
[vendor.camera.aux.packagelist]: [org.codeaurora.snapcam]
[init.svc.drm]: [running]
[ro.vendor.sys.registry.gnss_receiver_present]: [0]
[persist.sys.locale]: [en-GB]
[persist.debug.dalvik.vm.core_platform_api_policy]: [just-warn]
[persist.vendor.bluetooth.nxp.otp.baudrate]: [115200]
[bluetooth.device.class_of_device]: [112,4,32]
[bluetooth.profile.a2dp.sink.enabled]: [true]
[bluetooth.profile.avrcp.controller.enabled]: [true]
[bluetooth.profile.gatt.enabled]: [true]
[bluetooth.profile.hfp.hf.enabled]: [true]
[bluetooth.profile.hid.host.enabled]: [true]
[bluetooth.profile.map.client.enabled]: [true]
[bluetooth.profile.pbap.client.enabled]: [true]
[bt.max.hfpclient.connections]: [1]
[cache_key.bluetooth.bluetooth_adapter_get_connection_state]: [345958409200877674]
[cache_key.bluetooth.bluetooth_adapter_get_profile_connection_state]: [345958409200877676]
[cache_key.bluetooth.bluetooth_adapter_get_state]: [345958409200877540]
[cache_key.bluetooth.bluetooth_adapter_is_offloaded_filtering_supported]: [345958409200877533]
[cache_key.bluetooth.bluetooth_device_get_bond_state]: [345958409200877535]
[cache_key.bluetooth.bluetooth_map_get_connection_state]: [345958409200877531]
[cache_key.bluetooth.bluetooth_sap_get_connection_state]: [345958409200877532]
[gsm.current.phone-type]: [1]
[gsm.network.type]: [Unknown]
[net.bt.name]: [Android]
[persist.data.df.dev_name]: [rmnet_usb0]
[persist.data.df.iwlan_mux]: [9]
[persist.rmnet.data.enable]: [true]
[persist.sys.usb.config]: [diag,adb]
[persist.sys.usb.qmmi.func]: [diag,adb]
[ril.subscription.types]: [NV,RUIM]
[rild.libpath]: [/vendor/lib64/libril-qc-hal-qmi.so]
[ro.bluetooth.ble_start_timeout_delay]: [8500]
[ro.radio.noril]: [true]
[ro.vendor.radio.noril]: [yes]
[service.adb.tcp.port]: [5555]
[sys.usb.config]: [diag,adb]
[sys.usb.controller]: [a600000.dwc3]
[sys.usb.state]: [diag,adb]
[wifi.active.interface]: [wlan0]
[wifi.interface]: [wlan0]
[wlan.driver.status]: [ok]
[aaudio.mmap_policy]: [1]
[audio.offload.buffer.size.kb]: [32]
[audio.offload.gapless.enabled]: [true]
[av.offload.enable]: [true]
[media.stagefright.enable-aac]: [true]
[media.stagefright.enable-fma2dp]: [true]
[media.stagefright.enable-http]: [true]
[media.stagefright.enable-player]: [true]
[media.stagefright.enable-qcp]: [true]
[media.stagefright.enable-scan]: [true]
[persist.audio.fluence.speaker]: [true]
[persist.audio.fluence.voicecall]: [true]
[use.voice.path.for.pcm.voip]: [true]
[vendor.audio.feature.hfp.enable]: [true]
[vendor.audio.feature.incall_music.enable]: [true]
```

Additional Information:

This bug is not present in standard Android devices only in Android Automotive.

The Camera2 API implementation works correctly, suggesting the issue is isolated to the ACS library.

We'll share more information about the system's image when available.

Thank you for your assistance. Please let me know if you need any further details to investigate the problem.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the Java call setup and VideoStreamRenderer initialization described in the issue on Android Automotive 12 with Front/0 and Front/1 cameras. Compare the ACS behavior with the stated working Camera2 API and use the supplied logs and device properties to investigate. Done means the preview displays and video is sent to other participants, but no repository file or test is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
audio-video-rtc, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.