Posted By Paul Kafasis on February 8th, 2012
Last week, we had an issue with Skype and our two audio recording applications, Audio Hijack Pro and Piezo. Mac OS X 10.7.3 broke the ability of these applications to launch Skype and record its audio. Using the Instant On extra, Audio Hijack Pro was still able to capture and record from Skype. However, Piezo users and Audio Hijack Pro users who hadn’t installed that optional component were left unable to record Skype.
First, let me say that we’ve already resolved the problem. Download the latest Audio Hijack Pro from our site, or the latest Piezo from us or from the Mac App Store. Get that set, then read on for more information.
We know many users depend on these two apps to record Skype, including hundreds of podcasters, so we set to work on getting this fixed right away. The problem was quite bizarre, as our applications hadn’t changed at all, and neither had Skype. The only difference was Mac OS X 10.7.3 itself. Our audio capture code is very robust, so minor updates to Mac OS X almost never have any impact at all. Something was most certainly amiss here.
To figure out what was happening, we actually had to look back to January of 2011, when version 5 of Skype first shipped. The executable code for Skype 5 is strange, due to some incredibly non-standard code obfuscation measures they’ve put in place. Specifically, the actual binary file in Skype.app/Contents/MacOS/Skype is encoded, and only decodes itself at runtime by rewriting itself as it runs. In short, the program seen on disk is not the program which actually runs. This causes the library-loading order in Skype to be rather odd; libraries would appear to load at launch, but not be truly loaded until later in the launch process.
Unfortunately, this non-standard behavior confused our audio capturing code. Problems occurred when things our code expected to be there (like the important-for-audio-capture CoreAudio library) weren’t loaded. We investigated, and fortunately, the workaround at the time was simple enough. We made Audio Hijack Pro ask dyld, the dynamic linker for Mac OS X which loads all code, to notify it whenever a library was loaded. Audio Hijack Pro then waited until CoreAudio was present before going off and doing its thing. This cured the problems with a minimum of fuss. That fix worked just fine on Mac OS X 10.6 (as well as the later-released Mac OS X 10.7), and we rapidly shipped a small update to restore recording from Skype.
Alas, with the release of Mac OS X 10.7.3, Apple made a small-but-critical change to the aforementoned dyld. The explanation of this change is a bit technical: In an apparent attempt to fix some threading issues, Apple added a thread lock to dlopen(). While this likely fixed their bug, it had the unintended side effect of causing a deadlock when our apps launched Skype, as the previous Skype fix used dlopen() from within a dyld callback. The end result was that with the existing versions of Audio Hijack Pro and Piezo, launching Skype to record audio did not work correctly on Mac OS X 10.7.3.
Not wanting to leave our customers hanging, we again worked rapidly to solve the issue. The new workaround is actually very similar to the previous one – we simply delay calling dlopen() until Skype is further initialized and we are no longer in a dyld callback. The fix took a few hours of hard work, and shortly after, we shipped Audio Hijack Pro 2.10.1. However, we also ran straight into one of the downsides of the Mac App Store as it stands now – we couldn’t ship a fix for Piezo nearly so rapidly. Our update was eventually approved, and Piezo 1.1.2 also restores the ability to record Skype on all compatible versions of Mac OS X.
Ultimately, while capturing audio from Skype at launch time can be a tricky proposition, it’s well worth the effort to satisfy our users. While these hassles have been frustrating for us, they’ve really just been a two small hiccups throughout years and years of quality audio recording. Our users can be confident that our tools will work, and that if a problem does arise, we’ll work rapidly to get it fixed.