Bug 113875 - [Gstreamer] Avoid calls to g_slist_nth_data in webKitWebAudioSrcLoop()
Summary: [Gstreamer] Avoid calls to g_slist_nth_data in webKitWebAudioSrcLoop()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-03 07:15 PDT by Chris Dumez
Modified: 2013-04-24 01:22 PDT (History)
8 users (show)

See Also:


Attachments
Patch (2.35 KB, patch)
2013-04-03 07:19 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (2.37 KB, patch)
2013-04-03 07:41 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 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'.
Comment 1 Chris Dumez 2013-04-03 07:19:30 PDT
Created attachment 196347 [details]
Patch
Comment 2 Philippe Normand 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?
Comment 3 Chris Dumez 2013-04-03 07:41:03 PDT
Created attachment 196350 [details]
Patch

Use g_slist_next().
Comment 4 Philippe Normand 2013-04-03 07:44:52 PDT
Comment on attachment 196350 [details]
Patch

Ok
Comment 5 WebKit Review Bot 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>
Comment 6 WebKit Review Bot 2013-04-03 08:07:36 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Praveen Jadhav 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.
Comment 8 Philippe Normand 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?
Comment 9 Praveen Jadhav 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)
Comment 10 Philippe Normand 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.
Comment 11 Chris Dumez 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?
Comment 12 Philippe Normand 2013-04-24 00:15:50 PDT
Perhaps use g_slist_index()
Comment 13 Praveen Jadhav 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. :-)
Comment 14 Chris Dumez 2013-04-24 01:22:44 PDT
gstreamer 0.10 build fix landed in <http://trac.webkit.org/changeset/149021>.