Title: [215625] trunk/Source/WebCore
Revision
215625
Author
[email protected]
Date
2017-04-21 12:56:05 -0700 (Fri, 21 Apr 2017)

Log Message

Add a method to retrieve the current I/O buffer size from AudioSession
https://bugs.webkit.org/show_bug.cgi?id=171126

Reviewed by Eric Carlson.

There is an existing method to get and set the preferred I/O buffer size; add a matching method to return
the acutal I/O buffer size.

* platform/audio/AudioSession.cpp:
(WebCore::AudioSession::bufferSize):
* platform/audio/AudioSession.h:
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSession::bufferSize):
* platform/audio/mac/AudioSessionMac.cpp:
(WebCore::AudioSession::bufferSize):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (215624 => 215625)


--- trunk/Source/WebCore/ChangeLog	2017-04-21 19:22:47 UTC (rev 215624)
+++ trunk/Source/WebCore/ChangeLog	2017-04-21 19:56:05 UTC (rev 215625)
@@ -1,5 +1,23 @@
 2017-04-21  Jer Noble  <[email protected]>
 
+        Add a method to retrieve the current I/O buffer size from AudioSession
+        https://bugs.webkit.org/show_bug.cgi?id=171126
+
+        Reviewed by Eric Carlson.
+
+        There is an existing method to get and set the preferred I/O buffer size; add a matching method to return
+        the acutal I/O buffer size.
+
+        * platform/audio/AudioSession.cpp:
+        (WebCore::AudioSession::bufferSize):
+        * platform/audio/AudioSession.h:
+        * platform/audio/ios/AudioSessionIOS.mm:
+        (WebCore::AudioSession::bufferSize):
+        * platform/audio/mac/AudioSessionMac.cpp:
+        (WebCore::AudioSession::bufferSize):
+
+2017-04-21  Jer Noble  <[email protected]>
+
         Make AudioSampleBufferList::reset() less expensive.
         https://bugs.webkit.org/show_bug.cgi?id=171124
 

Modified: trunk/Source/WebCore/platform/audio/AudioSession.cpp (215624 => 215625)


--- trunk/Source/WebCore/platform/audio/AudioSession.cpp	2017-04-21 19:22:47 UTC (rev 215624)
+++ trunk/Source/WebCore/platform/audio/AudioSession.cpp	2017-04-21 19:56:05 UTC (rev 215625)
@@ -81,6 +81,12 @@
     return 0;
 }
 
+size_t AudioSession::bufferSize() const
+{
+    notImplemented();
+    return 0;
+}
+
 size_t AudioSession::numberOfOutputChannels() const
 {
     notImplemented();

Modified: trunk/Source/WebCore/platform/audio/AudioSession.h (215624 => 215625)


--- trunk/Source/WebCore/platform/audio/AudioSession.h	2017-04-21 19:22:47 UTC (rev 215624)
+++ trunk/Source/WebCore/platform/audio/AudioSession.h	2017-04-21 19:56:05 UTC (rev 215625)
@@ -59,6 +59,7 @@
     CategoryType categoryOverride() const;
 
     float sampleRate() const;
+    size_t bufferSize() const;
     size_t numberOfOutputChannels() const;
 
     bool tryToSetActive(bool);

Modified: trunk/Source/WebCore/platform/audio/ios/AudioSessionIOS.mm (215624 => 215625)


--- trunk/Source/WebCore/platform/audio/ios/AudioSessionIOS.mm	2017-04-21 19:22:47 UTC (rev 215624)
+++ trunk/Source/WebCore/platform/audio/ios/AudioSessionIOS.mm	2017-04-21 19:56:05 UTC (rev 215625)
@@ -171,6 +171,11 @@
     return [[AVAudioSession sharedInstance] sampleRate];
 }
 
+size_t AudioSession::bufferSize() const
+{
+    return [[AVAudioSession sharedInstance] IOBufferDuration] * sampleRate();
+}
+
 size_t AudioSession::numberOfOutputChannels() const
 {
     return [[AVAudioSession sharedInstance] outputNumberOfChannels];

Modified: trunk/Source/WebCore/platform/audio/mac/AudioSessionMac.cpp (215624 => 215625)


--- trunk/Source/WebCore/platform/audio/mac/AudioSessionMac.cpp	2017-04-21 19:22:47 UTC (rev 215624)
+++ trunk/Source/WebCore/platform/audio/mac/AudioSessionMac.cpp	2017-04-21 19:56:05 UTC (rev 215625)
@@ -101,6 +101,22 @@
     return narrowPrecisionToFloat(nominalSampleRate);
 }
 
+size_t AudioSession::bufferSize() const
+{
+    UInt32 bufferSize;
+    UInt32 bufferSizeSize = sizeof(bufferSize);
+
+    AudioObjectPropertyAddress bufferSizeAddress = {
+        kAudioDevicePropertyBufferFrameSize,
+        kAudioObjectPropertyScopeGlobal,
+        kAudioObjectPropertyElementMaster };
+    OSStatus result = AudioObjectGetPropertyData(defaultDevice(), &bufferSizeAddress, 0, 0, &bufferSizeSize, &bufferSize);
+
+    if (result)
+        return 0;
+    return bufferSize;
+}
+
 size_t AudioSession::numberOfOutputChannels() const
 {
     notImplemented();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to