Bug 229123 - REGRESSION(r278981): [GStreamer][Debug] Assert crashes when running media/track tests
Summary: REGRESSION(r278981): [GStreamer][Debug] Assert crashes when running media/tra...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Philippe Normand
URL:
Keywords: InRadar
Depends on: 229144 229159
Blocks:
  Show dependency treegraph
 
Reported: 2021-08-15 09:40 PDT by Philippe Normand
Modified: 2021-08-17 03:16 PDT (History)
13 users (show)

See Also:


Attachments
Patch (31.47 KB, patch)
2021-08-15 10:09 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff
Patch (34.79 KB, patch)
2021-08-16 04:18 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff
Patch (35.08 KB, patch)
2021-08-16 09:30 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff
[fast-cq] Patch (2.79 KB, patch)
2021-08-17 01:30 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Normand 2021-08-15 09:40:44 PDT
For instance media/track/track-manual-mode.html:

ASSERTION FAILED: streamId == track->id()

Thread 1 (Thread 0x7faf5b2bfec0 (LWP 129)):
#0  0x00007faf61eb1a9e in WTFCrash() () at ../../Source/WTF/wtf/Assertions.cpp:321
#1  0x00007faf650f37db in WTFCrashWithInfo(int, char const*, char const*, int) () at WTF/Headers/wtf/Assertions.h:703
#2  0x00007faf6a8c676f in WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfTrack<WebCore::InbandTextTrackPrivateGStreamer>() (this=0x7faeefed8400) at ../../Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1079
#3  0x00007faf6a8abe38 in WebCore::MediaPlayerPrivateGStreamer::textChangedCallback(WebCore::MediaPlayerPrivateGStreamer*)::$_2::operator()() const (this=0x7faeefe16028) at ../../Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1139
#4  0x00007faf6a8ac1de in WTF::Detail::CallableWrapper<WebCore::MediaPlayerPrivateGStreamer::textChangedCallback(WebCore::MediaPlayerPrivateGStreamer*)::$_2, void>::call() (this=0x7faeefe16020) at WTF/Headers/wtf/Function.h:53
#5  0x00007faf65167722 in WTF::Function<void ()>::operator()() const (this=0x7faeefe15070) at WTF/Headers/wtf/Function.h:82
#6  0x00007faf6a8acaae in WebCore::MainThreadNotifier<WebCore::MediaPlayerPrivateGStreamer::MainThreadNotification>::notify<WebCore::MediaPlayerPrivateGStreamer::textChangedCallback(WebCore::MediaPlayerPrivateGStreamer*)::$_2>(WebCore::MediaPlayerPrivateGStreamer::MainThreadNotification, WebCore::MediaPlayerPrivateGStreamer::textChangedCallback(WebCore::MediaPlayerPrivateGStreamer*)::$_2&&)::{lambda()#1}::operator()() const (this=0x7faeefe15058) at ../../Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h:64
#7  0x00007faf6a8aca0e in WTF::Detail::CallableWrapper<WebCore::MainThreadNotifier<WebCore::MediaPlayerPrivateGStreamer::MainThreadNotification>::notify<WebCore::MediaPlayerPrivateGStreamer::textChangedCallback(WebCore::MediaPlayerPrivateGStreamer*)::$_2>(WebCore::MediaPlayerPrivateGStreamer::MainThreadNotification, WebCore::MediaPlayerPrivateGStreamer::textChangedCallback(WebCore::MediaPlayerPrivateGStreamer*)::$_2&&)::{lambda()#1}, void>::call() (this=0x7faeefe15050) at WTF/Headers/wtf/Function.h:53
#8  0x00007faf60530d12 in WTF::Function<void ()>::operator()() const (this=0x7ffcf69b1540) at WTF/Headers/wtf/Function.h:82
#9  0x00007faf61f07270 in WTF::RunLoop::performWork() (this=0x7faf5a9f9000) at ../../Source/WTF/wtf/RunLoop.cpp:133
#10 0x00007faf61fbc65c in WTF::RunLoop::RunLoop()::$_1::operator()(void*) const (this=0x7faf5a9f9000, userData=0x7faf5a9f9000) at ../../Source/WTF/wtf/glib/RunLoopGLib.cpp:80
#11 0x00007faf61fbc635 in WTF::RunLoop::RunLoop()::$_1::__invoke(void*) (userData=0x7faf5a9f9000) at ../../Source/WTF/wtf/glib/RunLoopGLib.cpp:79
#12 0x00007faf61fbc5e9 in WTF::RunLoop::$_0::operator()(_GSource*, int (*)(void*), void*) const (this=0x2377af0, source=0x2377af0, callback=0x7faf61fbc620 <WTF::RunLoop::RunLoop()::$_1::__invoke(void*)>, userData=0x7faf5a9f9000) at ../../Source/WTF/wtf/glib/RunLoopGLib.cpp:53
#13 0x00007faf61fbb665 in WTF::RunLoop::$_0::__invoke(_GSource*, int (*)(void*), void*) (source=0x2377af0, callback=0x7faf61fbc620 <WTF::RunLoop::RunLoop()::$_1::__invoke(void*)>, userData=0x7faf5a9f9000) at ../../Source/WTF/wtf/glib/RunLoopGLib.cpp:45
#14 0x00007faf5d9e82bf in g_main_dispatch (context=0x2340950) at ../glib/gmain.c:3344
#15 g_main_context_dispatch (context=0x2340950) at ../glib/gmain.c:4062
#16 0x00007faf5d9e8668 in g_main_context_iterate (context=0x2340950, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4138
#17 0x00007faf5d9e8983 in g_main_loop_run (loop=0x22baa60) at ../glib/gmain.c:4336
#18 0x00007faf61fbbc98 in WTF::RunLoop::run() () at ../../Source/WTF/wtf/glib/RunLoopGLib.cpp:108
#19 0x00007faf667c8ef4 in WebKit::AuxiliaryProcessMainBase<WebKit::WebProcess, true>::run(int, char**) (this=0x7ffcf69b1820, argc=4, argv=0x7ffcf69b19d8) at ../../Source/WebKit/Shared/AuxiliaryProcessMain.h:70
#20 0x00007faf667b9ab0 in WebKit::AuxiliaryProcessMain<WebKit::WebProcessMainGtk>(int, char**) (argc=4, argv=0x7ffcf69b19d8) at ../../Source/WebKit/Shared/AuxiliaryProcessMain.h:96
#21 0x00007faf667b683a in WebKit::WebProcessMain(int, char**) (argc=4, argv=0x7ffcf69b19d8) at ../../Source/WebKit/WebProcess/gtk/WebProcessMainGtk.cpp:78
#22 0x0000000000400852 in main(int, char**) (argc=4, argv=0x7ffcf69b19d8) at ../../Source/WebKit/WebProcess/EntryPoint/unix/WebProcessMain.cpp:31
Comment 1 Philippe Normand 2021-08-15 09:45:47 PDT
The id() method is not overridden in InbandTextTrackPrivateGStreamer, so the default impl is used, returning empty string...

Debugging this I ended up cleaning/refactoring some track platform code... I'll attach a patch.
Comment 2 Philippe Normand 2021-08-15 10:09:15 PDT
Created attachment 435567 [details]
Patch
Comment 3 Xabier Rodríguez Calvar 2021-08-16 02:04:42 PDT
Comment on attachment 435567 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=435567&action=review

Nice work!

> Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:71
> +    TrackPrivateBaseGStreamer(TrackType, TrackPrivateBase*, unsigned index, GRefPtr<GstPad>);
> +    TrackPrivateBaseGStreamer(TrackType, TrackPrivateBase*, unsigned index, GRefPtr<GstStream>);

If you're in the middle of such a re-styling, I would take advantage of this to turn these GRefPtr into GRefPtr&& and corresponding WTFMoves in the calls. I would do the same all the way up to the last upper call as we would be saving some innecessary ref bumps and object creations.
Comment 4 Philippe Normand 2021-08-16 04:18:44 PDT
Created attachment 435585 [details]
Patch
Comment 5 EWS 2021-08-16 06:38:01 PDT
Committed r281078 (240538@main): <https://commits.webkit.org/240538@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 435585 [details].
Comment 6 Radar WebKit Bug Importer 2021-08-16 06:39:17 PDT
<rdar://problem/81978494>
Comment 7 WebKit Commit Bot 2021-08-16 09:12:16 PDT
Re-opened since this is blocked by bug 229144
Comment 8 Philippe Normand 2021-08-16 09:21:32 PDT
Comment on attachment 435585 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=435585&action=review

> Source/WebCore/platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:50
> +        auto streamFlags = gst_stream_get_stream_flags(stream.get());

use after move, oops.

> Source/WebCore/platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:51
>          gst_stream_set_stream_flags(stream.get(), static_cast<GstStreamFlags>(streamFlags | GST_STREAM_FLAG_SELECT));

again

> Source/WebCore/platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:50
> +        auto streamFlags = gst_stream_get_stream_flags(stream.get());

Ditto

> Source/WebCore/platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:51
>          gst_stream_set_stream_flags(stream.get(), static_cast<GstStreamFlags>(streamFlags | GST_STREAM_FLAG_SELECT));

And here
Comment 9 Philippe Normand 2021-08-16 09:30:22 PDT
Created attachment 435611 [details]
Patch
Comment 10 EWS 2021-08-16 11:14:14 PDT
Committed r281093 (240553@main): <https://commits.webkit.org/240553@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 435611 [details].
Comment 11 WebKit Commit Bot 2021-08-16 13:51:06 PDT
Re-opened since this is blocked by bug 229159
Comment 12 Philippe Normand 2021-08-17 01:28:16 PDT
The invasive changes will be handled in another patch.
Comment 13 Philippe Normand 2021-08-17 01:30:02 PDT
Created attachment 435672 [details]
[fast-cq] Patch
Comment 14 EWS 2021-08-17 03:16:51 PDT
Committed r281133 (240587@main): <https://commits.webkit.org/240587@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 435672 [details].