androidthings / sample-videoRTC

Apache License 2.0
97 stars 51 forks source link

Unbearably slow performance when rendering on a large display device (monitor, TV, etc.) #7

Open kairyk opened 5 years ago

kairyk commented 5 years ago

I've done a lot of experiments and here is what I found so far.

First, there are two sets of variables that I tweaked a lot during these experiments:

(1) Rendering Size. Namely the size of SurfaceViewRenderer. This is defined in activity_call.xml and default to "wrap_content", which is the size of the display device. In my case, this is a 27 inch monitor. (2) Capturing Size. Pass to PeerConnectionClient.PeerConnectionParameters. Default to 1280 x 720.

When starting the call, the stream will be captured and flown into a sink view which at this point is the main view, being rendered in Rendering Size.

The frame rate at this moment is about

_Capturing Size_    _Rendering Size_        FPS
1280 x 720      1280 x 720          9
640 x 360       Full Screen         9
1280 x 720      Full Screen         3
1920 x 1080     Full Screen         1

Note this is purely local. No call has been even made. What is shown is what is captured and sent out directly from the local camera. The whole scenario has nothing to do with the network.

NOTES: (1) I am using the Raspberry PI camera V1.2. I also tried a USB web cam and the result is about the same. (2) I even increased GPU memory from 256 MB to 512 MB (config.txt). No effect. (3) The same device, when running Raspbian, has no problem running a simple Python application using picamera module. The app simply opens preview mode and renders local camera in high resolution at full screen. I don't have an exact FPS number. But it is so smooth that by my estimate is it's easily 24 FPS.