Skip to content

Commit 62328d8

Browse files
asurdej-comcastphiln
authored andcommitted
Clean up thunderparser injection
1 parent 4fd8f1a commit 62328d8

2 files changed

Lines changed: 13 additions & 28 deletions

File tree

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

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2547,7 +2547,17 @@ void MediaPlayerPrivateGStreamer::configureParsebin(GstElement* parsebin)
25472547
return tryAutoPlug;
25482548
}), this);
25492549

2550-
// We need to ensure that the webkitthunderparser factory is preferred over other parsers.
2550+
#if ENABLE(ENCRYPTED_MEDIA) && ENABLE(THUNDER)
2551+
// Inject the webkitthunderparser factory into parsebin's autoplug-factories signal.
2552+
2553+
// If no DRM is supported, we can skip the webkitthunderparser factory
2554+
if (CDMFactoryThunder::singleton().supportedKeySystems().isEmpty())
2555+
return;
2556+
if (m_url.protocolIsBlob())
2557+
return;
2558+
2559+
// Otherwise we need to ensure that the webkitthunderparser factory is present
2560+
// and preferred over other parsers
25512561
g_signal_connect(parsebin, "autoplug-factories",
25522562
G_CALLBACK(+[](GstElement*, GstPad*, GstCaps* caps, MediaPlayerPrivateGStreamer* player) -> GValueArray* {
25532563
ALLOW_DEPRECATED_DECLARATIONS_BEGIN; // GValueArray is deprecated
@@ -2557,7 +2567,7 @@ void MediaPlayerPrivateGStreamer::configureParsebin(GstElement* parsebin)
25572567
auto factories = gst_element_factory_list_get_elements(GST_ELEMENT_FACTORY_TYPE_DECODABLE, GST_RANK_MARGINAL);
25582568
// Add the webkitthunderparser factory if it exists, at the beginning of the list
25592569
// so that it is preferred over other elements.
2560-
if (!player->m_url.protocolIsBlob() && gst_element_factory_find("webkitthunderparser"_s))
2570+
if (gst_element_factory_find("webkitthunderparser"_s))
25612571
factories = g_list_prepend(factories, gst_element_factory_find("webkitthunderparser"_s));
25622572
// Filter the factories based on the caps and return them as a GValueArray.
25632573
auto list = gst_element_factory_list_filter(factories, caps, GST_PAD_SINK, gst_caps_is_fixed(caps));
@@ -2575,26 +2585,7 @@ void MediaPlayerPrivateGStreamer::configureParsebin(GstElement* parsebin)
25752585
return result;
25762586
ALLOW_DEPRECATED_DECLARATIONS_END;
25772587
}), this);
2578-
}
2579-
2580-
void MediaPlayerPrivateGStreamer::configureUriDecodebin2(GstElement* element)
2581-
{
2582-
ASSERT(m_isLegacyPlaybin);
2583-
#if ENABLE(ENCRYPTED_MEDIA) && ENABLE(THUNDER)
2584-
if (CDMFactoryThunder::singleton().supportedKeySystems().isEmpty())
2585-
return;
2586-
2587-
g_signal_connect(element, "autoplug-select", G_CALLBACK(+[](GstElement*, GstPad*, GstCaps*, GstElementFactory* factory, gpointer) -> unsigned {
2588-
static auto tryAutoPlug = *gstGetAutoplugSelectResult("try"_s);
2589-
static auto skipAutoPlug = *gstGetAutoplugSelectResult("skip"_s);
2590-
auto name = StringView::fromLatin1(gst_plugin_feature_get_name(GST_PLUGIN_FEATURE_CAST(factory)));
2591-
if (name == "webkitthunderparser"_s)
2592-
return skipAutoPlug;
2593-
return tryAutoPlug;
2594-
}), nullptr);
2595-
#else
2596-
UNUSED_PARAM(element);
2597-
#endif
2588+
#endif // ENABLE(ENCRYPTED_MEDIA) && ENABLE(THUNDER)
25982589
}
25992590

26002591
void MediaPlayerPrivateGStreamer::configureElement(GstElement* element)
@@ -2615,11 +2606,6 @@ void MediaPlayerPrivateGStreamer::configureElement(GstElement* element)
26152606
if (g_str_has_prefix(elementName.get(), "parsebin"))
26162607
configureParsebin(element);
26172608

2618-
// The legacy decodebin2 stack doesn't integrate well with parsebin, so prevent auto-plugging of
2619-
// the webkitthunderparser.
2620-
if (g_str_has_prefix(elementName.get(), "uridecodebin") && m_isLegacyPlaybin)
2621-
configureUriDecodebin2(element);
2622-
26232609
// In case of playbin3 with <video ... preload="auto">, instantiate
26242610
// downloadbuffer element, otherwise the playbin3 would instantiate
26252611
// a queue element instead .

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,6 @@ class MediaPlayerPrivateGStreamer
579579
void configureVideoDecoder(GstElement*);
580580
void configureElement(GstElement*);
581581
void configureParsebin(GstElement*);
582-
void configureUriDecodebin2(GstElement*);
583582

584583
void configureElementPlatformQuirks(GstElement*);
585584

0 commit comments

Comments
 (0)