WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
172427
[GStreamerGL] Release GstVideoFrame when there is a flush event from the pipeline
https://bugs.webkit.org/show_bug.cgi?id=172427
Summary
[GStreamerGL] Release GstVideoFrame when there is a flush event from the pipe...
Gwang Yoon Hwang
Reported
2017-05-21 07:20:51 PDT
[GStreamerGL] Release GstVideoFrame when there is a flush event from the pipeline
Attachments
Patch
(24.38 KB, patch)
2017-05-21 07:21 PDT
,
Gwang Yoon Hwang
no flags
Details
Formatted Diff
Diff
Patch
(25.87 KB, patch)
2017-06-02 08:09 PDT
,
Gwang Yoon Hwang
no flags
Details
Formatted Diff
Diff
Patch
(28.43 KB, patch)
2017-06-07 04:31 PDT
,
Gwang Yoon Hwang
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Gwang Yoon Hwang
Comment 1
2017-05-21 07:21:51 PDT
Created
attachment 310807
[details]
Patch
Gwang Yoon Hwang
Comment 2
2017-06-02 08:09:27 PDT
Created
attachment 311826
[details]
Patch
Gwang Yoon Hwang
Comment 3
2017-06-02 08:10:43 PDT
(In reply to Gwang Yoon Hwang from
comment #2
)
> Created
attachment 311826
[details]
> Patch
Fixed a memory leak while handling flush event from the gst pipeline.
Zan Dobersek
Comment 4
2017-06-05 06:27:40 PDT
Comment on
attachment 311826
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=311826&action=review
> Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:151 > +void TextureMapperPlatformLayerProxy::appendToUnusedBuffers(std::unique_ptr<TextureMapperPlatformLayerBuffer> buffer) > +{ > + ASSERT(m_compositorThreadID == WTF::currentThread()); > + RunLoop::main().dispatch([this, protectedThis = makeRef(*this), buffer = WTFMove(buffer)] () mutable { > + m_usedBuffers.append(WTFMove(buffer)); > + scheduleReleaseUnusedBuffers(); > + }); > +}
Why does this have to be handled on the main thread?
Gwang Yoon Hwang
Comment 5
2017-06-05 06:57:01 PDT
Comment on
attachment 311826
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=311826&action=review
>> Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:151 >> +} > > Why does this have to be handled on the main thread?
AFAIU, RunLoop::TimerBase::start is not thread safe, no?
Zan Dobersek
Comment 6
2017-06-05 08:49:20 PDT
Comment on
attachment 311826
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=311826&action=review
>>> Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:151 >>> +} >> >> Why does this have to be handled on the main thread? > > AFAIU, RunLoop::TimerBase::start is not thread safe, no?
Internally it is due to GSource being used underneath. But even externally, it's protected through m_lock. There's other problems in this class related to this, for instance the timer shouldn't be scheduled if the Proxy object isn't active anymore, otherwise the object can be destructed on one thread while releaseUnusedBuffersTimerFired() runs on a different thread. But this shouldn't need to dispatch to any other thread.
Michael Catanzaro
Comment 7
2017-06-05 09:10:44 PDT
(In reply to Zan Dobersek from
comment #6
)
> There's other problems in this class related to this, for instance the timer > shouldn't be scheduled if the Proxy object isn't active anymore, otherwise > the object can be destructed on one thread while > releaseUnusedBuffersTimerFired() runs on a different thread. But this > shouldn't need to dispatch to any other thread.
Will you handle making another bug report to make sure this doesn't get forgotten?
Gwang Yoon Hwang
Comment 8
2017-06-07 04:31:23 PDT
Created
attachment 312177
[details]
Patch
Gwang Yoon Hwang
Comment 9
2017-06-07 04:41:10 PDT
(In reply to Zan Dobersek from
comment #6
)
> Comment on
attachment 311826
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=311826&action=review
> > >>> Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:151 > >>> +} > >> > >> Why does this have to be handled on the main thread? > > > > AFAIU, RunLoop::TimerBase::start is not thread safe, no? > > Internally it is due to GSource being used underneath. But even externally, > it's protected through m_lock. >
It is correct. Since PlatformLayerProxy uses locks to protect runLoop, it is thread-safe. It is a side-topic, but we doesn't use locks in RunLoop::TimerBase::start while updating m_fireInterval and m_isRepeating. I think it is not thread safe at this point.
https://github.com/WebKit/webkit/blob/master/Source/WTF/wtf/glib/RunLoopGLib.cpp#L204
Anyway, I modified to fire the timer in compositing thread, also I changed release timer to be attached to the compositing run loop. Now all operations about m_usedBuffers works on the compositing thread.
> There's other problems in this class related to this, for instance the timer > shouldn't be scheduled if the Proxy object isn't active anymore, otherwise > the object can be destructed on one thread while > releaseUnusedBuffersTimerFired() runs on a different thread. But this > shouldn't need to dispatch to any other thread.
I thought a bit more deeper about this problem. But when the proxy became invalidated, we removes and stops all timers and then destructs objects on the compositing thread, so I think it is quite okay at this point. But still needs improvements, regarding ::getAvailableBuffers, I made a patch to use the TexmapGL's bitmap texture pool, so it can be handled at different bug.
WebKit Commit Bot
Comment 10
2017-06-13 01:29:10 PDT
Comment on
attachment 312177
[details]
Patch Clearing flags on attachment: 312177 Committed
r218170
: <
http://trac.webkit.org/changeset/218170
>
WebKit Commit Bot
Comment 11
2017-06-13 01:29:11 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug