RESOLVED LATER140116
[GStreamer][MSE] ASSERT in MediaSourceGStreamer::addSourceBuffer
https://bugs.webkit.org/show_bug.cgi?id=140116
Summary [GStreamer][MSE] ASSERT in MediaSourceGStreamer::addSourceBuffer
Philippe Normand
Reported 2015-01-06 02:09:55 PST
ASSERTION FAILED: !m_adoptionIsRequired 0x00007fffed2980a8 in WTFCrash () at ../../Source/WTF/wtf/Assertions.cpp:321 321 *(int *)(uintptr_t)0xbbadbeef = 0; (gdb) bt #0 0x00007fffed2980a8 in WTFCrash () at ../../Source/WTF/wtf/Assertions.cpp:321 #1 0x00007ffff272740e in WTF::RefCountedBase::ref (this=0x7fff52867e78) at ../../Source/WTF/wtf/RefCounted.h:45 #2 0x00007ffff3eeabdb in WTF::refIfNotNull<WebCore::SourceBufferPrivateGStreamer> (ptr=0x7fff52867e70) at ../../Source/WTF/wtf/PassRefPtr.h:36 #3 0x00007ffff3eea93f in WTF::RefPtr<WebCore::SourceBufferPrivateGStreamer>::RefPtr (this=0x7fffffffc1e0, ptr=0x7fff52867e70) at ../../Source/WTF/wtf/RefPtr.h:43 #4 0x00007ffff3eea235 in WebCore::MediaSourceGStreamer::addSourceBuffer (this=0x7fff5283cc80, contentType=..., sourceBufferPrivate=...) at ../../Source/WebCore/platform/graphics/gstreamer/MediaSourceGStreamer.cpp:66 #5 0x00007ffff2c206d8 in WebCore::MediaSource::createSourceBufferPrivate (this=0x7fff527c4c60, type=..., ec=@0x7fffffffc39c: 0) at ../../Source/WebCore/Modules/mediasource/MediaSource.cpp:850 #6 0x00007ffff2c1f534 in WebCore::MediaSource::addSourceBuffer (this=0x7fff527c4c60, type="audio/mp4; codecs=\"mp4a.40.2\"", ec=@0x7fffffffc39c: 0) at ../../Source/WebCore/Modules/mediasource/MediaSource.cpp:541 #7 0x00007ffff3fd07e7 in WebCore::jsMediaSourcePrototypeFunctionAddSourceBuffer (exec=0x7fffffffc420) at DerivedSources/WebCore/JSMediaSource.cpp:304 #8 0x00007fff9b2e80b4 in ?? () #9 0x00007fffffffc490 in ?? () #10 0x00007fffed2403a7 in llint_entry () from /home/phil/WebKit/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18 Backtrace stopped: frame did not save the PC
Attachments
patch (5.43 KB, patch)
2015-01-06 02:55 PST, Philippe Normand
no flags
patch (5.50 KB, patch)
2015-01-06 02:58 PST, Philippe Normand
no flags
patch (6.06 KB, patch)
2015-01-06 05:36 PST, Philippe Normand
no flags
patch (12.56 KB, patch)
2015-01-06 06:43 PST, Philippe Normand
no flags
patch (12.56 KB, patch)
2015-01-06 06:54 PST, Philippe Normand
no flags
patch (13.05 KB, patch)
2015-01-08 08:45 PST, Philippe Normand
no flags
Philippe Normand
Comment 1 2015-01-06 02:11:15 PST
Sebastian fixed in his patch for Bug 140078, I'll upload the fix based on his patch here.
Philippe Normand
Comment 2 2015-01-06 02:55:51 PST
Philippe Normand
Comment 3 2015-01-06 02:58:26 PST
Sebastian Dröge (slomo)
Comment 4 2015-01-06 03:54:30 PST
Seems good to me obviously ;) Thanks for extracting that part from my huge patch!
Philippe Normand
Comment 5 2015-01-06 05:36:45 PST
Philippe Normand
Comment 6 2015-01-06 05:40:18 PST
Comment on attachment 244054 [details] patch oops this is incomplete.
Philippe Normand
Comment 7 2015-01-06 06:43:57 PST
WebKit Commit Bot
Comment 8 2015-01-06 06:46:54 PST
Attachment 244057 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/gstreamer/MediaSourceGStreamer.cpp:40: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 1 in 7 files If any of these errors are false positives, please file a bug against check-webkit-style.
Philippe Normand
Comment 9 2015-01-06 06:54:55 PST
Carlos Garcia Campos
Comment 10 2015-01-08 02:41:43 PST
Comment on attachment 244058 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=244058&action=review > Source/WebCore/platform/graphics/gstreamer/MediaSourceGStreamer.cpp:65 > + for (auto it = m_sourceBuffers.begin(), end = m_sourceBuffers.end(); it != end; ++it) > + (*it)->clearMediaSource(); This could be for (auto& sourceBuffer : m_sourceBuffers) sourceBuffer.clearMediaSource(); > Source/WebCore/platform/graphics/gstreamer/MediaSourceGStreamer.cpp:79 > + return m_client->addSourceBuffer(m_sourceBuffers.last(), contentType); You could use sourceBufferPrivate.get() here instead of calling last() again. > Source/WebCore/platform/graphics/gstreamer/MediaSourceGStreamer.cpp:87 > + size_t index = m_sourceBuffers.find(buffer); > + m_sourceBuffers.remove(index); Shouldn't you also call clearMediaSource() here? Since it's removed from the vector here, it won't be called for this source bufer in the destructor. Since the order doesn't really matter, and we are always adding a new SourceBufferPrivateGStreamer, I wonder whether we could use a HashSet instead, and here you would just take the buffer can call clearMediaSource (if it's actually needed) > Source/WebCore/platform/graphics/gstreamer/MediaSourceGStreamer.h:50 > + MediaSourceClientGStreamer* client() const { return m_client.get(); } Since m_client can't be null, you could return a reference instead.
Zan Dobersek
Comment 11 2015-01-08 03:17:35 PST
Comment on attachment 244058 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=244058&action=review > Source/WebCore/platform/graphics/gstreamer/SourceBufferPrivateGStreamer.cpp:68 > + SourceBufferPrivateClient::AppendResult result = m_mediaSource->client()->append(this, data, length); Not in the scope of this bug, but MediaSourceClientGStreamer::append() doesn't have to operate on a PassRefPtr<SourceBufferPrivate> -- a simple reference to the SourceBufferPrivate object would do. > Source/WebCore/platform/graphics/gstreamer/SourceBufferPrivateGStreamer.cpp:85 > + m_mediaSource->client()->removedFromMediaSource(this); Same here, MediaSourceClientGStreamer::removedFromMediaSource() could operate with a reference to the SourceBufferPrivate object.
Philippe Normand
Comment 12 2015-01-08 03:30:45 PST
(In reply to comment #11) > Comment on attachment 244058 [details] > patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=244058&action=review > > > Source/WebCore/platform/graphics/gstreamer/SourceBufferPrivateGStreamer.cpp:68 > > + SourceBufferPrivateClient::AppendResult result = m_mediaSource->client()->append(this, data, length); > > Not in the scope of this bug, but MediaSourceClientGStreamer::append() > doesn't have to operate on a PassRefPtr<SourceBufferPrivate> -- a simple > reference to the SourceBufferPrivate object would do. > > > Source/WebCore/platform/graphics/gstreamer/SourceBufferPrivateGStreamer.cpp:85 > > + m_mediaSource->client()->removedFromMediaSource(this); > > Same here, MediaSourceClientGStreamer::removedFromMediaSource() could > operate with a reference to the SourceBufferPrivate object. Right, I think I'll fix this in a separate patch. Thanks for pointing it out!
Philippe Normand
Comment 13 2015-01-08 08:45:43 PST
Carlos Garcia Campos
Comment 14 2015-01-09 02:47:05 PST
Comment on attachment 244262 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=244262&action=review > Source/WebCore/platform/graphics/gstreamer/MediaSourceGStreamer.cpp:79 > + RefPtr<SourceBufferPrivateGStreamer> buffer = SourceBufferPrivateGStreamer::create(this); > + m_sourceBuffers.add(buffer.get()); > + sourceBufferPrivate = buffer; I'm confused about the ownership now. In the previous patch you kept a reference in the Vector, why are you using raw pointers now? Is removeSourceBuffer always called before the SourceBufferPrivate object is deleted? > Source/WebCore/platform/graphics/gstreamer/SourceBufferPrivateGStreamer.cpp:86 > + m_mediaSource->removeSourceBuffer(this); > + m_mediaSource->client().removedFromMediaSource(this); hmm, now that I see this. It looks a bit weird to me that MediaSourceGStreamer::addSourceBuffer() calls MediaSourceClientGStreamer::addSourceBuffer() but removedFromMediaSource is called here instead of in MediaSourceGStreamer::removeSourceBuffer(). Also why does MediaSourceClientGStreamer::removedFromMediaSource() receive a PassRefPtr?
Philippe Normand
Comment 15 2015-12-09 00:14:05 PST
This likely isn't going to apply to the reworked MSE backend.
Note You need to log in before you can comment on or make changes to this bug.