Bug 235760 - [GStreamer] GstStructure to JSON serialization
Summary: [GStreamer] GstStructure to JSON serialization
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:
Blocks:
 
Reported: 2022-01-28 02:08 PST by Philippe Normand
Modified: 2022-01-30 05:21 PST (History)
7 users (show)

See Also:


Attachments
Patch (7.07 KB, patch)
2022-01-28 02:57 PST, Philippe Normand
no flags Details | Formatted Diff | Diff
Patch (6.77 KB, patch)
2022-01-30 04:24 PST, 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 2022-01-28 02:08:46 PST
Would be useful for gstwebrtc stats logging.
Comment 1 Philippe Normand 2022-01-28 02:57:06 PST
Created attachment 450217 [details]
Patch
Comment 2 Xabier Rodríguez Calvar 2022-01-28 08:26:24 PST
Comment on attachment 450217 [details]
Patch

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

> Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:556
> +        auto resultArray = array->asArray();
> +        return resultArray->asValue();

I would collapse these two lines if possible.

> Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h:322
> +String structureToJSONString(const GstStructure*);

I might go (not only for this method, but for the other ones as well) for something like gstStructureTo...

> Tools/TestWebKitAPI/Tests/WebCore/gstreamer/GStreamerTest.cpp:57
> +    ASSERT_EQ(jsonString, "{\"int-val\":5,\"str-val\":\"foo\",\"bool-val\":1}");

Are we not interested in printing the structure name?
Comment 3 Philippe Normand 2022-01-28 09:01:22 PST
Comment on attachment 450217 [details]
Patch

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

>> Tools/TestWebKitAPI/Tests/WebCore/gstreamer/GStreamerTest.cpp:57
>> +    ASSERT_EQ(jsonString, "{\"int-val\":5,\"str-val\":\"foo\",\"bool-val\":1}");
> 
> Are we not interested in printing the structure name?

For non-nested structures I don't see the point and it would add one level of nesting, only for the name: {"name": {...}}.

> Tools/TestWebKitAPI/Tests/WebCore/gstreamer/GStreamerTest.cpp:62
> +    ASSERT_EQ(jsonString, "{\"int-val\":5,\"str-val\":\"foo\",\"bool-val\":1,\"inner\":{\"boo\":0,\"double-val\":2.42}}");

Here the nested struct is identified by its name though.
Comment 4 Philippe Normand 2022-01-30 04:24:48 PST
Created attachment 450358 [details]
Patch
Comment 5 EWS 2022-01-30 05:20:33 PST
Committed r288799 (246575@main): <https://commits.webkit.org/246575@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 450358 [details].
Comment 6 Radar WebKit Bug Importer 2022-01-30 05:21:18 PST
<rdar://problem/88239833>