Bug 166886 - [GStreamer] Use smart pointers and modernize code in WebKitWebAudioSourceGStreamer
Summary: [GStreamer] Use smart pointers and modernize code in WebKitWebAudioSourceGStr...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on:
Blocks:
 
Reported: 2017-01-10 03:35 PST by Carlos Garcia Campos
Modified: 2017-01-11 03:28 PST (History)
3 users (show)

See Also:


Attachments
Patch (16.49 KB, patch)
2017-01-10 03:39 PST, Carlos Garcia Campos
calvaris: review-
Details | Formatted Diff | Diff
Updated patch (16.15 KB, patch)
2017-01-11 02:01 PST, Carlos Garcia Campos
calvaris: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 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.
Comment 1 Carlos Garcia Campos 2017-01-10 03:39:33 PST
Created attachment 298454 [details]
Patch
Comment 2 Xabier Rodríguez Calvar 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.
Comment 3 Carlos Garcia Campos 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!
Comment 4 Carlos Garcia Campos 2017-01-11 02:01:49 PST
Created attachment 298561 [details]
Updated patch
Comment 5 Xabier Rodríguez Calvar 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.
Comment 6 Carlos Garcia Campos 2017-01-11 03:28:53 PST
Committed r210584: <http://trac.webkit.org/changeset/210584>