[Webkit-unassigned] [Bug 51424] Add WebKitClient::createAudioDevice() for Chromium port of web audio API

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Dec 21 16:36:10 PST 2010


https://bugs.webkit.org/show_bug.cgi?id=51424





--- Comment #7 from Chris Rogers <crogers at google.com>  2010-12-21 16:36:09 PST ---
(From update of attachment 77154)
View in context: https://bugs.webkit.org/attachment.cgi?id=77154&action=review

>> WebKit/chromium/public/WebAudioDevice.h:45
>> +    typedef void (*RenderCallback)(std::vector<float*>& audioData, size_t numberOfFrames, void* userData);
> 
> note: we do not use STL types in the WebKit API.  please use WebVector, or just use a raw float* here.  do you need the callee to allocate the audioData buffer, or will it be preallocated to the maximum size by the caller?  if it will be preallocated, then passing a raw float* would seem fine.

FIXED: I switched over to WebVector.  I can't use raw float* since it's an array of pointers to float (planar non-interleaved)

>> WebKit/chromium/public/WebKitClient.h:282
>> +    virtual WebAudioDevice* createAudioDevice(size_t bufferSize, unsigned numberOfChannels, double sampleRate, WebAudioDevice::RenderCallback, void* userData) { return 0; }
> 
> nit: add a new line below the section header.
> 
> The C++ way of passing user data to a function pointer is to define an interface
> that folks can subclass.  Why not do that here?
> 
> class WebAudioRenderCallback {
> public:
>     virtual void renderFrames(float* audioData, size_t numberOfFrames) = 0;
> protected:
>     virtual ~WebAudioRenderCallback() {}
> };
> 
> or you could also do this as an inner class:
> 
> class WebAudioDevice {
> public:
>     class RenderCallback {
>     public:
>         ...
>     };
> };
> 
> however the downside to it being an inner class is that you force WebKitClient.h
> to also #include WebAudioDevice.h.  it would be nice to avoid that.

FIXED: added the new line and changed this to use an inner class as you suggest instead of old-fashioned callback

>> WebKit/chromium/src/AudioDestinationChromium.cpp:40
>> +using namespace std;
> 
> please avoid using the "std" namespace for container types in webkit code.

FIXED

>> WebKit/chromium/src/AudioDestinationChromium.cpp:41
>> +using WebKit::webKitClient;
> 
> it is more commonplace to just do "using namespace WebKit" in WebKit code.

FIXED

>> WebKit/chromium/src/AudioDestinationChromium.cpp:102
>> +void AudioDestinationChromium::renderDispatch(vector<float*>& audioData, size_t numberOfFrames, void* userData)
> 
> if you define an interface for the render callback function, then you would
> not need to implement this thunk function yourself.

FIXED

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list