RESOLVED FIXED 166886
[GStreamer] Use smart pointers and modernize code in WebKitWebAudioSourceGStreamer
https://bugs.webkit.org/show_bug.cgi?id=166886
Summary [GStreamer] Use smart pointers and modernize code in WebKitWebAudioSourceGStr...
Carlos Garcia Campos
Reported 2017-01-10 03:35:17 PST
While debugging bug #166884 I ended up cleaning up the code a bit to be able to follow it, and also made it use smart pointers to ensure we were not leaking refs/memory.
Attachments
Patch (16.49 KB, patch)
2017-01-10 03:39 PST, Carlos Garcia Campos
calvaris: review-
Updated patch (16.15 KB, patch)
2017-01-11 02:01 PST, Carlos Garcia Campos
calvaris: review+
Carlos Garcia Campos
Comment 1 2017-01-10 03:39:33 PST
Xabier Rodríguez Calvar
Comment 2 2017-01-10 06:19:10 PST
Comment on attachment 298454 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=298454&action=review > Source/WebCore/ChangeLog:9 > + smart pointers, uses WTF::Vactor instead of GSList and simplifies the code to map/unmap GstBuffers. WTF:Vector > Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:353 > + auto& buffer = channelBufferList[i]; Specify the type, please > Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:362 > + auto& appsrc = priv->sources[i]; Specify the type, please > Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:403 > + src->priv->pool = adoptGRef(gst_buffer_pool_new()); gst_buffer_pool_new returns a floating reference. According to the defined adoptGRef for this time, this should trigger the ASSERT. Not adopting is ok here. Actually in line 221 a similar thing is done correctly.
Carlos Garcia Campos
Comment 3 2017-01-10 06:23:57 PST
Comment on attachment 298454 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=298454&action=review >> Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:353 >> + auto& buffer = channelBufferList[i]; > > Specify the type, please why? >> Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:362 >> + auto& appsrc = priv->sources[i]; > > Specify the type, please why? >> Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:403 >> + src->priv->pool = adoptGRef(gst_buffer_pool_new()); > > gst_buffer_pool_new returns a floating reference. According to the defined adoptGRef for this time, this should trigger the ASSERT. > > Not adopting is ok here. > > Actually in line 221 a similar thing is done correctly. Right!
Carlos Garcia Campos
Comment 4 2017-01-11 02:01:49 PST
Created attachment 298561 [details] Updated patch
Xabier Rodríguez Calvar
Comment 5 2017-01-11 02:19:54 PST
(In reply to comment #3) > >> Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:353 > >> + auto& buffer = channelBufferList[i]; > > > > Specify the type, please > > why? > > >> Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:362 > >> + auto& appsrc = priv->sources[i]; > > > > Specify the type, please > > why? Cause I thought it was better for readability, but given the latest discussions on -dev and -reviewers it does not matter anymore.
Carlos Garcia Campos
Comment 6 2017-01-11 03:28:53 PST
Note You need to log in before you can comment on or make changes to this bug.