Bug 454090 - Prevent computer from sleeping after playing some videos
Summary: Prevent computer from sleeping after playing some videos
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Preview-Video (show other bugs)
Version: 7.6.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-20 14:00 UTC by sunphoenix@hotmail.com
Modified: 2022-05-21 13:01 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 7.7.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sunphoenix@hotmail.com 2022-05-20 14:00:34 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Open DigiKam
2. Run in cmd as administrator : "powercfg /requests" and confirm that nothing is preventing PC from sleeping
3. Open DigiKam and play a video (I run it from Album with Preview panel showing)
4. Close DigiKam
5. Run command again is getting me the following message :
SYSTEM:
[DRIVER] High Definition Audio Device (HDAUDIO\FUNC_01&VEN_10EC&DEV_0897&SUBSYS_10438814&REV_1004\4&e778799&0&0001)
An audio stream is currently in use.


OBSERVED RESULT

Computer won't go to sleep.

EXPECTED RESULT

I expect DigiKam to not block the process.

SOFTWARE/OS VERSIONS
Windows: 10 21H2
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION

I can run "powercfg -REQUESTSOVERRIDE DRIVER "High Definition Audio Device" SYSTEM" to circumvent this problem but it is causing other problems like not preventing the PC from sleeping while actually streaming audio/video.
Comment 1 Maik Qualmann 2022-05-20 14:58:10 UTC
I tested it here on my Windows 10 desktop machine. No problems are reported after running a video in digiKam via the command powercfg /requests.
You don't have the problem with other programs? For example play a video in Firefox?

Maik
Comment 2 Maik Qualmann 2022-05-20 15:14:39 UTC
You can really find a lot about this problem via google. Only that can be anything, from Cortana to an optical audio output.
Is digiKam still in the task manager after closing?

Maik
Comment 3 sunphoenix@hotmail.com 2022-05-20 16:31:23 UTC
(In reply to Maik Qualmann from comment #2)
> You can really find a lot about this problem via google. Only that can be
> anything, from Cortana to an optical audio output.
> Is digiKam still in the task manager after closing?
> 
> Maik

Yes it is running because I didn't close it. My problem is that it prevent the PC from sleeping while the app is open and only after I ran one or more videos. As soon as I close it, the audio stream is freed.
Comment 4 sunphoenix@hotmail.com 2022-05-20 16:35:54 UTC
(In reply to Maik Qualmann from comment #1)
> I tested it here on my Windows 10 desktop machine. No problems are reported
> after running a video in digiKam via the command powercfg /requests.
> You don't have the problem with other programs? For example play a video in
> Firefox?
> 
> Maik

Of course no problemes are reported if you close DigiKam :) I don't have any problem with Firefox, when I play a video, the same driver is in use (preventing the PC from sleeping) and when I close the tab or even pause the video, the audio stream is freed properly like it should.
Comment 5 Maik Qualmann 2022-05-21 13:01:02 UTC
Git commit 79269fe73644bb0b6ea345cf17689c23606058ec by Maik Qualmann.
Committed on 21/05/2022 at 13:00.
Pushed by mqualmann into branch 'qt5-maintenance'.

close audio when leave media player view
FIXED-IN: 7.7.0

M  +2    -1    NEWS
M  +6    -2    core/libs/video/player/mediaplayerview.cpp
M  +1    -1    core/libs/video/player/slidevideo.cpp

https://invent.kde.org/graphics/digikam/commit/79269fe73644bb0b6ea345cf17689c23606058ec