kyleneideck / BackgroundMusic

Background Music, a macOS audio utility: automatically pause your music, set individual apps' volumes and record system audio.
GNU General Public License v2.0
15.51k stars 664 forks source link

No video playback if BM runs since macOS Sierra #76

Open benomatis opened 7 years ago

benomatis commented 7 years ago

Since I upgraded to macOS Sierra, absolutely no videos are playing back if BM is running. That is no embedded videos in browsers (Chrome, Firefox, Safari) or any videos on the mac (tried inside the Photos app). It's like the video card would be blocked.

kyleneideck commented 7 years ago

Hi, thanks for reporting this. It's a strange issue, but we've actually had a similar one before, #46. I wouldn't be surprised if this bug was a problem with the XPC communication between BGMDriver and BGMApp as well.

Can you try disabling the XPC connection by shutting down BGMXPCHelper with sudo launchctl unload /Library/LaunchDaemons/com.bearisdriving.BGM.XPCHelper.plist?

I would try it myself, but I can't really reproduce the issue. I'm on Sierra as well and I've managed to get videos to freeze in Safari by playing short sounds repeatedly in another app, but only very occasionally. I've haven't got it to happen in Chrome yet, but that could just be because I haven't tried enough. Haven't tried in Firefox yet.

Do apps that play audio but not video always work?

Can you also try getting the latest version and installing a debug build of it with ./build_and_install.sh -d? Then reproduce the bug, copy the logs from Console.app and paste them in here.

It might be helpful to know what audio hardware you're using. Actually, if you have another audio device, like a pair of USB headphones, you could try using it with Background Music to see if the bug goes away.

benomatis commented 7 years ago

When disabling the XPC connection, I get following error:

**Error connecting to BGMXPCHelper**
Make sure you have BGMXPCHelper installed. There are instructions in the README.md file.

Details:
Couldn’t communicate with a helper application. (4097)

This happens whether I have BM on or off before doing the terminal call. This then stops BM, and I cannot start it again, however it starts all videos immediately that were stuck before.

When the issue happens, it freezes Chrome or the Photos app, and it does influence audio too.

I also tried it with a bluetooth headset (though I'm not sure how that would fix a video playback issue), and it didn't work either.

The graphics card is a AMD Radeon HD 6770M.

In the logs I found the following line, and I'm not sure if it's related, but the only one that I assumed was related (let me know if you need anything more / specific / tell me where to look in console):

coreaudiod[200]: BGM_XPCHelper::WaitForBGMAppToStartOutputDevice: Timed out waiting for the Background Music app to start the output device

This error message does seem to be related to #46 to some extent, but for me it seems to happen with video, and I think I'm using the latest version. Where can I check?

kyleneideck commented 7 years ago

Ah, sorry. I forgot that BGMApp quits if you launch it without BGMXPCHelper installed. I don't get why it would be showing the error dialog when you unload BGMXPCHelper while BGMApp is still running, but it shouldn't quit after showing the dialog anyway. I've just pushed a commit that stops it from doing that.

So after you've done git pull (which will get you the latest version) and ./build_and_install.sh -d again you should be able to run BGMApp without BGMXPCHelper installed.

I suspect that will stop the videos from freezing, but it does mean some frames will get dropped when you start playing audio. How many depends on your hardware, but it would likely be noticeable, at least for short sounds.

You could just run IO on your audio hardware all the time, but that can waste CPU time. I'd also like to figure out the root cause of the problem. I'll keep looking into it and update this issue when I've figured out a good way to debug the log message you posted. I'm pretty sure you're right about that message being the problem.

benomatis commented 7 years ago

Ok, I pulled the newest, and tried to install, and here is the message I got:

[1/3] Installing the virtual audio device Background Music Device.driver to /Library/Audio/Plug-Ins/HAL.
ERROR: Install failed at line 196 with the message:

A build command failed. Probably a compilation error.

Failed command:
                            sudo /usr/bin/xcodebuild -project BGMDriver/BGMDriver.xcodeproj -target Background Music Device -configuration Debug RUN_CLANG_STATIC_ANALYZER=0 DSTROOT=/ clean install

Feel free to report this. If you do, you'll probably want to include the build_and_install.log file from this directory (/Sites/_Doc/GitHub/BackgroundMusic). But quickly skim through it first to check that it doesn't include any personal information. It shouldn't, but this is alpha software so you never know.

To try building and installing without this build script, see MANUAL-INSTALL.md.

Do you want me to try installing manually as instructed?

kyleneideck commented 7 years ago

Can you paste your build_and_install.log in here?

benomatis commented 7 years ago

oops, of course I can, I intended to do it then I missed it :)

Background Music Build Log
----
System details:
ProductName:    Mac OS X
ProductVersion: 10.12
BuildVersion:   16A323
Darwin 16.0.0 Darwin Kernel Version 16.0.0: Mon Aug 29 17:56:20 PDT 2016; root:xnu-3789.1.32~3/RELEASE_X86_64 x86_64
[1/3] Installing the virtual audio device Background Music Device.driver(B to /Library/Audio/Plug-Ins/HAL(B.
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)
Copyright (C) 2007 Free Software Foundation, Inc.
Python 2.7.10
On git branch: 

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
Most recent commit: 

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo. ("

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.")
Using xcodebuild: /usr/bin/xcodebuild
Using BGMXPCHelper path: /usr/local/libexec
xcode-select version 2345.1.
Xcode path: /Applications/Xcode.app/Contents/Developer
Xcode version:
Xcode 8.0
Build version 8A218a
Xcode SDKs:

You have not agreed to the Xcode license agreements, please run 'xcodebuild -license' (for user-level acceptance) or 'sudo xcodebuild -license' (for system-wide acceptance) from within a Terminal window to review and agree to the Xcode license agreements.

You have not agreed to the Xcode license agreements, please run 'xcodebuild -license' (for user-level acceptance) or 'sudo xcodebuild -license' (for system-wide acceptance) from within a Terminal window to review and agree to the Xcode license agreements.

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

xcrun version 30.
Clang version:
./build_and_install.sh: line 364: Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.: No such file or directory
launchctl version: Darwin Bootstrapper Version 4.0.0: Fri Aug  5 17:30:31 PDT 2016; root:libxpc_executables-972.1.5~64/launchd/RELEASE_X86_64
----
Failure in ./build_and_install.sh at line 196. The last command was (probably)
    local LAST_COMMAND="${BASH_COMMAND}" LAST_COMMAND_EXIT_STATUS=$?
which exited with status 0.
Error message: A build command failed. Probably a compilation error.\n\nFailed command:
                            sudo /usr/bin/xcodebuild -project BGMDriver/BGMDriver.xcodeproj -target Background Music Device -configuration Debug RUN_CLANG_STATIC_ANALYZER=0 DSTROOT=/ clean install
benomatis commented 7 years ago

alright, alright, I see now :)

You have not agreed to the Xcode license agreements, please run 'xcodebuild -license' (for user-level acceptance) or 'sudo xcodebuild -license' (for system-wide acceptance) from within a Terminal window to review and agree to the Xcode license agreements.
benomatis commented 7 years ago

This now resolved the whole issue, video playback is working again, however I'm not experiencing what you described:

...some frames will get dropped when you start playing audio. How many depends on your hardware, but it would likely be noticeable, at least for short sounds.

How can I test this? I played online audio streams, and songs stored on my mac, but heard no noticeable drops.