Skip to content

Commit cb45611

Browse files
committed
[GStreamer][Quirks] Apply configureElement to every requested quirk
https://bugs.webkit.org/show_bug.cgi?id=271697 Reviewed by NOBODY (OOPS!). On some platforms it is desirable to apply that quirk unconditionally, because multiple platform-specific quirks are requested. * Source/WebCore/platform/gstreamer/GStreamerQuirkAmLogic.cpp: (WebCore::GStreamerQuirkAmLogic::configureElement): * Source/WebCore/platform/gstreamer/GStreamerQuirkAmLogic.h: * Source/WebCore/platform/gstreamer/GStreamerQuirkBroadcom.cpp: (WebCore::GStreamerQuirkBroadcom::configureElement): * Source/WebCore/platform/gstreamer/GStreamerQuirkBroadcom.h: * Source/WebCore/platform/gstreamer/GStreamerQuirkRealtek.cpp: (WebCore::GStreamerQuirkRealtek::configureElement): * Source/WebCore/platform/gstreamer/GStreamerQuirkRealtek.h: * Source/WebCore/platform/gstreamer/GStreamerQuirkWesteros.cpp: (WebCore::GStreamerQuirkWesteros::configureElement): * Source/WebCore/platform/gstreamer/GStreamerQuirkWesteros.h: * Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp: (WebCore::GStreamerQuirksManager::configureElement): * Source/WebCore/platform/gstreamer/GStreamerQuirks.h: (WebCore::GStreamerQuirk::configureElement):
1 parent f6be72b commit cb45611

10 files changed

Lines changed: 16 additions & 28 deletions

Source/WebCore/platform/gstreamer/GStreamerQuirkAmLogic.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,17 @@ GstElement* GStreamerQuirkAmLogic::createWebAudioSink()
4848
return sink;
4949
}
5050

51-
bool GStreamerQuirkAmLogic::configureElement(GstElement* element, const OptionSet<ElementRuntimeCharacteristics>& characteristics)
51+
void GStreamerQuirkAmLogic::configureElement(GstElement* element, const OptionSet<ElementRuntimeCharacteristics>& characteristics)
5252
{
5353
if (gstObjectHasProperty(element, "disable-xrun")) {
5454
GST_INFO("Set property disable-xrun to TRUE");
5555
g_object_set(element, "disable-xrun", TRUE, nullptr);
56-
} else
57-
return false;
56+
}
5857

5958
if (characteristics.contains(ElementRuntimeCharacteristics::HasVideo) && gstObjectHasProperty(element, "wait-video")) {
6059
GST_INFO("Set property wait-video to TRUE");
6160
g_object_set(element, "wait-video", TRUE, nullptr);
62-
} else
63-
return false;
64-
65-
return true;
61+
}
6662
}
6763

6864
#undef GST_CAT_DEFAULT

Source/WebCore/platform/gstreamer/GStreamerQuirkAmLogic.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ class GStreamerQuirkAmLogic final : public GStreamerQuirk {
3232
const char* identifier() final { return "AmLogic"; }
3333

3434
GstElement* createWebAudioSink() final;
35-
bool configureElement(GstElement*, const OptionSet<ElementRuntimeCharacteristics>&) final;
36-
35+
void configureElement(GstElement*, const OptionSet<ElementRuntimeCharacteristics>&) final;
3736
};
3837

3938
} // namespace WebCore

Source/WebCore/platform/gstreamer/GStreamerQuirkBroadcom.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ GStreamerQuirkBroadcom::GStreamerQuirkBroadcom()
3737
m_disallowedWebAudioDecoders = { "brcmaudfilter"_s };
3838
}
3939

40-
bool GStreamerQuirkBroadcom::configureElement(GstElement* element, const OptionSet<ElementRuntimeCharacteristics>& characteristics)
40+
void GStreamerQuirkBroadcom::configureElement(GstElement* element, const OptionSet<ElementRuntimeCharacteristics>& characteristics)
4141
{
4242
if (g_str_has_prefix(GST_ELEMENT_NAME(element), "brcmaudiosink"))
4343
g_object_set(G_OBJECT(element), "async", TRUE, nullptr);
@@ -48,14 +48,12 @@ bool GStreamerQuirkBroadcom::configureElement(GstElement* element, const OptionS
4848
}
4949

5050
if (!characteristics.contains(ElementRuntimeCharacteristics::IsMediaStream))
51-
return true;
51+
return;
5252

5353
if (!g_strcmp0(G_OBJECT_TYPE_NAME(G_OBJECT(element)), "GstBrcmPCMSink") && gstObjectHasProperty(element, "low_latency")) {
5454
GST_DEBUG("Set 'low_latency' in brcmpcmsink");
5555
g_object_set(element, "low_latency", TRUE, "low_latency_max_queued_ms", 60, nullptr);
5656
}
57-
58-
return true;
5957
}
6058

6159
std::optional<bool> GStreamerQuirkBroadcom::isHardwareAccelerated(GstElementFactory* factory)

Source/WebCore/platform/gstreamer/GStreamerQuirkBroadcom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class GStreamerQuirkBroadcom final : public GStreamerQuirk {
3232
GStreamerQuirkBroadcom();
3333
const char* identifier() final { return "Broadcom"; }
3434

35-
bool configureElement(GstElement*, const OptionSet<ElementRuntimeCharacteristics>&) final;
35+
void configureElement(GstElement*, const OptionSet<ElementRuntimeCharacteristics>&) final;
3636
std::optional<bool> isHardwareAccelerated(GstElementFactory*) final;
3737
std::optional<GstElementFactoryListType> audioVideoDecoderFactoryListType() const final { return GST_ELEMENT_FACTORY_TYPE_PARSER; }
3838
Vector<String> disallowedWebAudioDecoders() const final { return m_disallowedWebAudioDecoders; }

Source/WebCore/platform/gstreamer/GStreamerQuirkRealtek.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ GstElement* GStreamerQuirkRealtek::createWebAudioSink()
5555
return sink;
5656
}
5757

58-
bool GStreamerQuirkRealtek::configureElement(GstElement* element, const OptionSet<ElementRuntimeCharacteristics>& characteristics)
58+
void GStreamerQuirkRealtek::configureElement(GstElement* element, const OptionSet<ElementRuntimeCharacteristics>& characteristics)
5959
{
6060
if (!characteristics.contains(ElementRuntimeCharacteristics::IsMediaStream))
61-
return false;
61+
return;
6262

6363
if (gstObjectHasProperty(element, "media-tunnel")) {
6464
GST_INFO("Enable 'immediate-output' in rtkaudiosink");
@@ -69,8 +69,6 @@ bool GStreamerQuirkRealtek::configureElement(GstElement* element, const OptionSe
6969
GST_INFO("Enable 'lowdelay-mode' in rtk omx decoder");
7070
g_object_set(element, "lowdelay-mode", TRUE, nullptr);
7171
}
72-
73-
return true;
7472
}
7573

7674
std::optional<bool> GStreamerQuirkRealtek::isHardwareAccelerated(GstElementFactory* factory)

Source/WebCore/platform/gstreamer/GStreamerQuirkRealtek.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class GStreamerQuirkRealtek final : public GStreamerQuirk {
3232
const char* identifier() final { return "Realtek"; }
3333

3434
GstElement* createWebAudioSink() final;
35-
bool configureElement(GstElement*, const OptionSet<ElementRuntimeCharacteristics>&) final;
35+
void configureElement(GstElement*, const OptionSet<ElementRuntimeCharacteristics>&) final;
3636
std::optional<bool> isHardwareAccelerated(GstElementFactory*) final;
3737
Vector<String> disallowedWebAudioDecoders() const final { return m_disallowedWebAudioDecoders; }
3838

Source/WebCore/platform/gstreamer/GStreamerQuirkWesteros.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,15 @@ GStreamerQuirkWesteros::GStreamerQuirkWesteros()
5151
}
5252
}
5353

54-
bool GStreamerQuirkWesteros::configureElement(GstElement* element, const OptionSet<ElementRuntimeCharacteristics>& characteristics)
54+
void GStreamerQuirkWesteros::configureElement(GstElement* element, const OptionSet<ElementRuntimeCharacteristics>& characteristics)
5555
{
5656
if (!characteristics.contains(ElementRuntimeCharacteristics::IsMediaStream))
57-
return false;
57+
return;
5858

5959
if (!g_strcmp0(G_OBJECT_TYPE_NAME(G_OBJECT(element)), "GstWesterosSink") && gstObjectHasProperty(element, "immediate-output")) {
6060
GST_INFO("Enable 'immediate-output' in WesterosSink");
6161
g_object_set(element, "immediate-output", TRUE, nullptr);
6262
}
63-
return true;
6463
}
6564

6665
std::optional<bool> GStreamerQuirkWesteros::isHardwareAccelerated(GstElementFactory* factory)

Source/WebCore/platform/gstreamer/GStreamerQuirkWesteros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class GStreamerQuirkWesteros final : public GStreamerQuirk {
3131
GStreamerQuirkWesteros();
3232
const char* identifier() final { return "Westeros"; }
3333

34-
bool configureElement(GstElement*, const OptionSet<ElementRuntimeCharacteristics>&) final;
34+
void configureElement(GstElement*, const OptionSet<ElementRuntimeCharacteristics>&) final;
3535
std::optional<bool> isHardwareAccelerated(GstElementFactory*) final;
3636

3737
private:

Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,8 @@ bool GStreamerQuirksManager::sinksRequireClockSynchronization() const
203203
void GStreamerQuirksManager::configureElement(GstElement* element, OptionSet<ElementRuntimeCharacteristics>&& characteristics)
204204
{
205205
GST_DEBUG("Configuring element %" GST_PTR_FORMAT, element);
206-
for (const auto& quirk : m_quirks) {
207-
if (quirk->configureElement(element, characteristics))
208-
return;
209-
}
206+
for (const auto& quirk : m_quirks)
207+
quirk->configureElement(element, characteristics);
210208
}
211209

212210
std::optional<bool> GStreamerQuirksManager::isHardwareAccelerated(GstElementFactory* factory) const

Source/WebCore/platform/gstreamer/GStreamerQuirks.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class GStreamerQuirk : public GStreamerQuirkBase {
5555

5656
virtual bool isPlatformSupported() const { return true; }
5757
virtual GstElement* createWebAudioSink() { return nullptr; }
58-
virtual bool configureElement(GstElement*, const OptionSet<ElementRuntimeCharacteristics>&) { return false; }
58+
virtual void configureElement(GstElement*, const OptionSet<ElementRuntimeCharacteristics>&) { }
5959
virtual std::optional<bool> isHardwareAccelerated(GstElementFactory*) { return std::nullopt; }
6060
virtual std::optional<GstElementFactoryListType> audioVideoDecoderFactoryListType() const { return std::nullopt; }
6161
virtual Vector<String> disallowedWebAudioDecoders() const { return { }; }

0 commit comments

Comments
 (0)