Title: [100581] trunk/Source/WebCore
Revision
100581
Author
[email protected]
Date
2011-11-17 01:21:46 -0800 (Thu, 17 Nov 2011)

Log Message

<http://webkit.org/b/72574> Remove unnecessary use of CarbonCore APIs from Audio code

Reviewed by Andy Estes.

* platform/audio/mac/AudioDestinationMac.cpp:
(WebCore::AudioDestinationMac::AudioDestinationMac): Switch from using the Carbon Component Manager
to using AudioUnit's own component interface.
(WebCore::AudioDestinationMac::~AudioDestinationMac): Ditto.
* platform/audio/mac/AudioFileReaderMac.cpp:
(WebCore::AudioFileReader::AudioFileReader): Remove an unncessary trip through the Carbon File Manager
when converting a char* path to a CFURLRef representing the same.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (100580 => 100581)


--- trunk/Source/WebCore/ChangeLog	2011-11-17 09:10:53 UTC (rev 100580)
+++ trunk/Source/WebCore/ChangeLog	2011-11-17 09:21:46 UTC (rev 100581)
@@ -1,3 +1,17 @@
+2011-11-16  Mark Rowe  <[email protected]>
+
+        <http://webkit.org/b/72574> Remove unnecessary use of CarbonCore APIs from Audio code
+
+        Reviewed by Andy Estes.
+
+        * platform/audio/mac/AudioDestinationMac.cpp:
+        (WebCore::AudioDestinationMac::AudioDestinationMac): Switch from using the Carbon Component Manager
+        to using AudioUnit's own component interface.
+        (WebCore::AudioDestinationMac::~AudioDestinationMac): Ditto.
+        * platform/audio/mac/AudioFileReaderMac.cpp:
+        (WebCore::AudioFileReader::AudioFileReader): Remove an unncessary trip through the Carbon File Manager
+        when converting a char* path to a CFURLRef representing the same.
+
 2011-11-17  Adam Barth  <[email protected]>
 
         CSP report-only mode doesn't work from an HTTP header

Modified: trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.cpp (100580 => 100581)


--- trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.cpp	2011-11-17 09:10:53 UTC (rev 100580)
+++ trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.cpp	2011-11-17 09:21:46 UTC (rev 100581)
@@ -76,19 +76,19 @@
     , m_isPlaying(false)
 {
     // Open and initialize DefaultOutputUnit
-    Component comp;
-    ComponentDescription desc;
+    AudioComponent comp;
+    AudioComponentDescription desc;
 
     desc.componentType = kAudioUnitType_Output;
     desc.componentSubType = kAudioUnitSubType_DefaultOutput;
     desc.componentManufacturer = kAudioUnitManufacturer_Apple;
     desc.componentFlags = 0;
     desc.componentFlagsMask = 0;
-    comp = FindNextComponent(0, &desc);
+    comp = AudioComponentFindNext(0, &desc);
 
     ASSERT(comp);
 
-    OSStatus result = OpenAComponent(comp, &m_outputUnit);
+    OSStatus result = AudioComponentInstanceNew(comp, &m_outputUnit);
     ASSERT(!result);
 
     result = AudioUnitInitialize(m_outputUnit);
@@ -100,7 +100,7 @@
 AudioDestinationMac::~AudioDestinationMac()
 {
     if (m_outputUnit)
-        CloseComponent(m_outputUnit);
+        AudioComponentInstanceDispose(m_outputUnit);
 }
 
 void AudioDestinationMac::configure()

Modified: trunk/Source/WebCore/platform/audio/mac/AudioFileReaderMac.cpp (100580 => 100581)


--- trunk/Source/WebCore/platform/audio/mac/AudioFileReaderMac.cpp	2011-11-17 09:10:53 UTC (rev 100580)
+++ trunk/Source/WebCore/platform/audio/mac/AudioFileReaderMac.cpp	2011-11-17 09:21:46 UTC (rev 100581)
@@ -36,7 +36,7 @@
 #include "AudioFileReader.h"
 #include "FloatConversion.h"
 #include <CoreFoundation/CoreFoundation.h>
-#include <CoreServices/CoreServices.h>
+#include <wtf/RetainPtr.h>
 
 namespace WebCore {
 
@@ -64,19 +64,12 @@
     , m_audioFileID(0)
     , m_extAudioFileRef(0)
 {
-    FSRef fsref;
-    OSStatus result = FSPathMakeRef((UInt8*)filePath, &fsref, 0);
-    if (result != noErr)
+    RetainPtr<CFStringRef> filePathString(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, filePath, kCFStringEncodingUTF8));
+    RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, filePathString.get(), kCFURLPOSIXPathStyle, false));
+    if (!url)
         return;
 
-    CFURLRef urlRef = CFURLCreateFromFSRef(0, &fsref);
-    if (!urlRef)
-        return;
-
-    ExtAudioFileOpenURL(urlRef, &m_extAudioFileRef);
-
-    if (urlRef)
-        CFRelease(urlRef);
+    ExtAudioFileOpenURL(url.get(), &m_extAudioFileRef);
 }
 
 AudioFileReader::AudioFileReader(const void* data, size_t dataSize)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to