Skip to content

Conversation

@calvaris
Copy link
Contributor

@calvaris calvaris commented Sep 24, 2025

9d73b18

[GStreamer] Increase use of CStringView and other string management improvements
https://bugs.webkit.org/show_bug.cgi?id=299443

Reviewed by Philippe Normand.

We are increasing the use of CStringView, also assuming that all input is UTF8 and that it might need to be converted in
order to interact with other WebKit classes.

Test: Covered by existing tests.

* Source/WTF/wtf/glib/GSpanExtras.cpp:
(WTF::gFileGetContents):
(WTF::gKeyFileGetKeys):
* Source/WTF/wtf/glib/GSpanExtras.h:
* Source/WebCore/Modules/mediastream/gstreamer/GStreamerDataChannelHandler.cpp:
(WebCore::GStreamerDataChannelHandler::GStreamerDataChannelHandler):
(WebCore::GStreamerDataChannelHandler::onMessageString):
* Source/WebCore/Modules/mediastream/gstreamer/GStreamerDataChannelHandler.h:
* Source/WebCore/Modules/mediastream/gstreamer/GStreamerMediaEndpoint.cpp:
(WebCore::GStreamerMediaEndpoint::maybeInsertNetSimForElement):
(WebCore::fetchDescription):
(WebCore::getMediaStreamIdsFromSDPMedia):
(WebCore::GStreamerMediaEndpoint::linkOutgoingSources):
(WebCore::GStreamerMediaEndpoint::doSetRemoteDescription):
(WebCore::GStreamerMediaEndpoint::processSDPMessage):
(WebCore::GStreamerMediaEndpoint::isIceGatheringComplete):
(WebCore::GStreamerMediaEndpoint::initiate):
(WebCore::GStreamerMediaEndpoint::trackIdFromSDPMedia):
(WebCore::GStreamerMediaEndpoint::connectPad):
(WebCore::GStreamerMediaEndpoint::canTrickleIceCandidates const):
(WebCore::GStreamerMediaEndpoint::completeSDPAnswer):
* Source/WebCore/Modules/mediastream/gstreamer/GStreamerMediaEndpoint.h:
* Source/WebCore/Modules/mediastream/gstreamer/GStreamerRtpTransceiverBackend.cpp:
(WebCore::GStreamerRtpTransceiverBackend::setCodecPreferences):
* Source/WebCore/Modules/mediastream/gstreamer/GStreamerWebRTCUtils.cpp:
(WebCore::x509Serialize):
(WebCore::privateKeySerialize):
(WebCore::sdpMediaHasAttributeKey):
(WebCore::getDirectionFromSDPMedia):
(WebCore::capsFromSDPMedia):
(WebCore::setSsrcAudioLevelVadOn):
(WebCore::SDPStringBuilder::appendConnection):
(WebCore::SDPStringBuilder::appendMedia):
(WebCore::SDPStringBuilder::SDPStringBuilder):
* Source/WebCore/Modules/mediastream/gstreamer/GStreamerWebRTCUtils.h:
* Source/WebCore/platform/audio/gstreamer/AudioEncoderGStreamer.cpp:
(WebCore::GStreamerInternalAudioEncoder::initialize):
* Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
(WebCore::AudioFileReader::handleMessage):
* Source/WebCore/platform/audio/gstreamer/PlatformRawAudioDataGStreamer.cpp:
(WebCore::layoutToString):
(WebCore::PlatformRawAudioData::copyTo):
* Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
(initializeDMABufAvailability):
* Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.cpp:
(WebCore::GStreamerAudioMixer::registerProducer):
(WebCore::GStreamerAudioMixer::configureSourcePeriodTime):
* Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.h:
* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::getStreamIdFromPad):
(WebCore::getStreamIdFromStream):
(WebCore::parseStreamId):
(WebCore::extractGStreamerOptionsFromCommandLine):
(WebCore::ensureGStreamerInitialized):
(WebCore::registerWebKitGStreamerElements):
(WebCore::deinitializeGStreamer):
(WebCore::getGstPlayFlag):
(WebCore::makeGStreamerElement):
(WebCore::gstStructureValueToJSON):
(WebCore::gstStructureToJSON):
(WebCore::gstElementMatchesFactoryAndHasProperty):
(WebCore::gstIdToString):
(WebCore::buildDMABufCaps):
(WebCore::requestGLContext):
(WebCore::setGstElementGLContext):
* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h:
* Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::ElementFactories::elementFactoryTypeToString):
(WebCore::GStreamerRegistryScanner::ElementFactories::hasElementForCaps const):
(WebCore::GStreamerRegistryScanner::initializeDecoders):
(WebCore::GStreamerRegistryScanner::isAVC1CodecSupported const):
(WebCore::probeRtpExtensions):
(WebCore::GStreamerRegistryScanner::isRtpHeaderExtensionSupported):
* Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.h:
* Source/WebCore/platform/graphics/gstreamer/GStreamerSinksWorkarounds.cpp:
(WebCore::getWorkAroundModeFromEnvironment):
(WebCore::BaseSinkPositionFlushWorkaroundProbe::checkIsNeeded):
(WebCore::AppSinkFlushCapsWorkaroundProbe::checkIsNeeded):
* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::elementIdChanged const):
(WebCore::MediaPlayerPrivateGStreamer::handleNeedContextMessage):
(WebCore::MediaPlayerPrivateGStreamer::handleMessage):
(WebCore::MediaPlayerPrivateGStreamer::configureParsebin):
(WebCore::MediaPlayerPrivateGStreamer::configureElement):
(WebCore::MediaPlayerPrivateGStreamer::configureDownloadBuffer):
(WebCore::MediaPlayerPrivateGStreamer::loadNextLocation):
(WebCore::MediaPlayerPrivateGStreamer::createVideoSinkGL):
(WebCore::MediaPlayerPrivateGStreamer::parseInitDataFromProtectionMessage):
(WebCore::MediaPlayerPrivateGStreamer::handleProtectionEvent):
* Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
(WebCore::MediaSampleGStreamer::dump const):
* Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
(WebCore::TrackPrivateBaseGStreamer::tagsChanged):
(WebCore::TrackPrivateBaseGStreamer::getLanguageCode):
(WebCore::TrackPrivateBaseGStreamer::getTag):
(WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged):
* Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
* Source/WebCore/platform/graphics/gstreamer/VideoFrameGStreamer.cpp:
(WebCore::VideoFrameGStreamer::createFromPixelBuffer):
(WebCore::VideoFrameGStreamer::convert):
* Source/WebCore/platform/graphics/gstreamer/WebKitAudioSinkGStreamer.cpp:
(webKitAudioSinkConfigure):
* Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webKitWebSrcSetExtraHeader):
(webKitWebSrcMakeRequest):
(convertPlaybinURI):
(webKitWebSrcSetUri):
* Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.h:
* Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp:
(WebCore::sessionLoadFailureFromThunder):
(WebCore::toString):
(WebCore::CDMInstanceSessionThunder::keyUpdatedCallback):
(WebCore::CDMInstanceSessionThunder::loadSession):
* Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
(WebCore::GStreamerEMEUtilities::isClearKeyUUID):
(WebCore::GStreamerEMEUtilities::isWidevineUUID):
(WebCore::GStreamerEMEUtilities::isPlayReadyUUID):
(WebCore::GStreamerEMEUtilities::isUnspecifiedUUID):
(WebCore::GStreamerEMEUtilities::keySystemToUuid):
(WebCore::GStreamerEMEUtilities::uuidToKeySystem):
* Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
(transformCaps):
* Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h:
* Source/WebCore/platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp:
(createSinkPadTemplateCaps):
(protectionSystemId):
* Source/WebCore/platform/graphics/gstreamer/eme/WebKitThunderParser.cpp:
(createThunderParseSinkPadTemplateCaps):
* Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp:
(WebCore::serialize):
(WebCore::AppendPipeline::didReceiveInitializationSegment):
(WebCore::AppendPipeline::Track::initializeElements):
(WebCore::appendPipelinePadProbeDebugInformation):
(WebCore::AppendPipeline::streamTypeToString): Deleted.
* Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h:
* Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(dumpReadyState):
(WebCore::MediaPlayerPrivateGStreamerMSE::readyStateFromMediaSourceChanged):
(WebCore::MediaPlayerPrivateGStreamerMSE::propagateReadyStateToPlayer):
* Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp:
(WebCore::MediaSourcePrivateGStreamer::markEndOfStream):
* Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
(streamTypeToString):
(webKitMediaSrcEmitStreams):
* Source/WebCore/platform/gstreamer/GStreamerCodecUtilities.cpp:
(WebCore::GStreamerCodecUtilities::parseH264ProfileAndLevel):
(WebCore::h264CapsFromCodecString):
(WebCore::GStreamerCodecUtilities::parseHEVCProfile):
(WebCore::h265CapsFromCodecString):
(WebCore::av1CapsFromCodecString):
(): Deleted.
* Source/WebCore/platform/gstreamer/GStreamerCodecUtilities.h:
* Source/WebCore/platform/gstreamer/GStreamerElementHarness.cpp:
(WebCore::MermaidBuilder::dumpElement):
(WebCore::MermaidBuilder::describeCaps):
(WebCore::GStreamerElementHarness::dumpGraph):
* Source/WebCore/platform/gstreamer/GStreamerQuirkBroadcom.cpp:
(WebCore::GStreamerQuirkBroadcom::configureElement):
* Source/WebCore/platform/gstreamer/GStreamerQuirkBroadcomBase.cpp:
(WebCore::GStreamerQuirkBroadcomBase::correctBufferingPercentage const):
(WebCore::GStreamerQuirkBroadcomBase::setupBufferingPercentageCorrection const):
* Source/WebCore/platform/gstreamer/GStreamerQuirkRialto.cpp:
(WebCore::GStreamerQuirkRialto::GStreamerQuirkRialto):
(WebCore::GStreamerQuirkRialto::configureElement):
* Source/WebCore/platform/gstreamer/GStreamerQuirkWesteros.cpp:
(WebCore::GStreamerQuirkWesteros::configureElement):
* Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp:
(WebCore::GStreamerQuirksManager::GStreamerQuirksManager):
* Source/WebCore/platform/gstreamer/WebKitFliteSourceGStreamer.cpp:
(fliteVoice):
(webKitFliteSrcSetUtterance):
* Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioCapturer.h:
* Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:
(WebCore::GStreamerCaptureDeviceManager::captureDeviceFromGstDevice):
* Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.h:
* Source/WebCore/platform/mediastream/gstreamer/GStreamerIncomingTrackProcessor.cpp:
(WebCore::GStreamerIncomingTrackProcessor::mediaStreamIdFromPad):
(WebCore::GStreamerIncomingTrackProcessor::retrieveMediaStreamAndTrackIdFromSDP):
* Source/WebCore/platform/mediastream/gstreamer/GStreamerMockDevice.cpp:
(webkitMockDeviceCreate):
* Source/WebCore/platform/mediastream/gstreamer/GStreamerRTPPacketizer.cpp:
(WebCore::GStreamerRTPPacketizer::ensureMidExtension):
* Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCapturer.cpp:
(WebCore::getMaxIntValueFromStructure):
(WebCore::getMaxFractionValueFromStructure):
(WebCore::GStreamerVideoCapturer::reconfigure):
* Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCapturer.h:
* Source/WebCore/platform/mediastream/gstreamer/GStreamerWebRTCLogSink.cpp:
(WebCore::GStreamerWebRTCLogSink::start):
* Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoDecoderFactory.cpp:
(WebCore::GStreamerWebRTCVideoDecoder::GstDecoderFactory):
(WebCore::VP8Decoder::Create):
* Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp:
(webkit_settings_apply_from_key_file):
* Tools/TestWebKitAPI/Tests/WebCore/gstreamer/GStreamerTest.cpp:
(TestWebKitAPI::TEST_F(GStreamerTest, hevcProfileParsing)):

Canonical link: https://commits.webkit.org/304152@main

5c7bf12

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
❌ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe 🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug 🧪 wpe-wk2 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
🧪 ios-wk2-wpt 🧪 api-mac-debug ✅ 🛠 wpe-cairo-libwebrtc
✅ 🛠 🧪 jsc 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 🧪 jsc-arm64 ✅ 🛠 vision 🧪 mac-wk2 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge 🧪 vision-wk2 ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🛠 tv 🧪 mac-intel-wk2 ✅ 🛠 jsc-armv7
🛠 tv-sim 🛠 mac-safer-cpp ✅ 🧪 jsc-armv7-tests
✅ 🛠 watch
✅ 🛠 watch-sim

@calvaris calvaris requested a review from philn as a code owner September 24, 2025 15:51
@calvaris calvaris self-assigned this Sep 24, 2025
@calvaris calvaris added the New Bugs Unclassified bugs are placed in this component until the correct component can be determined. label Sep 24, 2025
Copy link
Contributor

@aperezdc aperezdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed about half of the patch, and while I like the direction in this is going, I have a few general comments:

  • Could this be split in smaller chunks to ease reviewing?
  • One pattern I noticed is that many of the changes switch from StringView to using String, which results in copies. Many of this look like cases in which the new CStringView could be used, but not done because the latter is not supported for certain operations. It would seem better to me to e.g. add support to pass CStringView instances to makeString(), have an equalStringsIgnoringASCIICase() overload, and so on.

Comment on lines 109 to 110
auto tokens = StringView::fromLatin1(g_getenv(optionsEnvVarName));
for (auto it : tokens.split(',')) {
auto option = it.toString();
auto tokens = String::fromUTF8(g_getenv(optionsEnvVarName));
for (auto option : tokens.split(',')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some reason for this change? The original avoids making a copy of the environment variable contents into a String. This is not a big deal because it does not seem to be performance-critical code; but I am curious.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also curious about this, also the env var value is going to be ascii anyway.

Comment on lines 310 to 309
auto dotFilename = makeString(unsafeSpan(GST_ELEMENT_NAME(endPoint->pipeline())), '-', unsafeSpan(desc.get()));
auto dotFilename = makeString(String::fromUTF8(GST_ELEMENT_NAME(endPoint->pipeline())), '-', String::fromUTF8(desc.get()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Connot these two be CStringView::unsafeFromUTF8() instead of String::fromUTF8() to avoid copies?


#ifndef GST_DISABLE_GST_DEBUG
auto dotFileName = makeString(unsafeSpan(GST_OBJECT_NAME(m_pipeline.get())), ".setLocalDescription"_s);
auto dotFileName = makeString(String::fromUTF8(GST_OBJECT_NAME(m_pipeline.get())), ".setLocalDescription"_s);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, maybe this could be CStringView::unsafeFromUTF8()?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...and I see below that there are many other cases where this would apply, and all use makeString(). Could it be that makeString() does not have support for CStringView? It would seem like a good thing to me to make sure it can accept CStringView instances.

static bool isWidevineUUID(CStringView uuid)
{
return equalIgnoringASCIICase(uuid, s_WidevineUUID);
return equalIgnoringASCIICase(uuid.toString(), s_WidevineUUID);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it make more sense to have overloads of equalIgnoringASCICase() that can take CStringView parameters instead of creating temporary String copies of the contents?

@calvaris
Copy link
Contributor Author

calvaris commented Sep 25, 2025

I reviewed about half of the patch, and while I like the direction in this is going, I have a few general comments:

* Could this be split in smaller chunks to ease reviewing?

I guess it could, but it would be a bit PITA for me and I think considering the mechanical nature of most of the changes, it does not pay off even when the review can take longer. I can wait, I have other things to do.

* One pattern I noticed is that many of the changes switch from `StringView` to using `String`, which results in copies. Many of this look like cases in which the new `CStringView` could be used, but not done because the latter is not supported for certain operations. It would seem better to me to e.g. add support to pass `CStringView` instances to `makeString()`,

Encondings! We can't. CStringView is utf8 only and the rest of WK string management classes are Latin1 or UTF16. Hence, when you have to mix both worlds you have to turn the CStringView into a String and just make a copy in the best case scenario. Could we create a toStringView returning a std::optional and check before if all characters are just ASCII? We could, but then I don't know if the overhead of iterating the chars one by one pays off the extra error management we'd have to make.

have an equalStringsIgnoringASCIICase() overload, and so on.

We could do this, but to compare only among other CStringViews and ASCIILiterals and for this case, I checked and it does not pay off at least in the short term.

I think more or less this addresses your inline comments as well. Let's discuss them in general before.

Copy link
Member

@philn philn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the ASCIILiteral changes. But in general I don't really see the point of the changes introducing string copies and un-necessary conversions to utf8.

Comment on lines 109 to 110
auto tokens = StringView::fromLatin1(g_getenv(optionsEnvVarName));
for (auto it : tokens.split(',')) {
auto option = it.toString();
auto tokens = String::fromUTF8(g_getenv(optionsEnvVarName));
for (auto option : tokens.split(',')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also curious about this, also the env var value is going to be ascii anyway.

if (auto factory = adoptGRef(gst_element_factory_find("netsim"))) {
g_signal_connect_swapped(m_webrtcBin.get(), "deep-element-added", G_CALLBACK(+[](GStreamerMediaEndpoint* self, GstBin* bin, GstElement* element) {
GUniquePtr<char> elementName(gst_element_get_name(element));
auto view = StringView::fromLatin1(elementName.get());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

element names are ascii, can you revert this kind of change in the whole PR?

#endif
for (unsigned i = 0; i < totalMedias; i++) {
const auto media = gst_sdp_message_get_media(sdpMessage, i);
auto mediaType = StringView::fromLatin1(gst_sdp_media_get_media(media));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is un-necessary.

if (!connection->nettype || !connection->addrtype || !connection->address)
return;

m_stringBuilder.append("c="_s, unsafeSpan(connection->nettype), ' ', unsafeSpan(connection->addrtype), ' ', unsafeSpan(connection->address));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert unsafeSpan -> String changes in this class


auto width = destinationSize.width();
auto height = destinationSize.height();
auto formatName = unsafeSpan(gst_video_format_to_string(format));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really necessary?

GUniquePtr<char> mimeCodec(gst_codec_utils_caps_get_mime_codec(caps.get()));
if (mimeCodec) {
String codec = unsafeSpan(mimeCodec.get());
String codec = String::fromUTF8(mimeCodec.get());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are ascii...

static URL convertPlaybinURI(String&& uriString)
{
return URL { String::fromLatin1(uriString) };
return URL { uriString };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no WTFMove needed?

#endif

String elementClass = unsafeSpan(gst_element_get_metadata(m_demux.get(), GST_ELEMENT_METADATA_KLASS));
String elementClass = String::fromUTF8(gst_element_get_metadata(m_demux.get(), GST_ELEMENT_METADATA_KLASS));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ascii too

ASSERT(isMainThread());
ASSERT(m_hasReceivedFirstInitializationSegment);
auto trackId = AtomString(unsafeSpan8(GST_PAD_NAME(demuxerSrcPad)));
auto trackId = AtomString(String::fromUTF8(GST_PAD_NAME(demuxerSrcPad)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How often do we see pad names encoded in utf8?

gst_element_get_state(m_element.get(), nullptr, nullptr, GST_CLOCK_TIME_NONE);

static Atomic<uint64_t> uniqueStreamId;
auto streamId = makeString(unsafeSpan(GST_OBJECT_NAME(m_element.get())), '-', uniqueStreamId.exchangeAdd(1));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the changes in this file

@calvaris calvaris added the merge-queue Applied to send a pull request to merge-queue label Dec 9, 2025
…mprovements

https://bugs.webkit.org/show_bug.cgi?id=299443

Reviewed by Philippe Normand.

We are increasing the use of CStringView, also assuming that all input is UTF8 and that it might need to be converted in
order to interact with other WebKit classes.

Test: Covered by existing tests.

* Source/WTF/wtf/glib/GSpanExtras.cpp:
(WTF::gFileGetContents):
(WTF::gKeyFileGetKeys):
* Source/WTF/wtf/glib/GSpanExtras.h:
* Source/WebCore/Modules/mediastream/gstreamer/GStreamerDataChannelHandler.cpp:
(WebCore::GStreamerDataChannelHandler::GStreamerDataChannelHandler):
(WebCore::GStreamerDataChannelHandler::onMessageString):
* Source/WebCore/Modules/mediastream/gstreamer/GStreamerDataChannelHandler.h:
* Source/WebCore/Modules/mediastream/gstreamer/GStreamerMediaEndpoint.cpp:
(WebCore::GStreamerMediaEndpoint::maybeInsertNetSimForElement):
(WebCore::fetchDescription):
(WebCore::getMediaStreamIdsFromSDPMedia):
(WebCore::GStreamerMediaEndpoint::linkOutgoingSources):
(WebCore::GStreamerMediaEndpoint::doSetRemoteDescription):
(WebCore::GStreamerMediaEndpoint::processSDPMessage):
(WebCore::GStreamerMediaEndpoint::isIceGatheringComplete):
(WebCore::GStreamerMediaEndpoint::initiate):
(WebCore::GStreamerMediaEndpoint::trackIdFromSDPMedia):
(WebCore::GStreamerMediaEndpoint::connectPad):
(WebCore::GStreamerMediaEndpoint::canTrickleIceCandidates const):
(WebCore::GStreamerMediaEndpoint::completeSDPAnswer):
* Source/WebCore/Modules/mediastream/gstreamer/GStreamerMediaEndpoint.h:
* Source/WebCore/Modules/mediastream/gstreamer/GStreamerRtpTransceiverBackend.cpp:
(WebCore::GStreamerRtpTransceiverBackend::setCodecPreferences):
* Source/WebCore/Modules/mediastream/gstreamer/GStreamerWebRTCUtils.cpp:
(WebCore::x509Serialize):
(WebCore::privateKeySerialize):
(WebCore::sdpMediaHasAttributeKey):
(WebCore::getDirectionFromSDPMedia):
(WebCore::capsFromSDPMedia):
(WebCore::setSsrcAudioLevelVadOn):
(WebCore::SDPStringBuilder::appendConnection):
(WebCore::SDPStringBuilder::appendMedia):
(WebCore::SDPStringBuilder::SDPStringBuilder):
* Source/WebCore/Modules/mediastream/gstreamer/GStreamerWebRTCUtils.h:
* Source/WebCore/platform/audio/gstreamer/AudioEncoderGStreamer.cpp:
(WebCore::GStreamerInternalAudioEncoder::initialize):
* Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
(WebCore::AudioFileReader::handleMessage):
* Source/WebCore/platform/audio/gstreamer/PlatformRawAudioDataGStreamer.cpp:
(WebCore::layoutToString):
(WebCore::PlatformRawAudioData::copyTo):
* Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
(initializeDMABufAvailability):
* Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.cpp:
(WebCore::GStreamerAudioMixer::registerProducer):
(WebCore::GStreamerAudioMixer::configureSourcePeriodTime):
* Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.h:
* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::getStreamIdFromPad):
(WebCore::getStreamIdFromStream):
(WebCore::parseStreamId):
(WebCore::extractGStreamerOptionsFromCommandLine):
(WebCore::ensureGStreamerInitialized):
(WebCore::registerWebKitGStreamerElements):
(WebCore::deinitializeGStreamer):
(WebCore::getGstPlayFlag):
(WebCore::makeGStreamerElement):
(WebCore::gstStructureValueToJSON):
(WebCore::gstStructureToJSON):
(WebCore::gstElementMatchesFactoryAndHasProperty):
(WebCore::gstIdToString):
(WebCore::buildDMABufCaps):
(WebCore::requestGLContext):
(WebCore::setGstElementGLContext):
* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h:
* Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::ElementFactories::elementFactoryTypeToString):
(WebCore::GStreamerRegistryScanner::ElementFactories::hasElementForCaps const):
(WebCore::GStreamerRegistryScanner::initializeDecoders):
(WebCore::GStreamerRegistryScanner::isAVC1CodecSupported const):
(WebCore::probeRtpExtensions):
(WebCore::GStreamerRegistryScanner::isRtpHeaderExtensionSupported):
* Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.h:
* Source/WebCore/platform/graphics/gstreamer/GStreamerSinksWorkarounds.cpp:
(WebCore::getWorkAroundModeFromEnvironment):
(WebCore::BaseSinkPositionFlushWorkaroundProbe::checkIsNeeded):
(WebCore::AppSinkFlushCapsWorkaroundProbe::checkIsNeeded):
* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::elementIdChanged const):
(WebCore::MediaPlayerPrivateGStreamer::handleNeedContextMessage):
(WebCore::MediaPlayerPrivateGStreamer::handleMessage):
(WebCore::MediaPlayerPrivateGStreamer::configureParsebin):
(WebCore::MediaPlayerPrivateGStreamer::configureElement):
(WebCore::MediaPlayerPrivateGStreamer::configureDownloadBuffer):
(WebCore::MediaPlayerPrivateGStreamer::loadNextLocation):
(WebCore::MediaPlayerPrivateGStreamer::createVideoSinkGL):
(WebCore::MediaPlayerPrivateGStreamer::parseInitDataFromProtectionMessage):
(WebCore::MediaPlayerPrivateGStreamer::handleProtectionEvent):
* Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
(WebCore::MediaSampleGStreamer::dump const):
* Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
(WebCore::TrackPrivateBaseGStreamer::tagsChanged):
(WebCore::TrackPrivateBaseGStreamer::getLanguageCode):
(WebCore::TrackPrivateBaseGStreamer::getTag):
(WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged):
* Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
* Source/WebCore/platform/graphics/gstreamer/VideoFrameGStreamer.cpp:
(WebCore::VideoFrameGStreamer::createFromPixelBuffer):
(WebCore::VideoFrameGStreamer::convert):
* Source/WebCore/platform/graphics/gstreamer/WebKitAudioSinkGStreamer.cpp:
(webKitAudioSinkConfigure):
* Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webKitWebSrcSetExtraHeader):
(webKitWebSrcMakeRequest):
(convertPlaybinURI):
(webKitWebSrcSetUri):
* Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.h:
* Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp:
(WebCore::sessionLoadFailureFromThunder):
(WebCore::toString):
(WebCore::CDMInstanceSessionThunder::keyUpdatedCallback):
(WebCore::CDMInstanceSessionThunder::loadSession):
* Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
(WebCore::GStreamerEMEUtilities::isClearKeyUUID):
(WebCore::GStreamerEMEUtilities::isWidevineUUID):
(WebCore::GStreamerEMEUtilities::isPlayReadyUUID):
(WebCore::GStreamerEMEUtilities::isUnspecifiedUUID):
(WebCore::GStreamerEMEUtilities::keySystemToUuid):
(WebCore::GStreamerEMEUtilities::uuidToKeySystem):
* Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
(transformCaps):
* Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h:
* Source/WebCore/platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp:
(createSinkPadTemplateCaps):
(protectionSystemId):
* Source/WebCore/platform/graphics/gstreamer/eme/WebKitThunderParser.cpp:
(createThunderParseSinkPadTemplateCaps):
* Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp:
(WebCore::serialize):
(WebCore::AppendPipeline::didReceiveInitializationSegment):
(WebCore::AppendPipeline::Track::initializeElements):
(WebCore::appendPipelinePadProbeDebugInformation):
(WebCore::AppendPipeline::streamTypeToString): Deleted.
* Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h:
* Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(dumpReadyState):
(WebCore::MediaPlayerPrivateGStreamerMSE::readyStateFromMediaSourceChanged):
(WebCore::MediaPlayerPrivateGStreamerMSE::propagateReadyStateToPlayer):
* Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp:
(WebCore::MediaSourcePrivateGStreamer::markEndOfStream):
* Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
(streamTypeToString):
(webKitMediaSrcEmitStreams):
* Source/WebCore/platform/gstreamer/GStreamerCodecUtilities.cpp:
(WebCore::GStreamerCodecUtilities::parseH264ProfileAndLevel):
(WebCore::h264CapsFromCodecString):
(WebCore::GStreamerCodecUtilities::parseHEVCProfile):
(WebCore::h265CapsFromCodecString):
(WebCore::av1CapsFromCodecString):
(): Deleted.
* Source/WebCore/platform/gstreamer/GStreamerCodecUtilities.h:
* Source/WebCore/platform/gstreamer/GStreamerElementHarness.cpp:
(WebCore::MermaidBuilder::dumpElement):
(WebCore::MermaidBuilder::describeCaps):
(WebCore::GStreamerElementHarness::dumpGraph):
* Source/WebCore/platform/gstreamer/GStreamerQuirkBroadcom.cpp:
(WebCore::GStreamerQuirkBroadcom::configureElement):
* Source/WebCore/platform/gstreamer/GStreamerQuirkBroadcomBase.cpp:
(WebCore::GStreamerQuirkBroadcomBase::correctBufferingPercentage const):
(WebCore::GStreamerQuirkBroadcomBase::setupBufferingPercentageCorrection const):
* Source/WebCore/platform/gstreamer/GStreamerQuirkRialto.cpp:
(WebCore::GStreamerQuirkRialto::GStreamerQuirkRialto):
(WebCore::GStreamerQuirkRialto::configureElement):
* Source/WebCore/platform/gstreamer/GStreamerQuirkWesteros.cpp:
(WebCore::GStreamerQuirkWesteros::configureElement):
* Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp:
(WebCore::GStreamerQuirksManager::GStreamerQuirksManager):
* Source/WebCore/platform/gstreamer/WebKitFliteSourceGStreamer.cpp:
(fliteVoice):
(webKitFliteSrcSetUtterance):
* Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioCapturer.h:
* Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:
(WebCore::GStreamerCaptureDeviceManager::captureDeviceFromGstDevice):
* Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.h:
* Source/WebCore/platform/mediastream/gstreamer/GStreamerIncomingTrackProcessor.cpp:
(WebCore::GStreamerIncomingTrackProcessor::mediaStreamIdFromPad):
(WebCore::GStreamerIncomingTrackProcessor::retrieveMediaStreamAndTrackIdFromSDP):
* Source/WebCore/platform/mediastream/gstreamer/GStreamerMockDevice.cpp:
(webkitMockDeviceCreate):
* Source/WebCore/platform/mediastream/gstreamer/GStreamerRTPPacketizer.cpp:
(WebCore::GStreamerRTPPacketizer::ensureMidExtension):
* Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCapturer.cpp:
(WebCore::getMaxIntValueFromStructure):
(WebCore::getMaxFractionValueFromStructure):
(WebCore::GStreamerVideoCapturer::reconfigure):
* Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCapturer.h:
* Source/WebCore/platform/mediastream/gstreamer/GStreamerWebRTCLogSink.cpp:
(WebCore::GStreamerWebRTCLogSink::start):
* Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoDecoderFactory.cpp:
(WebCore::GStreamerWebRTCVideoDecoder::GstDecoderFactory):
(WebCore::VP8Decoder::Create):
* Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp:
(webkit_settings_apply_from_key_file):
* Tools/TestWebKitAPI/Tests/WebCore/gstreamer/GStreamerTest.cpp:
(TestWebKitAPI::TEST_F(GStreamerTest, hevcProfileParsing)):

Canonical link: https://commits.webkit.org/304152@main
@webkit-commit-queue
Copy link
Collaborator

Committed 304152@main (9d73b18): https://commits.webkit.org/304152@main

Reviewed commits have been landed. Closing PR #51259 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 9d73b18 into WebKit:main Dec 9, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Dec 9, 2025
@calvaris calvaris deleted the eng/299443 branch December 9, 2025 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Bugs Unclassified bugs are placed in this component until the correct component can be determined.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants