Commit 121b3638 authored by jer.noble@apple.com's avatar jer.noble@apple.com

WebAudio: AudioBus::loadPlatformResource should mmap file on Mac port.

https://bugs.webkit.org/show_bug.cgi?id=74326

Reviewed by Darin Adler.

No new tests; no net change in functionality.

Use NSDataReadingMappedIfSafe when reading platform audio file data.

* platform/audio/mac/AudioBusMac.mm:
(WebCore::AudioBus::loadPlatformResource):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104858 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7da74215
2011-12-12 Jer Noble <jer.noble@apple.com>
WebAudio: AudioBus::loadPlatformResource should mmap file on Mac port.
https://bugs.webkit.org/show_bug.cgi?id=74326
Reviewed by Darin Adler.
No new tests; no net change in functionality.
Use NSDataReadingMappedIfSafe when reading platform audio file data.
* platform/audio/mac/AudioBusMac.mm:
(WebCore::AudioBus::loadPlatformResource):
2011-12-12 Jer Noble <jer.noble@apple.com>
WebAudio: Use Logging instead of printf.
......@@ -47,8 +47,8 @@ PassOwnPtr<AudioBus> AudioBus::loadPlatformResource(const char* name, float samp
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSBundle *bundle = [NSBundle bundleForClass:[WebCoreAudioBundleClass class]];
NSString *audioFilePath = [bundle pathForResource:[NSString stringWithUTF8String:name] ofType:@"wav" inDirectory:@"audio"];
NSData *audioData = [NSData dataWithContentsOfFile:audioFilePath];
NSURL *audioFileURL = [bundle URLForResource:[NSString stringWithUTF8String:name] withExtension:@"wav" subdirectory:@"audio"];
NSData *audioData = [NSData dataWithContentsOfURL:audioFileURL options:NSDataReadingMappedIfSafe error:nil];
if (audioData) {
OwnPtr<AudioBus> bus(createBusFromInMemoryAudioFile([audioData bytes], [audioData length], false, sampleRate));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment