[Webkit-unassigned] [Bug 275609] New: [GStreamer] Add gstStructureGet helper function
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Jun 18 07:37:51 PDT 2024
https://bugs.webkit.org/show_bug.cgi?id=275609
Bug ID: 275609
Summary: [GStreamer] Add gstStructureGet helper function
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: Platform
Assignee: webkit-unassigned at lists.webkit.org
Reporter: cadubentzen at igalia.com
In GStreamerStatsCollector.cpp, we need to assign to a bunch of std::optional<T> fields and the pattern below gets repeated many times:
struct InboundRtpStreamStats : RtpStreamStats {
std::optional<uint64_t> bytesReceived;
std::optional<uint32_t> firCount;
};
void fillInboundRTPStreamStats(InboundRtpStreamStats& stats, const GstStructure* structure)
{
uint64_t bytesReceived;
if (gst_structure_get_uint64(structure, "bytes-received", &value))
stats.bytesReceived = value;
unsigned firCount;
if (gst_structure_get_uint(structure, "fir-count", &firCount))
stats.firCount = firCount;
}
It would be nice to not have to always declare new variables and if conditions:
template<typename T>
std::optional<T> gstStructureGet(const GstStructure* structure, ASCIILiteral key);
void fillInboundRTPStreamStats(InboundRtpStreamStats& stats, const GstStructure* structure)
{
stats.bytesReceived = gstStructureGet<unint64_t>(structure, "bytes-received"_s);
stats.firCount = gstStructureGet<unsigned>(structure, "fir-count"_s);
}
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240618/d2f83bf9/attachment.htm>
More information about the webkit-unassigned
mailing list