Closed Bug 1770943 Opened 2 years ago Closed 2 years ago

Bad performance when watching videos or livestreams

Categories

(Core :: Audio/Video: Playback, defect, P2)

Firefox 100
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: u707163, Assigned: alwu)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0

Steps to reproduce:

Open multiple videos from Youtube and/or a livestream on Twitch
Search back and forth on the video or switch between tabs

What I've tried so far: Switched form Beta to Stable release, tried Safe Mode multiple times, disabled extensions one after one, cleaned Firefox data through about:support

Actual results:

Video stutters or stops playing, audio keeps playing. Any interaction within Firefox lags extremely until the media tabs are closed.
Profile: https://share.firefox.dev/3yTxd8o

Expected results:

No performance issues when opening video(s) or a livestream.
(I haven't had any performance issues so far until like 1-2 weeks ago. Now it keeps happening.)

It can't be my hardware. I was on 10% CPU load and <20% RAM usage when the problem happened. My bandwidth also never was a problem before with 500MBit and glass fiber.
Ryzen 7 5800X, AMD Radeon RX 6700 XT, 32GB DDR4 RAM.
I'm on Windows 11 21H2, Build 22000.675
Happened on both Beta (101.0) and Stable (100.0.2).
Shared my profile as above, I also recorded another instance if it helps determining the issue. https://www.youtube.com/watch?v=2TNxV9ARFWI

The Bugbug bot thinks this bug should belong to the 'Core::Audio/Video: Playback' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core

Thanks for reporting!

As you said the issue happens recently, would you mind to try to use mozregression to find out the culprit?
Also, would you mind to paste your about:support?

(In reply to mariacastro769 from comment #1)

It can't be my hardware. I was on 10% CPU load and <20% RAM usage when the problem happened. My bandwidth also never was a problem before with 500MBit and glass fiber.

True, the video captured in profiler is actually pretty low resolution, so the problem isn't the decoding speed. I'm still checking the profiled result, will update more information if I find anything.

Thanks.


Could you help me confirm what codec those shuttering video are using? On Youtube, you can use stats for nerds when you right click on the video. On Twitch, you can see Video Stats from setting on their player.

Thank you.

Blocks: video-perf
Severity: -- → S3
Flags: needinfo?(mariacastro769)
Priority: -- → P2

I can see for some video frames, dav1d decoder took a lot of time to decode (dav1d_send_data around 117ms for a frame, which resolution is 576<h<=720) The profiler marker said it's hw accelerated, but it's apparently wrong because we didn't support using hw dav1d decoder on Windows. AV1 hw decoding should be done via WMF decoder.

I noticed that we only use 2 threads for video under 1080, but Chrome uses way more threads than us in the same situation. So probably increasing the thread number could help on the performance.

Assignee: nobody → alwu
Status: UNCONFIRMED → NEW
Ever confirmed: true

(In reply to Alastor Wu [:alwu] from comment #4)

I noticed that we only use 2 threads for video under 1080, but Chrome uses way more threads than us in the same situation. So probably increasing the thread number could help on the performance.

Alright, how would I do that?

And why is it that I haven't had these issues before? Even when watching only one video at a time, it starts to lag to a point where the video stops completely but the audio keeps playing, and interacting with anything in the browser is laggy, sometimes it takes >3 seconds for Firefox to recognize where I moved my mouse. Only reloading the tab or closing it fixes that. Outside of Firefox, everything is just fine.

Flags: needinfo?(mariacastro769) → needinfo?(alwu)

Alright, how would I do that?

That's something Mozilla has to change.

And why is it that I haven't had these issues before?

To answer this question you should run mozregression, see comment 3. Please also provide the other information you were asked for in comment 3. :)

(In reply to Sören Hentzschel from comment #6)

And why is it that I haven't had these issues before?

To answer this question you should run mozregression, see comment 3. Please also provide the other information you were asked for in comment 3. :)

Ah sorry, totally missed that! See below. Also gonna do the mozregression thing.

(In reply to Alastor Wu [:alwu] from comment #3)

Also, would you mind to paste your about:support?
Sure. There were two options, raw data and copy to clipboard, both copied text so I wasn't sure which one you need, so I just copied both :)
https://pastebin.com/6w6By6xA ; https://pastebin.com/FW1Hp7xC (since the text in the latter was in German, I set Firefox to English instead...

Could you help me confirm what codec those shuttering video are using? On Youtube, you can use stats for nerds when you right click on the video. On Twitch, you can see Video Stats from setting on their player.
Youtube (1080p): vp09.00.51.08.01.01.01.01.00 (303) / opus (251)
Twitch (1080p): avc1.64002A,mp4a.40.2

codecs:
Youtube (1080p): vp09.00.51.08.01.01.01.01.00 (303) / opus (251)
Twitch (1080p): avc1.64002A,mp4a.40.2

sorry, I accidentally put it in the quote. In case you miss it.

Alright, tried 4 builds with mozregression. Outcome is weird to me, as it tested builds ranging from May 2021 to November 2021 and all showed the same issue... But I haven't had this before a month max, so it must be something from my PC I assume? Either some Windows update that messed with I dont know what or GPU driver update or whatever...
another paste with the complete log:
https://pastebin.com/s61gHCqk
I hope this tells you anything.
On comment 7 I also pasted my about:support, in case you miss it cause I also put it accidentally in a quote. Wish I could edit comments lol

Flags: needinfo?(alwu)

I just reset my settings in AMD Adrenaline and did the exact same things as before (opening one livestream with heavy load from many chat messages, opening multiple videos on Youtube) and what can I say... I can jump back and forth with no issues so far, loading within less than a second with no stuttering or anything. Interesting!
I did some benchmark, opened 5 videos in 1440p and one in 8K. The tab with the video in 8K was lagging pretty heavily, as soon as I closed it the other videos remained fine and kept playing which certainly wasn't the case before. Before, I had to reload the affected tabs to be able to do anything. It's weird cause when I had the issue, I took a look on the task manager and GPU load was at 0%. Maybe, for some reason, some setting caused the GPU not to be used for video encoding? No idea as I don't know anything about that stuff but I'm glad it seems to be fixed and that I can stay with Firefox.

But:
Before I reset the settings I extracted them. Now I imported them again, testing if they really were that what's caused it. It first seemed like so, as the Twitch video was stuttering. I opened another 4 videos on Youtube which were playing fine. Twitch then also seemed fine, I could search back and forth just like with default settings... It's just werid to me, as resetting my GPU settings seemed to fix it, but when importing my old settings, all also seems fine again?
I'll report back if I suddenly still get issues again. But for now, I think I solved it(?) Hopefully.

Thank for testing that, I will close this bug per comment 10, and file another bug to deal with the threading problem I mentioned in comment 4.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
See Also: → 1771986

(In reply to Alastor Wu [:alwu] from comment #11)

Thank for testing that, I will close this bug per comment 10, and file another bug to deal with the threading problem I mentioned in comment 4.

No no please don't. I had some issues today. It was actually the first time since I posted the last time here. I didn't change any settings on my GPU driver, but it had an update. I only install stable updates though...
Was thinking about running another profiler, but didnt cause I thought it'd go away. Even restarted Firefox but to no avail. I'll see tomorrow if it's still there and will post the profiler output if it is.
It's very annoying to me as this doesn't seem to be entirely solved and also isn't occuring consistently. I had a week with no issues...
Sorry for writing that just as you close it, I didn't think it'd be closed at least for now. Hope it's no issue.

Maybe your driver has some issues, which causes hw decoding affecting the whole system. Would you mind post your about :support again? (the old one already expired.) You can verify that by disabling the pref media.hardware-video-decoding.enabled to see if disabling hw decoding helps.
Thanks!

(In reply to Alastor Wu [:alwu] from comment #13)

Maybe your driver has some issues, which causes hw decoding affecting the whole system. Would you mind post your about :support again?
sure! still not sure which one I is relevant, so here are both. :D https://pastebin.com/nHrVaxQy ; https://pastebin.com/dWhGJd57

I'll try disabling hardware decoding and see if it does anything.

(In reply to Maria from comment #14)

(In reply to Alastor Wu [:alwu] from comment #13)

Maybe your driver has some issues, which causes hw decoding affecting the whole system. Would you mind post your about :support again?

sure! still not sure which one I is relevant, so here are both. :D https://pastebin.com/nHrVaxQy ; https://pastebin.com/dWhGJd57
I'll try disabling hardware decoding and see if it does anything.

(sucks that I can't edit my messages, I keep putting in my response into the quote. lol.

Maybe your driver has some issues, which causes hw decoding affecting the whole system. You can verify that by disabling the pref media.hardware-video-decoding.enabled to see if disabling hw decoding helps.

Seems like disabling hardware decoding works! Without it, I can search a video with no lags at all, whereas with it enabled, the media tab and the whole browser becomes unusable.
Enabled: https://share.firefox.dev/3x7CisA
Disabled: https://share.firefox.dev/3zbocYl(In reply to Alastor Wu [:alwu] from comment #13)

I'll keep it disabled for now and see if anything changes. It's pretty inconsistent, as I had it enabled the whole time and a whole week I had no issues at all. Maybe the driver update 2 days ago started this, at least it didn't happen before that as far as I remember, except for those times until I reset my settings of course. Thank you for the help so far!

*I'm sorry, I don't want to spam this thread. Just noticed that I missed a space. In case you don't see it and wonder why the link isn't working.
https://share.firefox.dev/3zbocYl (for the profiler output when hw decoding is disabled)

(really will use the preview function I just noticed haha.. sorry for the weird formatting in comment 15 <.<)

I can see that many video frames got dropped in the profiled result you provided in comment 15 (the enabled one). In MediaPDecoder threads in the GPU process, I can see there are some Awake markers which took very long time (around ~300 ms) which wasn't seen in the SW decoding profiled result. Almost ~30% of time we were wasting for just waiting decoder to output frames to us.

This symptom looks really a driver issue. And sorry I have to ask same thing again (those about:support expired again) Would you mind to provide your about:support to me? (you can mail me alwu@mozilla.com directly if you don't want to expose them on the public) Then we can use those information to block the same driver and graphic card for other users in order to prevent same issue happening on them.

Thank you so much.

Flags: needinfo?(mariacastro769)

(In reply to Alastor Wu [:alwu] from comment #17)

This symptom looks really a driver issue. And sorry I have to ask same thing again (those about:support expired again) Would you mind to provide your about:support to me? (you can mail me alwu@mozilla.com directly if you don't want to expose them on the public) Then we can use those information to block the same driver and graphic card for other users in order to prevent same issue happening on them.

sure. https://pastebin.com/CaHbNH35 and https://pastebin.com/kPW90zVw
hope they don't expire now, posted them with a pastebin account.

For now, my problem seems fixed. I got in touch with AMD support, as I thought it's a driver issue, and they told me to completely remove my GPU driver with AMD cleanup utility (did that and also used DDU just to be completely sure nothing's left). I also completely uninstalled Firefox and all its registry entries with Geek Uninstaller. I installed the newest chipset driver for my motherboard (B550 Aorus Pro V2) and when downloading that, I also noticed a BIOS update with my CPU in its update description: "Update AMD AGESA V2 1.2.0.6 B for Ryzen 7 5800X3D support" for bios ver. F15a, I was on F14 before.. AMD didn't say anything about a BIOS update but hey, better safe than sorry.
Videos and websites containing them load smoothly and nothing is slowing down, I double checked that hw decoding was enabled. I'm on Firefox Beta 102.0b4. I recorded another thing with the profiler, maybe you can see some changes to the others I posted containing the issue, I don't know. You obviously don't need to check on it, just if you're curious. ;) https://share.firefox.dev/3aOSBSt

I'm praying it will stay like this, cause the last time the issue went away was for a week when I reset my GPU settings, and after a driver update they reappeared. Sucks that I had to cause all the trouble to you and AMD (although AMD and me only sent 2 mails back and forth, nothing compared to this thread lol), I definitely could've come up with the idea myself to do what I was told, but somehow I didn't.
For now, it's fine... Let's see how it's going in a week or two. :) I'll keep you updated!
Thank you very much for your continuous support!

Flags: needinfo?(mariacastro769)

Glad to hear that the issue is gone for you. Sadly your pastebin this time is private, so I couldn't access them :( Are those about:support captured before you reinstalled the driver and BIOS?

I didn't see any long waiting in GPU process in your new profiled result, and hope it won't go back!

Thank you!

Glad to hear that the issue is gone for you. Sadly your pastebin this time is private, so I couldn't access them :( Are those about:support captured before you reinstalled the driver and BIOS?

weird, I can view them even when not logged in. When uploading them again, the paste is "pending moderation"... I'll just upload them to my gdrive instead, too much hassle with pastebin lol
https://drive.google.com/drive/folders/1-1syiNouyy2htyIGL7DW9KdjcgICKDfB
They're from after I reinstalled driver and updated chipset and BIOS. My older pastebins from comment 15 and before were apparently deleted. I set them to never expire and unlisted, maybe pastebin staff still decided it contains sensitive information or something ¯_(ツ)_/¯ Sucks, cause now there's no comparison possible between them... But I had the problems on all versions I tried with mozregression and also when manually installing other versions like the stable release, and I assume mozregression uses standard settings for each version I used and ignores any settings made to the actual Firefox installation. So the Firefox settings shouldn't have caused it, that's at least what I'm thinking.

You need to log in before you can comment on or make changes to this bug.