Skip to content

Commit 1573c3c

Browse files
committed
Quirks: Add fakevideosink hole-punch quirk
1 parent f593a19 commit 1573c3c

3 files changed

Lines changed: 45 additions & 4 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4036,7 +4036,7 @@ class GStreamerHolePunchClient : public TextureMapperPlatformLayerBuffer::HolePu
40364036
bool MediaPlayerPrivateGStreamer::isHolePunchRenderingEnabled() const
40374037
{
40384038
auto& quirksManager = GStreamerQuirksManager::singleton();
4039-
return quirksManager.isEnabled() && quirksManager.supportsVideoHolePunchRendering();
4039+
return quirksManager.supportsVideoHolePunchRendering();
40404040
}
40414041

40424042
GstElement* MediaPlayerPrivateGStreamer::createHolePunchVideoSink()
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (C) 2024 Igalia S.L
3+
* Copyright (C) 2024 Metrological Group B.V.
4+
*
5+
* This library is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Library General Public
7+
* License as published by the Free Software Foundation; either
8+
* version 2 of the License, or (at your option) any later version.
9+
*
10+
* This library is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* Library General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Library General Public License
16+
* aint with this library; see the file COPYING.LIB. If not, write to
17+
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18+
* Boston, MA 02110-1301, USA.
19+
*/
20+
21+
#pragma once
22+
23+
#if USE(GSTREAMER)
24+
25+
#include "GStreamerCommon.h"
26+
#include "GStreamerQuirks.h"
27+
28+
namespace WebCore {
29+
30+
class GStreamerHolePunchQuirkFake final : public GStreamerHolePunchQuirk {
31+
public:
32+
const char* identifier() final { return "FakeHolePunch"; }
33+
GstElement* createHolePunchVideoSink(bool, const MediaPlayer*) final { return makeGStreamerElement("fakevideosink", nullptr); }
34+
bool setHolePunchVideoRectangle(GstElement*, const IntRect&) final { return true; }
35+
};
36+
37+
} // namespace WebCore
38+
39+
#endif // USE(GSTREAMER)

Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include "GStreamerCommon.h"
2727
#include "GStreamerHolePunchQuirkBcmNexus.h"
28+
#include "GStreamerHolePunchQuirkFake.h"
2829
#include "GStreamerHolePunchQuirkWesteros.h"
2930
#include "GStreamerQuirkAmLogic.h"
3031
#include "GStreamerQuirkBcmNexus.h"
@@ -126,7 +127,7 @@ GStreamerQuirksManager::GStreamerQuirksManager()
126127
return;
127128

128129
if (WTF::equalLettersIgnoringASCIICase(holePunchQuirk, "help"_s)) {
129-
WTFLogAlways("Supported quirks for WEBKIT_GST_HOLE_PUNCH_QUIRK are: westeros, bcmnexus");
130+
WTFLogAlways("Supported quirks for WEBKIT_GST_HOLE_PUNCH_QUIRK are: fake, westeros, bcmnexus");
130131
return;
131132
}
132133

@@ -135,6 +136,8 @@ GStreamerQuirksManager::GStreamerQuirksManager()
135136
m_holePunchQuirk = WTF::makeUnique<GStreamerHolePunchQuirkBcmNexus>();
136137
else if (WTF::equalLettersIgnoringASCIICase(holePunchQuirk, "westeros"_s))
137138
m_holePunchQuirk = WTF::makeUnique<GStreamerHolePunchQuirkWesteros>();
139+
else if (WTF::equalLettersIgnoringASCIICase(holePunchQuirk, "fake"_s))
140+
m_holePunchQuirk = WTF::makeUnique<GStreamerHolePunchQuirkFake>();
138141
else
139142
GST_WARNING("HolePunch quirk %s un-supported.", holePunchQuirk.ascii().data());
140143
}
@@ -161,8 +164,7 @@ GstElement* GStreamerQuirksManager::createWebAudioSink()
161164

162165
GstElement* GStreamerQuirksManager::createHolePunchVideoSink(bool isLegacyPlaybin, const MediaPlayer* player)
163166
{
164-
RELEASE_ASSERT_WITH_MESSAGE(isEnabled() && m_holePunchQuirk, "createHolePunchVideoSink() should be called only if one hole-punch quirk was requested");
165-
if (!isEnabled() || !m_holePunchQuirk) {
167+
if (!m_holePunchQuirk) {
166168
GST_DEBUG("None of the quirks requested a HolePunchSink");
167169
return nullptr;
168170
}

0 commit comments

Comments
 (0)