Title: [251249] trunk/Source/WebCore
- Revision
- 251249
- Author
- you...@apple.com
- Date
- 2019-10-17 11:19:03 -0700 (Thu, 17 Oct 2019)
Log Message
SincResampler does not need to create a new AudioBus for each consumeSource call
https://bugs.webkit.org/show_bug.cgi?id=202983
Reviewed by Eric Carlson.
Allocate an internal AudioBus once and for all.
No observable change of behavior.
* platform/audio/SincResampler.cpp:
(WebCore::SincResampler::consumeSource):
* platform/audio/SincResampler.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (251248 => 251249)
--- trunk/Source/WebCore/ChangeLog 2019-10-17 18:18:56 UTC (rev 251248)
+++ trunk/Source/WebCore/ChangeLog 2019-10-17 18:19:03 UTC (rev 251249)
@@ -1,3 +1,17 @@
+2019-10-17 Youenn Fablet <you...@apple.com>
+
+ SincResampler does not need to create a new AudioBus for each consumeSource call
+ https://bugs.webkit.org/show_bug.cgi?id=202983
+
+ Reviewed by Eric Carlson.
+
+ Allocate an internal AudioBus once and for all.
+ No observable change of behavior.
+
+ * platform/audio/SincResampler.cpp:
+ (WebCore::SincResampler::consumeSource):
+ * platform/audio/SincResampler.h:
+
2019-10-17 Chris Dumez <cdu...@apple.com>
Deprecate ActiveDOMObject::canSuspendForDocumentSuspension()
Modified: trunk/Source/WebCore/platform/audio/SincResampler.cpp (251248 => 251249)
--- trunk/Source/WebCore/platform/audio/SincResampler.cpp 2019-10-17 18:18:56 UTC (rev 251248)
+++ trunk/Source/WebCore/platform/audio/SincResampler.cpp 2019-10-17 18:19:03 UTC (rev 251249)
@@ -130,14 +130,15 @@
ASSERT(m_sourceProvider);
if (!m_sourceProvider)
return;
-
+
// Wrap the provided buffer by an AudioBus for use by the source provider.
- auto bus = AudioBus::create(1, numberOfSourceFrames, false);
+ if (!m_internalBus || m_internalBus->length() != numberOfSourceFrames)
+ m_internalBus = AudioBus::create(1, numberOfSourceFrames, false);
// FIXME: Find a way to make the following const-correct:
- bus->setChannelMemory(0, buffer, numberOfSourceFrames);
+ m_internalBus->setChannelMemory(0, buffer, numberOfSourceFrames);
- m_sourceProvider->provideInput(bus.get(), numberOfSourceFrames);
+ m_sourceProvider->provideInput(m_internalBus.get(), numberOfSourceFrames);
}
namespace {
Modified: trunk/Source/WebCore/platform/audio/SincResampler.h (251248 => 251249)
--- trunk/Source/WebCore/platform/audio/SincResampler.h 2019-10-17 18:18:56 UTC (rev 251248)
+++ trunk/Source/WebCore/platform/audio/SincResampler.h 2019-10-17 18:19:03 UTC (rev 251249)
@@ -31,6 +31,7 @@
#include "AudioArray.h"
#include "AudioSourceProvider.h"
+#include <wtf/RefPtr.h>
namespace WebCore {
@@ -80,6 +81,8 @@
// The buffer is primed once at the very beginning of processing.
bool m_isBufferPrimed;
+
+ RefPtr<AudioBus> m_internalBus;
};
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes