If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

High CPU use during playback when timeBeginPeriod(1) has been called

NEW
Unassigned

Status

()

Core
Audio/Video: Playback
7 years ago
2 years ago

People

(Reporter: Jake, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

30.50 KB, application/x-ms-dos-executable
Details
(Reporter)

Description

7 years ago
User-Agent:       Mozilla/5.0 (Windows NT 5.1; rv:6.0a1) Gecko/20110506 Firefox/6.0a1
Build Identifier: 

First close all media players and other browsers if there are.
Go to http://www.youtube.com/html5 join html5 test then go to http://www.youtube.com/watch?v=eWUC5Q0RCAA and open taskmgr to monitor the CPU usage.
Play for a little while then open WMP (or any other media player, didn't try a pure music player though), see how much the CPU usage increases.
The WMP you opened isn't playing anything just staying there, how could it affect CPU usage so much?
Many (even most I think) people would like to play some music while they are surfing, when they begin to watch a online video most likely they will just pause the media player. Imagine how many resources go to waste unknowingly, and they will be under the impression that WebM on Fx is so inefficient(as I was).

Reproducible: Always
I think Windows Media Player alters the OS's timer resolution via timeBeginPeriod (or a similar API), and that my be interacting badly with some behaviour in Firefox's media playback engine.  That this can happen is almost certainly a bug in Firefox.

I don't seem to be able to reproduce this on my Windows 7 x64 machine.  The video I tested used around 3-4% of a CPU during playback with out without WMP open, and with and without WMP playing a video.
(Reporter)

Comment 2

7 years ago
Maybe it only happens on XP? Not just WMP, I've also trid KMP and Potplayer.
(Reporter)

Comment 3

7 years ago
Actually only openning KMP and Potplayer won't affect it, you have to play and pause, no matter video or just audio.
(Reporter)

Comment 4

7 years ago
(In reply to comment #1)
> I think Windows Media Player alters the OS's timer resolution via
> timeBeginPeriod (or a similar API), and that my be interacting badly with
> some behaviour in Firefox's media playback engine.  That this can happen is
> almost certainly a bug in Firefox.
> 
> I don't seem to be able to reproduce this on my Windows 7 x64 machine.  The
> video I tested used around 3-4% of a CPU during playback with out without
> WMP open, and with and without WMP playing a video.
If it's not much a imposition, can you test it on Chrome? the thing is that on my computer chrome has much higher CPU usage than Fx in terms of playing a webm video, and CPU usage doesn't insrease after you open MP.
Iv had a few people test it in a forum (non-English), my preliminary conclusion is that Fx has a WebM playing "bug" that can drasticly decrease CPU usage, but it won't "work" after you open a MP, most sadly it only "works" on XP.
Hopefully someone can find out what it is and "implement" it further.
(Reporter)

Comment 5

7 years ago
Maybe it's the way the video renders? overlay on xp and vmr on win7? it wouldn't make such a CPU usage difference(almot tenfold), and I didn't see the quality difference.
I'll test this on XP when I get access to an XP VM.
I can reproduce this in my XP VM.  With my test video, Firefox consumes around 5-10% CPU during playback.  Opening Windows Media Player 11 (and doing nothing else--with no video or audio playing in WMP) causes Firefox's CPU use to increase to 40-50%.
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Reporter)

Comment 8

6 years ago
(In reply to comment #7)
> I can reproduce this in my XP VM.  With my test video, Firefox consumes
> around 5-10% CPU during playback.  Opening Windows Media Player 11 (and
> doing nothing else--with no video or audio playing in WMP) causes Firefox's
> CPU use to increase to 40-50%.
Thanks for your confirmation.
I can also reproduce this with a simple program that calls |timeBeginPeriod(1);| and then waits for a key press before calling |timeEndPeriod(1);|, so my guess in comment 1 seems to be correct.

My guess is that the video code is sleeping for very short time periods which would usually end up being rounded (up?) to the nearest 10ms due to the default Win32 timer behaviour.  When the timer resolution is changed with timeBeginPeriod, the code will wake up more frequently and may be performing excessive busy work.
Summary: WebM CPU usage drasticly increases when openning a video player → High CPU use when playing video when timeBeginPeriod(1) has been called
Created attachment 541269 [details]
test program
Summary: High CPU use when playing video when timeBeginPeriod(1) has been called → High CPU use during playback when timeBeginPeriod(1) has been called
Component: Audio/Video → Audio/Video: Playback
You need to log in before you can comment on or make changes to this bug.