Custom streamer.json didn't apply to WebRTC streamer

Bug #1998471 reported by Гурьянов Александр Сергеевич
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Anbox Cloud
Fix Released
Medium
Simon Fels

Bug Description

Hi, I following this docs https://anbox-cloud.io/docs/ref/webrtc-streamer to override default streamer config.

I created addon hq (means high-quality), and assing it to application. The source of addong is attached. It contains only pre-start hook with following code:

```
#!/bin/bash
mkdir -p /var/lib/anbox
echo '{
    "video": {
        "bitrate_limits": [
            { "num_pixels": 2073600, "fps": 60, "min_kbps": 3000, "max_kbps": 6000 },
        ]
    }
}' > /var/lib/anbox/streamer.json
```

I expect that for video <= 1080p bitrate will be between 3000-6000. However it didn't apply. Actually I tried lot of different variants, and also the code form docs page. When container is started I see following logs:

Dec 01 10:21:00 ams-ce47vs858reg22tli930 anbox-starter[149]: 2022/12/01 10:21:00 Executing hook pre-start for addon hq
...
Dec 01 10:21:00 ams-ce47vs858reg22tli930 anbox-starter[149]: I1201 10:21:00.262367 239 platform.cpp:183] Using display configuration: 960x540@25
...
platform.cpp:255] Loading streamer configuration from /var/lib/anbox/streamer.json
Dec 01 10:21:00 ams-ce47vs858reg22tli930 anbox-starter[149]: W1201 10:21:00.553076 239 platform.cpp:258] No streamer configuration available, using default settings
Dec 01 10:21:00 ams-ce47vs858reg22tli930 anbox-starter[149]: I1201 10:21:00.554193 239 platform.cpp:282] WebRTC platform successfully initialized

As you can see from logs, the streaming resolution is 960x540@25, so my rule should apply, but there is a message:
"No streamer configuration available, using default settings"

Evenmore if I connect to container with shell, I can see that file exists:

ubuntu@ip-172-31-12-114:~$ amc shell ce47vs858reg22tli930
root@ams-ce47vs858reg22tli930:~# cat /var/lib/anbox/streamer.json
{
    "video": {
        "bitrate_limits": [
            { "num_pixels": 2073600, "fps": 60, "min_kbps": 3000, "max_kbps": 6000 },
        ]
    }
}
root@ams-ce47vs858reg22tli930:~#

Either an error in the documentation or something does not work as expected.

Revision history for this message
Гурьянов Александр Сергеевич (caiiiycuk) wrote :
description: updated
description: updated
Revision history for this message
Simon Fels (morphis) wrote :

Hey,

thanks for reporting your issue!

The reason your streamer.json doesn't get loaded is because it contains invalid JSON:

{
    "video": {
        "bitrate_limits": [
            { "num_pixels": 2073600, "fps": 60, "min_kbps": 3000, "max_kbps": 6000 },
        ]
    }
}

The comma at the bitrate limit line is not allowed and will fail the parser. You can verify yourself in a linter like https://jsonlint.com/

The following streamer.json will work and will be accepted by Anbox:

{
    "video": {
        "bitrate_limits": [
            { "num_pixels": 2073600, "fps": 60, "min_kbps": 3000, "max_kbps": 6000 }
        ]
    }
}

Anbox can be more verbose about logging such errors and we will improve that.

Revision history for this message
Гурьянов Александр Сергеевич (caiiiycuk) wrote :

Yep, this works!

Docs of anbox https://anbox-cloud.io/docs/ref/webrtc-streamer also contains invalid json. Please fix it.

Thank you for fast answer.

Revision history for this message
Simon Fels (morphis) wrote :

No problem. We will update the documentation as well to correct this.

Changed in anbox-cloud:
milestone: none → 1.16.1
assignee: nobody → Simon Fels (morphis)
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Simon Fels (morphis) wrote :
Changed in anbox-cloud:
milestone: 1.16.1 → 1.17.0
status: Triaged → In Progress
Simon Fels (morphis)
Changed in anbox-cloud:
status: In Progress → Fix Committed
Simon Fels (morphis)
Changed in anbox-cloud:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.