Skip to content

Commit

Permalink
Cherry-pick 275037@main (3ab7997). https://bugs.webkit.org/show_bug.c…
Browse files Browse the repository at this point in the history
…gi?id=269782

    [GStreamer] Fix audio sink detection in custom platforms
    https://bugs.webkit.org/show_bug.cgi?id=269782

    Reviewed by Philippe Normand.

    Sometimes we can get a message from a new audio sink that we should store as such even when we already have one.

    Based on a patch by Pawel Lampe <pawel.lampe@gmail.com>.

    * Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
    (WebCore::MediaPlayerPrivateGStreamer::handleMessage):

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

Canonical link: https://commits.webkit.org/274313.171@webkitglib/2.44
  • Loading branch information
calvaris authored and aperezdc committed Apr 28, 2024
1 parent abe23c2 commit 66fe4f6
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1966,15 +1966,13 @@ void MediaPlayerPrivateGStreamer::handleMessage(GstMessage* message)

#if PLATFORM(BROADCOM) || USE(WESTEROS_SINK) || PLATFORM(AMLOGIC) || PLATFORM(REALTEK)
if (currentState <= GST_STATE_READY && newState >= GST_STATE_READY) {
// If we didn't create an audio sink, store a reference to the created one.
if (!m_audioSink) {
// Detect an audio sink element.
GstElement* element = GST_ELEMENT(GST_MESSAGE_SRC(message));
if (GST_OBJECT_FLAG_IS_SET(element, GST_ELEMENT_FLAG_SINK)) {
const gchar* klassStr = gst_element_get_metadata(element, "klass");
if (strstr(klassStr, "Sink") && strstr(klassStr, "Audio"))
m_audioSink = element;
}
// Detect an audio sink element and store reference to it if it supersedes what we currently have.
GstElement* element = GST_ELEMENT(GST_MESSAGE_SRC(message));
if (GST_OBJECT_FLAG_IS_SET(element, GST_ELEMENT_FLAG_SINK)) {
const gchar* klassStr = gst_element_get_metadata(element, "klass");
if (g_strrstr(klassStr, "Sink") && g_strrstr(klassStr, "Audio")
&& (!m_audioSink || (m_audioSink.get() != element && GST_STATE(m_audioSink.get()) == GST_STATE_NULL)))
m_audioSink = element;
}
}
#endif
Expand Down

0 comments on commit 66fe4f6

Please sign in to comment.