Title: [147555] trunk/Source/WebCore
- Revision
- 147555
- Author
- [email protected]
- Date
- 2013-04-03 08:09:06 -0700 (Wed, 03 Apr 2013)
Log Message
[Gstreamer] Avoid calls to g_slist_nth_data in webKitWebAudioSrcLoop()
https://bugs.webkit.org/show_bug.cgi?id=113875
Reviewed by Philippe Normand.
webKitWebAudioSrcLoop() was iterating over 2 GSLists by using a counter and then
calling g_slist_nth_data() to get the element of each GSList. This is inefficient
because calling g_slist_nth_data() will iterate the GSList up until index 'n'.
This patch improves this by keeping pointers to the current element of each list
while iterating, so that we can simply use g_slist_next() to iterate instead
of g_slist_nth_data().
No new tests, no behavior change.
* platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
(webKitWebAudioSrcLoop):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (147554 => 147555)
--- trunk/Source/WebCore/ChangeLog 2013-04-03 15:04:28 UTC (rev 147554)
+++ trunk/Source/WebCore/ChangeLog 2013-04-03 15:09:06 UTC (rev 147555)
@@ -1,3 +1,23 @@
+2013-04-03 Christophe Dumez <[email protected]>
+
+ [Gstreamer] Avoid calls to g_slist_nth_data in webKitWebAudioSrcLoop()
+ https://bugs.webkit.org/show_bug.cgi?id=113875
+
+ Reviewed by Philippe Normand.
+
+ webKitWebAudioSrcLoop() was iterating over 2 GSLists by using a counter and then
+ calling g_slist_nth_data() to get the element of each GSList. This is inefficient
+ because calling g_slist_nth_data() will iterate the GSList up until index 'n'.
+
+ This patch improves this by keeping pointers to the current element of each list
+ while iterating, so that we can simply use g_slist_next() to iterate instead
+ of g_slist_nth_data().
+
+ No new tests, no behavior change.
+
+ * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
+ (webKitWebAudioSrcLoop):
+
2013-04-03 Keishi Hattori <[email protected]>
Actions that require user gesture don't work in window.showModalDialog in Chromium
Modified: trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp (147554 => 147555)
--- trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp 2013-04-03 15:04:28 UTC (rev 147554)
+++ trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp 2013-04-03 15:09:06 UTC (rev 147555)
@@ -372,9 +372,11 @@
// FIXME: Add support for local/live audio input.
priv->provider->render(0, priv->bus, priv->framesToPull);
- 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));
+ GSList* padsIt;
+ GSList* buffersIt;
+ for (padsIt = priv->pads, buffersIt = channelBufferList; padsIt && buffersIt; padsIt = g_slist_next(padsIt), buffersIt = g_slist_next(buffersIt)) {
+ GstPad* pad = static_cast<GstPad*>(padsIt->data);
+ GstBuffer* channelBuffer = static_cast<GstBuffer*>(buffersIt->data);
#ifndef GST_API_VERSION_1
GRefPtr<GstCaps> monoCaps = adoptGRef(getGStreamerMonoAudioCaps(priv->sampleRate));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes