Closed Bug 1908258 Opened 1 year ago Closed 10 months ago

The system goes to sleep before the next track music.youtube.com on Windows

Categories

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

Firefox 128
Unspecified
Windows
defect

Tracking

()

RESOLVED FIXED
133 Branch
Tracking Status
firefox133 --- fixed

People

(Reporter: gooomailer, Assigned: alwu)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

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

Steps to reproduce:

In Winsows 11 23H2 Used a new profile and portable version Changed the user agent. When using a Bluetooth headset or speaker, set it to sleep after a minute.

Actual results:

On https://music.youtube.com/watch?v=dP4t_GGl3Es&list=RDAMVMdP4t_GGl3Es when playing music without video, after the end of the track the computer falls asleep.

Expected results:

How, without Bluetooth speakers in both Windows 10 22H2 and Chrome, the computer did not fall asleep between tracks

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

The severity field is not set for this bug.
:jimm, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(jmathies)

I will take a look on this later.

Blocks: wakelock
No longer blocks: media-triage
Flags: needinfo?(jmathies) → needinfo?(alwu)

I can reproduce this issue without using any headset, the difference between us and Chrome is that they still requested a driver wakelock after track ended, which prevents the computer going to sleep.


When audio is playing, both Firefox and Chrome requests proper wakelocks.

  • Chrome
SYSTEM:
[DRIVER] Realtek Audio (INTELAUDIO\FUNC_01&VEN_10EC&DEV_0289&SUBSYS_10280BEB&REV_1000\5&54f1b19&0&0001)
An audio stream is currently in use.

EXECUTION:
[PROCESS] \Device\HarddiskVolume3\Program Files\Google\Chrome\Application\chrome.exe
Playing audio
  • Firefox
SYSTEM:
[DRIVER] Realtek Audio (INTELAUDIO\FUNC_01&VEN_10EC&DEV_0289&SUBSYS_10280BEB&REV_1000\5&54f1b19&0&0001)
An audio stream is currently in use.

EXECUTION:
[PROCESS] \Device\HarddiskVolume3\Program Files\Firefox Nightly\firefox.exe
non-display request

After audio pauses or ends, Firefox would release BOTH wakelocks immediately, but Chrome would release its Process wakelock first, and then relase Driver wakelock later. As its Driver wakelock overlaps with next audio, Chrome is able to keep wakelock all the time during playing audio from Youtube Music playlist. But Firefox would lose wakelock for a very short period of time during the transition of the song.

However, simply considering the behavior of when a wakelock should be hold. I think Firefox is more precise and correct. The problem for me is how Windows count the time for sleeping. When setting sleep time to 1 min, what I expect is "being completely idle after 1 min". When playing audio shouldn't be considered as completely idle, however, that is not how Windows works.

Touching keyboard or mouse would reset the sleep timer, but keeping playing audio or video doesn't seem affecting the timer. So the timer seems starting counting after the music starts, if no wakelock is being hold at any moment after 1 min, then the system would be going to sleep. That can also explain some weird issues we saw before about complaining the system going to sleep unexpectedly.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(alwu)
OS: Unspecified → Windows
Priority: -- → P2
Summary: The system goes to sleep before the next track music.youtube.com from bluetooth on Win11 → The system goes to sleep before the next track music.youtube.com on Windows

We can slightly delay the wakelock releasing as well, because it doesn't really need to be 100% align with the actual playback.

Assignee: nobody → alwu

Currently, our audio wakelock is precisely synchronized with audible
sound, meaning no wakelock is held when the audio is muted or silent.

On Windows, once the sleeping timer's threshold is reached, the system
appears to enter sleep mode immediately after the audio wakelock is
released. This timing issue prevents a playlist web application from
playing the next song, as the system falls asleep right after the first
song ends.

To address this, we consider delaying the release of the audio wakelock
slightly. This adjustment would allow the next song in the playlist to
start playing and prevent the system from entering sleep mode during
extended silences, which are common at the end of songs.

Attachment #9417349 - Attachment description: Bug 1908258 - delay audio wakelock releasing. → Bug 1908258 - part1 : delay audio wakelock releasing.

There are some r+ patches which didn't land and no activity in this bug for 2 weeks.
:alwu, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.

Flags: needinfo?(padenot)
Flags: needinfo?(alwu)
Depends on: 1921288

We will land those patches after bug 1921288 is fixed.

Flags: needinfo?(padenot)
Flags: needinfo?(alwu)
Pushed by alwu@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c191ec72d15b part1 : delay audio wakelock releasing. r=padenot https://hg.mozilla.org/integration/autoland/rev/9c68ff88874c part2 : no need to delay wakelock releasing for testing. r=padenot
Status: NEW → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Target Milestone: --- → 133 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: