Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagediff
titlewebkit.patch
diff --git a/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp b/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp
index 08bdac7e1e45..5aa17911bbfc 100644
--- a/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp
+++ b/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp
@@ -402,12 +402,16 @@ void registerWebKitGStreamerElements()
         // The VAAPI plugin is not much maintained anymore and prone to rendering issues. In the
         // mid-term we will leverage the new stateless VA decoders. Disable the legacy plugin,
         // unless the WEBKIT_GST_ENABLE_LEGACY_VAAPI environment variable is set to 1.
+        auto* registry = gst_registry_get();
         const char* enableLegacyVAAPIPlugin = getenv("WEBKIT_GST_ENABLE_LEGACY_VAAPI");
         if (!enableLegacyVAAPIPlugin || !strcmp(enableLegacyVAAPIPlugin, "0")) {
-            auto* registry = gst_registry_get();
             if (auto vaapiPlugin = adoptGRef(gst_registry_find_plugin(registry, "vaapi")))
                 gst_registry_remove_plugin(registry, vaapiPlugin.get());
         }
+        if (auto brcmVidFilterPlugin = adoptGRef(gst_registry_find_plugin(registry, "brcmvidfilter")))
+            gst_registry_remove_plugin(registry, brcmVidFilterPlugin.get());
+        if (auto brcmAudFilterPlugin = adoptGRef(gst_registry_find_plugin(registry, "brcmaudfilter")))
+            gst_registry_remove_plugin(registry, brcmAudFilterPlugin.get());
         registryWasUpdated = true;
     });
 
diff --git a/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp b/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp
index d2bbf1416e9b..6b4a5ddd6c45 100644
--- a/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp
+++ b/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp
@@ -77,17 +77,10 @@ void GStreamerRegistryScanner::getSupportedDecodingTypes(HashSet<String, ASCIICa
 
 GStreamerRegistryScanner::ElementFactories::ElementFactories(OptionSet<ElementFactories::Type> types)
 {
-#if PLATFORM(BCM_NEXUS) || PLATFORM(BROADCOM)
-    if (types.contains(Type::AudioDecoder))
-        audioDecoderFactories = gst_element_factory_list_get_elements(GST_ELEMENT_FACTORY_TYPE_PARSER | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO, GST_RANK_MARGINAL);
-    if (types.contains(Type::VideoDecoder))
-        videoDecoderFactories = gst_element_factory_list_get_elements(GST_ELEMENT_FACTORY_TYPE_PARSER | GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO, GST_RANK_MARGINAL);
-#else
     if (types.contains(Type::AudioDecoder))
         audioDecoderFactories = gst_element_factory_list_get_elements(GST_ELEMENT_FACTORY_TYPE_DECODER | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO, GST_RANK_MARGINAL);
     if (types.contains(Type::VideoDecoder))
         videoDecoderFactories = gst_element_factory_list_get_elements(GST_ELEMENT_FACTORY_TYPE_DECODER | GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO, GST_RANK_MARGINAL);
-#endif
     if (types.contains(Type::AudioParser))
         audioParserFactories = gst_element_factory_list_get_elements(GST_ELEMENT_FACTORY_TYPE_PARSER | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO, GST_RANK_NONE);
     if (types.contains(Type::VideoParser))
diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
index 6e46736d07d0..8855840217ce 100644
--- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
+++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
@@ -1321,28 +1321,12 @@ void MediaPlayerPrivateGStreamer::loadingFailed(MediaPlayer::NetworkState networ
 
 GstElement* MediaPlayerPrivateGStreamer::createAudioSink()
 {
-#if PLATFORM(BROADCOM) || USE(WESTEROS_SINK) || PLATFORM(AMLOGIC) || PLATFORM(REALTEK)
-    // If audio is being controlled by an another pipeline, creating sink here may interfere with
-    // audio playback. Instead, check if an audio sink was setup in handleMessage and use it.
-    return nullptr;
-#endif
-
-    // For platform specific audio sinks, they need to be properly upranked so that they get properly autoplugged.
-
-    auto role = m_player->isVideoPlayer() ? "video"_s : "music"_s;
-    GstElement* audioSink = createPlatformAudioSink(role);
-    RELEASE_ASSERT(audioSink);
-    if (!audioSink)
-        return nullptr;
-
-#if ENABLE(WEB_AUDIO)
-    GstElement* audioSinkBin = gst_bin_new("audio-sink");
-    ensureAudioSourceProvider();
-    m_audioSourceProvider->configureAudioBin(audioSinkBin, audioSink);
-    return audioSinkBin;
-#else
-    return audioSink;
-#endif
+// #if ENABLE(WEB_AUDIO)
+//     // Rialto webaudio doesnt work, investigation needed
+//     return gst_element_factory_make("rialtowebaudiosink", "rialtowebaudiosink");
+// #else
+    return gst_element_factory_make("rialtomseaudiosink", "rialtomseaudiosink");
+// #endif
 }
 
 GstElement* MediaPlayerPrivateGStreamer::audioSink() const
@@ -1941,7 +1925,6 @@ void MediaPlayerPrivateGStreamer::handleMessage(GstMessage* message)
             }
         }
 #endif
-
 #if PLATFORM(BROADCOM) || USE(WESTEROS_SINK) || PLATFORM(AMLOGIC) || PLATFORM(REALTEK)
         if (currentState <= GST_STATE_READY && newState >= GST_STATE_READY) {
             // Detect an audio sink element and store reference to it if it supersedes what we currently have.
@@ -4150,7 +4133,7 @@ GstElement* MediaPlayerPrivateGStreamer::createHolePunchVideoSink()
     if (m_isLegacyPlaybin && !isPIPRequested)
         return nullptr;
     // Westeros using holepunch.
-    GstElement* videoSink = makeGStreamerElement("westerossink", "WesterosVideoSink");
+    GstElement* videoSink = gst_element_factory_make("rialtomsevideosink", "rialtomsevideosink");
     g_object_set(G_OBJECT(videoSink), "zorder", 0.0f, nullptr);
     if (isPIPRequested) {
         g_object_set(G_OBJECT(videoSink), "res-usage", 0u, nullptr);
@@ -4572,7 +4555,6 @@ std::optional<VideoFrameMetadata> MediaPlayerPrivateGStreamer::videoFrameMetadat
 
 void MediaPlayerPrivateGStreamer::setPageIsVisible(bool visible)
 {
-
     if (m_visible != visible) {
 #if USE(GSTREAMER_HOLEPUNCH)
         Locker locker { m_holePunchLock };
diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cppcmake/FindThunder.cmake b/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cppcmake/FindThunder.cmake
index fc7241444484ab7064e3988b..5d17ed721a61bc086ad9105d 100644
--- a/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cppcmake/FindThunder.cmake
+++ b/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cppcmake/FindThunder.cmake
@@ -22956,69 +22956,307 @@ MediaTime MediaPlayerPrivateGStreamerMSE::durationMediaTime() const
 
 void MediaPlayerPrivateGStreamerMSE::seek(const MediaTime& time)
 {
+    // Rialto doesnt like when seek is performed below paused state
+    if (m_isSeeking) {
+        if (m_isSeekPending) {
+            m_seekTime = time;
+            return;
+        }
+    }
+
+    if (pipeline())
+    {
+        GstState state;
+        GstStateChangeReturn getStateResult = gst_element_get_state(pipeline(), &state, nullptr, 0);
+        if (getStateResult == GST_STATE_CHANGE_FAILURE || getStateResult == GST_STATE_CHANGE_NO_PREROLL) {
+            GST_DEBUG_OBJECT(pipeline(), "[Seek] cannot seek, current state change is %s", gst_element_state_change_return_get_name(getStateResult));
+            return;
+        }
+        if (getStateResult == GST_STATE_CHANGE_ASYNC || state < GST_STATE_PAUSED || m_isEndReached) {
+            m_isSeekPending = true;
+            m_isSeeking = true;
+            m_seekTime = time;
+            m_isEndReached = false;
+            return;
+        }
+    }
     GST_DEBUG_OBJECT(pipeline(), "Requested seek to %s", time.toString().utf8().data());
     doSeek(time, m_playbackRate, GST_SEEK_FLAG_FLUSH);
 }
@@ -409,6 +433,17 @@ void MediaPlayerPrivateGStreamerMSE::updateStates()
             GST_ERROR_OBJECT(pipeline(), "Setting the pipeline to PAUSED failed");
         m_isPipelinePlaying = false;
     find_path(THUNDER_INCLUDE_DIR
 )
 
 find_library(THUNDER_LIBRARY
-    NAMES ocdm
-    HINTS ${PC_THUNDER_LIBDIR}
-          ${PC_THUNDER_LIBRARY_DIRS}
+    if (getStateResult == GST_STATE_CHANGE_SUCCESS && m_currentState >= GST_STATE_PAUSED) {
+        if (m_isSeekPending) {
+            GST_DEBUG_OBJECT(pipeline(), "[Seek] committing pending seek to %s", toString(m_seekTime).utf8().data());
+            m_isSeekPending = false;
+            m_isSeeking = doSeek(m_seekTime, m_player->rate(), static_cast<GstSeekFlags>(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE));
+            if (!m_isSeeking) {
+                invalidateCachedPosition();
+                GST_DEBUG_OBJECT(pipeline(), "[Seek] seeking to %s failed", toString(m_seekTime).utf8().data());
+            }
+        }
+    }
 }
 
 bool MediaPlayerPrivateGStreamerMSE::isTimeBuffered(const MediaTime &time) constNAMES ocdmRialto
 )
 
 include(FindPackageHandleStandardArgs)