Open Bug 1515239 Opened 5 years ago Updated 8 months ago

1080p 60fps YouTube videos with the avc codec stutter with AMD GPU

Categories

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

64 Branch
defect

Tracking

()

Tracking Status
firefox-esr60 --- wontfix
firefox64 --- wontfix
firefox65 --- wontfix
firefox66 --- wontfix
firefox67 --- wontfix
firefox68 --- wontfix
firefox69 --- wontfix
firefox70 --- fix-optional

People

(Reporter: mrbigdoge99, Unassigned)

References

Details

(Keywords: regression)

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

Steps to reproduce:

1. Close any programs that use GPU and turn off any kind of screen recording software, like ReLive in Radeon settings or OBS. GPU usage in task manager should be 0%. 
2. Play any 1080p 60fps YouTube video that uses the avc codec. Here's 2 videos you can try: https://www.youtube.com/watch?v=kVyV_fTk6rc and https://www.youtube.com/watch?v=bZ7SkegZ3SU



Actual results:

The video noticeably stutters when playing a 1080p 60fps YouTube video with the avc codec.


Expected results:

The video should be playing smoothly with no stutter.

I've tried making a new profile, reinstalling GPU drivers, reinstalling Firefox, Firefox Nightly (Build ID: 20181218191030), only having 1 monitor plugged in, and various about:config changes. The only "fix" I've found was to turn off hardware acceleration or setting layers.gpu-process.enabled and media.gpu-process-decoder to false in about:config, but this just causes more problems like imgur.com crashing Firefox. 

I've tried to replicate this issue on another computer with an Nvidia GPU (GTX 1050) but the videos play just fine. In my experience, this issue only seems to happen when using Firefox with an AMD GPU (R9 390) and playing a 1080p 60fps avc video on YouTube. 720p 60fps avc videos and videos using the VP9 codec do not have this issue and play as expected. Chrome and Edge don't have this problem at all.

Now the really strange thing I found was that if you start recording a video with OBS with the H264/AVC Encoder (https://imgur.com/iwVU2Ov) or turning ReLive on with Record Desktop enabled (https://imgur.com/UzvELfn), the issue stops. You can be watching the stuttering video and as soon as you start recording, it's smooth. I've recorded 2 videos with my phone, one while recording with OBS (https://streamable.com/nekpp) and the other without recording (https://streamable.com/yvi3r), and you can see there is a difference.
Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core
Thank you for your report. I don't have access to hardware to confirm this, but I've cc'd some people with more experience dealing with playback bugs that may be able to help out.

In the meantime, it would be great if you could retest with Firefox 66 (the current Nightly, you can find it here: https://www.mozilla.org/en-US/firefox/channel/desktop/#nightly) in case this is a problem that has been fixed since Firefox 64. Thanks!
I just tested the videos with Firefox Nightly and they still stutter. 

When I get some time I'll try and swap my GPU with an Nvidia card and see if anything changes.
I notice also lags during youtube playback on 1080p videos, since firefox 64,
with firefox 63 there is no bug, all was smooth with youtube,

I use archlinux, graphic card : radeon hd4650 pcie,
the bug is visible here, during credits, there are noticeable lags on credits :

https://www.youtube.com/watch?v=d2bpHytmUK0&feature=youtu.be&t=753

the bug doesn't exist on chromium and opera, so it's likely a problem in firefox source code, a regression because all was ok with firefox 63
I filmed my screen with my smartphone in order to show the problem, you can download the video files here (link avalaible for 30 days) :
https://we.tl/t-68tC19dkWH

videos can be open with vlc
First pleas test with Firefox Nightly to see if the issue still exists there. If yes, Using the mozregression utility available at https://mozilla.github.io/mozregression/install.htm,
Could you identify what caused the regression between 63 and 64 for you?

Thank you
Flags: needinfo?(mrbigdoge99)
I just swapped out my AMD card for the Nvidia and there's no more stuttering. I've also noticed that when I play the videos with the Nvidia card the GPU usage spikes to about 30% whereas my AMD card spikes up to about %80.
Flags: needinfo?(mrbigdoge99)
With the AMD card the GPU usage stays around 70% throughout the videos but the Nvidia card spikes up to %30 for a second and drops down to about 10 to 20% throughout the videos.
This doesn't help us solving this issue however :(
(In reply to Jean-Yves Avenard [:jya] from comment #5)
> First pleas test with Firefox Nightly to see if the issue still exists
> there. If yes, Using the mozregression utility available at
> https://mozilla.github.io/mozregression/install.htm,
> Could you identify what caused the regression between 63 and 64 for you?
> 
> Thank you

I tried to use mozeregression-gui, but it doesn't work under archlinux :

./mozregression-gui 
Traceback (most recent call last):
  File "/home/travis/build/mozilla/mozregression/venv/local/lib/python2.7/site-packages/cx_Freeze/initscripts/__startup__.py", line 14, in run
  File "/home/travis/build/mozilla/mozregression/venv/local/lib/python2.7/site-packages/cx_Freeze/initscripts/Console.py", line 26, in run
  File "mozregui/main.py", line 3, in <module>
  File "./mozregui/patch_requests.py", line 17, in patch
  File "/usr/local/lib/python2.7/dist-packages/requests/__init__.py", line 43, in <module>
  File "/usr/local/lib/python2.7/dist-packages/urllib3/__init__.py", line 8, in <module>
  File "/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 35, in <module>
  File "/usr/local/lib/python2.7/dist-packages/urllib3/request.py", line 3, in <module>
  File "/usr/local/lib/python2.7/dist-packages/urllib3/filepost.py", line 12, in <module>
the full error log :

./mozregression-gui 
Traceback (most recent call last):
  File "/home/travis/build/mozilla/mozregression/venv/local/lib/python2.7/site-packages/cx_Freeze/initscripts/__startup__.py", line 14, in run
  File "/home/travis/build/mozilla/mozregression/venv/local/lib/python2.7/site-packages/cx_Freeze/initscripts/Console.py", line 26, in run
  File "mozregui/main.py", line 3, in <module>
  File "./mozregui/patch_requests.py", line 17, in patch
  File "/usr/local/lib/python2.7/dist-packages/requests/__init__.py", line 43, in <module>
  File "/usr/local/lib/python2.7/dist-packages/urllib3/__init__.py", line 8, in <module>
  File "/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 35, in <module>
  File "/usr/local/lib/python2.7/dist-packages/urllib3/request.py", line 3, in <module>
  File "/usr/local/lib/python2.7/dist-packages/urllib3/filepost.py", line 12, in <module>
LookupError: no codec search functions registered: can't find encoding
I think firefox developpers should easily reproduce the bug, if they have an AMD card and use linux (especially rolling release distro like archlinux),

the bug is noticeable here during the credits with firefox 64 :
https://www.youtube.com/watch?v=d2bpHytmUK0&feature=youtu.be&t=753

with firefox 63 there is no bug
I tested firefox beta 65.0b6 (64 bits) and the bug seems solved with this version
Sounds like Barto and the original reporter may be facing different issues if one is fixed in recent versions (comment #12) and the other is not (comment #2).

mrbigdoge99, are you able to use moz-regression to locate a regression range?
I used Mozregression and I found that the last build that worked flawlessly was: mozilla-central build: 2016-11-15. The video doesn't stutter and the player UI doesn't lag and it works exactly like Chrome, Edge, and Firefox 64 with an Nvidia GPU. All the builds I tested before 2016-11-15 also seemed to work perfectly but mozilla-central build: 2016-11-16 and every build after that the video stutters and the player UI lags. 

Here's the log if it's of any use: https://pastebin.com/0gvME7DJ
(In reply to Barto from comment #11)
> I think firefox developpers should easily reproduce the bug, if they have an
> AMD card and use linux (especially rolling release distro like archlinux),
> 
> the bug is noticeable here during the credits with firefox 64 :
> https://www.youtube.com/watch?v=d2bpHytmUK0&feature=youtu.be&t=753
> 
> with firefox 63 there is no bug

The original issue reported is on Windows, I don't think those two are the same.
(In reply to mrbigdoge99 from comment #14)
> I used Mozregression and I found that the last build that worked flawlessly
> was: mozilla-central build: 2016-11-15. The video doesn't stutter and the
> player UI doesn't lag and it works exactly like Chrome, Edge, and Firefox 64
> with an Nvidia GPU. All the builds I tested before 2016-11-15 also seemed to
> work perfectly but mozilla-central build: 2016-11-16 and every build after
> that the video stutters and the player UI lags. 
> 
> Here's the log if it's of any use: https://pastebin.com/0gvME7DJ

Thank you for this.

This gives:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=5e76768327660437bf3486554ad318e4b70276e1&tochange=79feeed4293336089590320a9f30a813fade8e3c

at a glance, I'd say the issue was introduced with 
d579376d21b7	Matt Woodrow — Bug 1315141 - Enable OOP video decoding for Nightly builds. r=cpearce

If you only set the preference media.gpu-process-decoder to false, (and not layers.gpu-process.enable) do things work better? 

Lmgur crashes you mentioned would be causing gpu drivers crashes which with the GPU process we can recover from
Blocks: 1315141
Flags: needinfo?(mrbigdoge99)
Keywords: regression
It's really hard to tell for sure but setting media.gpu-process-decoder to false does seem to remove most of the stutter from the videos, but it still doesn't perform as well as the 2016-11-15 build. 

Imgur.com is the only site I've found that crashes with media.gpu-process-decoder set to false, but I haven't tested any other sites. I'll keep it set to false and see if encounter any issues/crashes.
Flags: needinfo?(mrbigdoge99)

Looks like a regression, and that we have an idea where it was introduced. Matt, does this sound like something that could have resulted from the above patch?

Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(matt.woodrow)
Priority: -- → P2

Yeah definitely, it's a pretty big change to the video presentation pipeline for Windows (and only Windows!), so performance regressions are totally believable.

I'm pretty swamped with WR right now, but it shouldn't be overly hard for someone to debug this.

Flags: needinfo?(matt.woodrow)

Last chance for this before I remove it from regression triage. drno can you help find an owner for this issue?

We've had feedback from AMD that it could be due to how they handle refresh rate and how their internal driver could drop a frame if it believes it is late.

This gets in the way of our own logic attempting to do the same.

Bulk change for all regression bugs with status-firefox67 as 'fix-optional' to be marked 'affected' for status-firefox68.

Flags: needinfo?(drno)

Bug is unassigned and we are past beta midpoint, so wontfix for 68.

As noted in comment 20 we want to remove this from regression triage. So, best to leave it unmarked or fix-optional across the board.

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.