Piped icon indicating copy to clipboard operation
Piped copied to clipboard

Delayed playing and high CPU

Open VarLad opened this issue 2 years ago • 6 comments
trafficstars

Official Instance

Describe the bug

When I select VP9 in the Preferences in Piped, I notice that videos take a few seconds to load (and until then the CPU usage is really high) This behavior only happens on Firefox (latest version). In particular, the RDD process has a really high CPU usage.

To Reproduce

Open https://piped.video/watch?v=HFn495_Xsr0 in Firefox with VP9 codec enabled

Expected behavior

Video plays immediately without super high CPU usage

Logs/Errors

No response

Browser, and OS with Version.

Firefox 116.0.2 on Fedora Linux

Additional context

While the CPU usage quickly falls down, the super high CPU usage does gets the fans running which use power. If possible, I'd like to help debug that.

VarLad avatar Aug 14 '23 15:08 VarLad

I can somewhat confirm that the issue is not with Firefox + VP9 The reason being, it works fine with https://tube.cadence.moe/watch?v=HFn495_Xsr0 The logs in MOZ_LOG="PlatformDecoderModule:5" firefox are wildly different for the 2 sites as well. And it works fine for a lot of invidous sites as well as poketube, leading me to believe that the issue is in the player itself that Piped uses

VarLad avatar Aug 14 '23 16:08 VarLad

This sounds like the many issues that have plagued hardware WebRender with hardware video acceleration on Linux/macOS.

I've been able to work around this by disabling the RDD sandbox entirely, which has security implications:

media.rdd-process.enabled = false

or just disabling VP9 through RDD:

media.rdd-ffmpeg.enabled = false # May disable other codecs, but both are required on my system
media.rdd-ffvpx.enabled = false

Neither of the above should disable hardware acceleration.

Using software WebRender also works as a last resort, but will disable acceleration for the entire browser:

gfx.webrender.software = true

FWIW, this occurs on my system with any codec toggled in the Piped preferences, not just VP9. It's possible this is due to a misconfigured VAAPI setup, though acceleration is still functional so I am hesitant to say that is the case.

myned avatar Mar 20 '24 23:03 myned

I'm not sure how to verify this is the issue I'm having, but videos have a 10-20s delay after page load before they start playing. I'm on Firefox on Linux/Wayland using HW accelerated WebRender. It happens both on the official instance and my own.

TheSunCat avatar Apr 06 '24 10:04 TheSunCat

The options I mentioned are in about:config. I would probably test with software WebRender first after a relaunch. On my system, at least, disabling the sandbox causes graphical anomalies during playback.

myned avatar Apr 06 '24 14:04 myned

With gfx.webrender.software set, videos take ~5s to load. Faster than before, but still a significant delay over YT's own page or LibreTube. I didn't notice a significant difference with media.rdd-process.enabled set to false.

TheSunCat avatar Apr 07 '24 10:04 TheSunCat

media.hardware-video-decoding.enabled = false may also work and more selectively disables acceleration for videos instead of the browser. With any of these settings, my system goes from about ~10s to ~1s including buffering, so there may be something else going on as well.

myned avatar Apr 07 '24 18:04 myned