[Title] [CherryPick] g_slist_reverse() may not be required in webKitWebAudioSrcLoop
[Issues] N/A
[Problem] WebAudio performance optimization patch
[Solution] Cherry picked.
[Cherry-Picker] Praveen R Jadhav <praveen.j@samsung.com>
g_slist_reverse() may not be required in webKitWebAudioSrcLoop
https://bugs.webkit.org/show_bug.cgi?id=113568
Patch by Praveen R Jadhav <praveen.j@samsung.com> on 2013-03-30
Reviewed by Philippe Normand.
Decremental 'for' loop logic implemented to avoid using g_slist_reverse().
Original code - 2.025230 micro seconds per loop
Original code + patch - 1.964759 micro seconds per loop
This patch is covered by existing webaudio tests.
* platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
(webKitWebAudioSrcLoop):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@147278
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
Conflicts:
Source/WebCore/ChangeLog
Change-Id: Iaba2cef05405b383adba5dc9f9e11f8eea72f704
GSList* channelBufferList = 0;
unsigned bufferSize = priv->framesToPull * sizeof(float);
- for (unsigned i = 0; i < g_slist_length(priv->pads); i++) {
+ for (int i = g_slist_length(priv->pads) - 1; i >= 0; i--) {
GstBuffer* channelBuffer = gst_buffer_new_and_alloc(bufferSize);
ASSERT(channelBuffer);
channelBufferList = g_slist_prepend(channelBufferList, channelBuffer);
priv->bus->setChannelMemory(i, reinterpret_cast<float*>(GST_BUFFER_DATA(channelBuffer)), priv->framesToPull);
#endif
}
- channelBufferList = g_slist_reverse(channelBufferList);
// FIXME: Add support for local/live audio input.
priv->provider->render(0, priv->bus, priv->framesToPull);
- for (unsigned i = 0; i < g_slist_length(priv->pads); i++) {
+ for (int i = g_slist_length(priv->pads) - 1; i >= 0; i--) {
GstPad* pad = static_cast<GstPad*>(g_slist_nth_data(priv->pads, i));
GstBuffer* channelBuffer = static_cast<GstBuffer*>(g_slist_nth_data(channelBufferList, i));