twilio / video-quickstart-js

A quickstart and code samples for Twilio Video JavaScript SDK. https://www.twilio.com/docs/video
Other
389 stars 337 forks source link

VIDEO-5729 - Auto Render Hints example #185

Closed PikaJoyce closed 3 years ago

PikaJoyce commented 3 years ago

JIRA: VIDEO-5729

Ngrok Link : https://86cc549b7239.ngrok.io/autorenderhint

This PR is the example for Auto render hints mode. I've also opted to rename the original render hint (manual example) to "manualrenderhint" so it's more consistent and easier to differentiate with the new "autorenderhint" example.

Contributing to Twilio

All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.

makarandp0 commented 3 years ago

This is looking very good @PikaJoyce - Have just a couple suggestions.

PikaJoyce commented 3 years ago

@PikaJoyce I have couple of small suggestions. BTW, I tried the ngrok link, and looks like the bandwidth graph is overlapped by the video initially - is that intended ?

@makarandp0 definitely not! It should be fixed now :)

timmydoza commented 3 years ago

I'm noticing very high CPU usage when I run the render hints example. It's very strange. image

When I start the example, CPU usage is normal, around 50%. After a few minutes it can increase above 150%, and I usually see it spike up to 500% to 800%. Just loading this example is enough for me to reproduce this issue, but I think it can be achieved a little more quickly when I 1) open the app, 2) hide the video element, and 3) switch to a new tab. The CPU usage is very high even though the track is not rendered and the bitrate graph is at 0%.

I've looked at the performance pane of the Chrome devtools, and the JS thread is mostly idle. I cannot find what is causing this high CPU usage. It's very odd. I mentioned it to @PikaJoyce and she is not able to reproduce the issue. @makarandp0 do you have any ideas here?

makarandp0 commented 3 years ago

@PikaJoyce @timmydoza - I did see higher CPU usage ( 50% when the example tab was in background ) - but not as high as you saw. I suspect the CPU usage is coming from re-rendering of that graph every 1000ms. @PikaJoyce can you try to see if increasing the interval from 1000 => 5000 shows CPU improvement?

PikaJoyce commented 3 years ago

@makarandp0 I was seeing the same cpu usage as you were, and not as high as @timmydoza 's. I've made that adjustment and I'm now seeing image which I think is an improvement!

timmydoza commented 3 years ago

@makarandp0 My high CPU usage is not caused by the graph. I removed it completely and I'm still seeing very high CPU usage. The JS thread is about 98% idle, so I don't think the CPU usage is coming from the quickstart. I'm wondering if it has something to do with WebRTC or the Video SDK?