From 947bc29de52aea3ce397f937a83f1266947a140b Mon Sep 17 00:00:00 2001 From: gowthami Date: Mon, 9 Dec 2024 12:43:54 +0530 Subject: [PATCH] [ONEM-29845] - changes from upstream to support mp2t for running sample app for shaka --- .../graphics/gstreamer/GStreamerRegistryScanner.cpp | 3 ++- .../platform/graphics/gstreamer/mse/AppendPipeline.cpp | 5 +++++ .../gstreamer/mse/SourceBufferPrivateGStreamer.cpp | 8 +++++++- Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp b/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp index 555522f13d9ef..e0b7698de7f28 100644 --- a/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp @@ -231,6 +231,7 @@ GStreamerRegistryScanner::RegistryLookupResult GStreamerRegistryScanner::Element } } + shouldCheckHardwareClassifier = CheckHardwareClassifier::Yes; if (shouldCheckHardwareClassifier == CheckHardwareClassifier::Yes) { for (GList* factories = candidates; factories; factories = g_list_next(factories)) { auto* factory = reinterpret_cast(factories->data); @@ -439,7 +440,7 @@ void GStreamerRegistryScanner::initializeDecoders(const GStreamerRegistryScanner { ElementFactories::Type::AudioDecoder, "audio/x-eac3", { "audio/x-ac3"_s }, { "x-eac3"_s, "ec3"_s, "ec-3"_s, "eac3"_s } }, { ElementFactories::Type::AudioDecoder, "audio/x-flac", { "audio/x-flac"_s, "audio/flac"_s }, {"x-flac"_s, "flac"_s } }, { ElementFactories::Type::VideoDecoder, "video/mpeg", { }, { "mp2v"_s } }, - { ElementFactories::Type::Demuxer, "video/mpegts", { "video/mp2t"_s }, { } }, + { ElementFactories::Type::Demuxer, "video/mpegts", { "video/mpegts"_s, "video/mp2t"_s }, { } }, }; fillMimeTypeSetFromCapsMapping(factories, mseCompatibleMapping); diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp b/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp index 5f0eb527967d3..ef2daa3ed038b 100644 --- a/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp @@ -149,6 +149,11 @@ AppendPipeline::AppendPipeline(SourceBufferPrivateGStreamer& sourceBufferPrivate } else if (type.endsWith("webm"_s)) { m_demux = makeGStreamerElement("matroskademux", nullptr); m_typefind = makeGStreamerElement("identity", nullptr); + } else if (type.endsWith("mp2t"_s) || type.endsWith("mpegts"_s)) { + // INFO_LOG(LOGIDENTIFIER, "mp2t/mpegts support in MSE is experimental"); + GST_INFO_OBJECT(m_playerPrivate->pipeline(), "mp2t/mpegts support in MSE is experimental"); + m_demux = makeGStreamerElement("tsdemux", nullptr); + m_typefind = makeGStreamerElement("identity", nullptr); } else if (type == "audio/mpeg"_s) { m_demux = makeGStreamerElement("identity", nullptr); m_typefind = makeGStreamerElement("typefind", nullptr); diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp index 5cc244d4f42db..3b7c253097dfe 100644 --- a/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp @@ -60,7 +60,13 @@ namespace WebCore { bool SourceBufferPrivateGStreamer::isContentTypeSupported(const ContentType& type) { const auto& containerType = type.containerType(); - return containerType == "audio/mpeg"_s || containerType.endsWith("mp4"_s) || containerType.endsWith("aac"_s) || containerType.endsWith("webm"_s); + #if !RELEASE_LOG_DISABLED || !defined(GST_DISABLE_GST_DEBUG) + if (containerType.endsWith("mp2t"_s)) { + // INFO_LOG(LOGIDENTIFIER, "mp2t/mpegts support in MSE is experimental"); + GST_INFO("mp2t/mpegts support in MSE is experimental"); + } +#endif + return containerType == "audio/mpeg"_s || containerType.endsWith("mp4"_s) || containerType.endsWith("aac"_s) || containerType.endsWith("webm"_s) || containerType.endsWith("mp2t"_s); } Ref SourceBufferPrivateGStreamer::create(MediaSourcePrivateGStreamer* mediaSource, const ContentType& contentType, MediaPlayerPrivateGStreamerMSE& playerPrivate) diff --git a/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp b/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp index bfca8251ce3ed..96ef87e6cc416 100644 --- a/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp +++ b/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp @@ -1485,7 +1485,7 @@ static void webkit_settings_class_init(WebKitSettingsClass* klass) "enable-media-capabilities", _("Enable MediaCapabilities"), _("Whether MediaCapabilities should be enabled."), - FALSE, + TRUE, readWriteConstructParamFlags); /**