RESOLVED FIXED 113875
[Gstreamer] Avoid calls to g_slist_nth_data in webKitWebAudioSrcLoop()
https://bugs.webkit.org/show_bug.cgi?id=113875
Summary [Gstreamer] Avoid calls to g_slist_nth_data in webKitWebAudioSrcLoop()
Chris Dumez
Reported 2013-04-03 07:15:02 PDT
In webKitWebAudioSrcLoop(), we iterate 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'.
Attachments
Patch (2.35 KB, patch)
2013-04-03 07:19 PDT, Chris Dumez
no flags
Patch (2.37 KB, patch)
2013-04-03 07:41 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2013-04-03 07:19:30 PDT
Philippe Normand
Comment 2 2013-04-03 07:28:30 PDT
Comment on attachment 196347 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=196347&action=review > Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:377 > + for (padsIt = priv->pads, buffersIt = channelBufferList; padsIt && buffersIt; padsIt = padsIt->next, buffersIt = buffersIt->next) { Use g_slist_next() perhaps?
Chris Dumez
Comment 3 2013-04-03 07:41:03 PDT
Created attachment 196350 [details] Patch Use g_slist_next().
Philippe Normand
Comment 4 2013-04-03 07:44:52 PDT
Comment on attachment 196350 [details] Patch Ok
WebKit Review Bot
Comment 5 2013-04-03 08:07:32 PDT
Comment on attachment 196350 [details] Patch Clearing flags on attachment: 196350 Committed r147555: <http://trac.webkit.org/changeset/147555>
WebKit Review Bot
Comment 6 2013-04-03 08:07:36 PDT
All reviewed patches have been landed. Closing bug.
Praveen Jadhav
Comment 7 2013-04-23 23:56:29 PDT
This patch causes build error with gstreamer-0.10. Maybe including these changes under GST_API_VERSION_1 should be good in my opinion.
Philippe Normand
Comment 8 2013-04-24 00:02:19 PDT
That patch doesn't use any GStreamer 1.x-only API, I think. Can you please post the error message?
Praveen Jadhav
Comment 9 2013-04-24 00:09:12 PDT
Its because of the variable 'i' in line no. 384. which was removed in this patch. /home/praveen.j/Git_WebKit/WebKit/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp: In function ‘void webKitWebAudioSrcLoop(WebKitWebAudioSrc*)’: /home/praveen.j/Git_WebKit/WebKit/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:384:90: error: name lookup of ‘i’ changed for ISO ‘for’ scoping [-fpermissive] /home/praveen.j/Git_WebKit/WebKit/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:384:90: note: (if you use ‘-fpermissive’ G++ will accept your code)
Philippe Normand
Comment 10 2013-04-24 00:11:12 PDT
So this is unrelated with GStreamer 1.x. But feel free to file a patch in a separate bug.
Chris Dumez
Comment 11 2013-04-24 00:13:07 PDT
(In reply to comment #9) > Its because of the variable 'i' in line no. 384. which was removed in this patch. > > /home/praveen.j/Git_WebKit/WebKit/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp: In function ‘void webKitWebAudioSrcLoop(WebKitWebAudioSrc*)’: > /home/praveen.j/Git_WebKit/WebKit/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:384:90: error: name lookup of ‘i’ changed for ISO ‘for’ scoping [-fpermissive] > /home/praveen.j/Git_WebKit/WebKit/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:384:90: note: (if you use ‘-fpermissive’ G++ will accept your code) Right, then the proper fix it to add the i counter under #ifndef GST_API_VERSION_1. Do you want to do it or should I?
Philippe Normand
Comment 12 2013-04-24 00:15:50 PDT
Perhaps use g_slist_index()
Praveen Jadhav
Comment 13 2013-04-24 00:27:15 PDT
How about moving setcaps related code to the first "for" loop in the function a(In reply to comment #11) > (In reply to comment #9) > > Its because of the variable 'i' in line no. 384. which was removed in this patch. > > > > /home/praveen.j/Git_WebKit/WebKit/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp: In function ‘void webKitWebAudioSrcLoop(WebKitWebAudioSrc*)’: > > /home/praveen.j/Git_WebKit/WebKit/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:384:90: error: name lookup of ‘i’ changed for ISO ‘for’ scoping [-fpermissive] > > /home/praveen.j/Git_WebKit/WebKit/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:384:90: note: (if you use ‘-fpermissive’ G++ will accept your code) > > Right, then the proper fix it to add the i counter under #ifndef GST_API_VERSION_1. Do you want to do it or should I? How about moving setcaps related code to first "for" loop and retain your changes as it is? You may please continue with the checkin. :-)
Chris Dumez
Comment 14 2013-04-24 01:22:44 PDT
gstreamer 0.10 build fix landed in <http://trac.webkit.org/changeset/149021>.
Note You need to log in before you can comment on or make changes to this bug.