Skip to content

Commit eb1c70d

Browse files
committed
[Gstreamer][Westeros] Bring back westeros autoplug code for playbin3
https://bugs.webkit.org/show_bug.cgi?id=263714 Reviewed by Philippe Normand. To autoplug westeros sink in playbin3 we need to specify the stop caps to ensure encoded data goes directly into the sink. This is a revert of # https://commits.webkit.org/266178@main. * Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::syncOnClock): (WebCore::MediaPlayerPrivateGStreamer::configureElementPlatformQuirks): Canonical link: https://commits.webkit.org/269808@main
1 parent d89d709 commit eb1c70d

1 file changed

Lines changed: 28 additions & 2 deletions

File tree

Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,8 +981,6 @@ void MediaPlayerPrivateGStreamer::syncOnClock(bool sync)
981981
#if !USE(WESTEROS_SINK)
982982
setSyncOnClock(videoSink(), sync);
983983
setSyncOnClock(audioSink(), sync);
984-
#else
985-
UNUSED_PARAM(sync);
986984
#endif
987985
}
988986

@@ -2294,12 +2292,40 @@ void MediaPlayerPrivateGStreamer::configureElementPlatformQuirks(GstElement* ele
22942292
#endif
22952293
#endif
22962294

2295+
#if USE(WESTEROS_SINK)
2296+
static GstCaps* westerosSinkCaps = nullptr;
2297+
static GType westerosSinkType = G_TYPE_INVALID;
2298+
static std::once_flag onceFlag;
2299+
std::call_once(onceFlag, [] {
2300+
GRefPtr<GstElementFactory> westerosfactory = adoptGRef(gst_element_factory_find("westerossink"));
2301+
if (westerosfactory) {
2302+
gst_object_unref(gst_plugin_feature_load(GST_PLUGIN_FEATURE(westerosfactory.get())));
2303+
westerosSinkType = gst_element_factory_get_element_type(westerosfactory.get());
2304+
for (auto* t = gst_element_factory_get_static_pad_templates(westerosfactory.get()); t; t = g_list_next(t)) {
2305+
GstStaticPadTemplate* padtemplate = static_cast<GstStaticPadTemplate*>(t->data);
2306+
if (padtemplate->direction != GST_PAD_SINK)
2307+
continue;
2308+
if (westerosSinkCaps)
2309+
westerosSinkCaps = gst_caps_merge(westerosSinkCaps, gst_static_caps_get(&padtemplate->static_caps));
2310+
else
2311+
westerosSinkCaps = gst_static_caps_get(&padtemplate->static_caps);
2312+
}
2313+
}
2314+
});
22972315
#if ENABLE(MEDIA_STREAM)
22982316
if (m_streamPrivate && !g_strcmp0(G_OBJECT_TYPE_NAME(G_OBJECT(element)), "GstWesterosSink") && gstObjectHasProperty(element, "immediate-output")) {
22992317
GST_DEBUG_OBJECT(pipeline(), "Enable 'immediate-output' in WesterosSink");
23002318
g_object_set(element, "immediate-output", TRUE, nullptr);
23012319
}
23022320
#endif
2321+
if (!m_isLegacyPlaybin && westerosSinkCaps && g_str_has_prefix(GST_ELEMENT_NAME(element), "uridecodebin3")) {
2322+
GRefPtr<GstCaps> defaultCaps;
2323+
g_object_get(element, "caps", &defaultCaps.outPtr(), NULL);
2324+
defaultCaps = adoptGRef(gst_caps_merge(gst_caps_ref(westerosSinkCaps), defaultCaps.leakRef()));
2325+
g_object_set(element, "caps", defaultCaps.get(), NULL);
2326+
GST_INFO_OBJECT(pipeline(), "setting stop caps tp %" GST_PTR_FORMAT, defaultCaps.get());
2327+
}
2328+
#endif
23032329

23042330
#if ENABLE(MEDIA_STREAM) && PLATFORM(REALTEK)
23052331
if (m_streamPrivate) {

0 commit comments

Comments
 (0)