Diff
Modified: trunk/Source/WebCore/ChangeLog (278405 => 278406)
--- trunk/Source/WebCore/ChangeLog 2021-06-03 13:39:56 UTC (rev 278405)
+++ trunk/Source/WebCore/ChangeLog 2021-06-03 14:27:11 UTC (rev 278406)
@@ -1,3 +1,26 @@
+2021-06-03 Miguel Gomez <[email protected]>
+
+ [GStreamer] Remove dependency on glvideoflip and videoflip
+ https://bugs.webkit.org/show_bug.cgi?id=225456
+
+ Reviewed by Philippe Normand.
+
+ Stop using videoflip and glvideoflip to rotate the video frames inside GStreamer. These perform a copy
+ of the frame to perform the rotation that we can avoid if we rotate the frames ourselves when painting them.
+
+ Covered by existent tests.
+
+ * platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
+ (webKitGLVideoSinkConstructed):
+ (webKitGLVideoSinkGetProperty):
+ (webkit_gl_video_sink_class_init):
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+ (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
+ (WebCore::MediaPlayerPrivateGStreamer::updateVideoSizeAndOrientationFromCaps):
+ (WebCore::MediaPlayerPrivateGStreamer::paint):
+ (WebCore::MediaPlayerPrivateGStreamer::createVideoSinkGL):
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+
2021-06-03 Antti Koivisto <[email protected]>
Rename InlineFlowBox to LegacyInlineFlowBox
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp (278405 => 278406)
--- trunk/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp 2021-06-03 13:39:56 UTC (rev 278405)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp 2021-06-03 14:27:11 UTC (rev 278406)
@@ -40,7 +40,6 @@
enum {
PROP_0,
PROP_STATS,
- PROP_HANDLES_ROTATION_TAGS,
PROP_LAST
};
@@ -47,7 +46,6 @@
struct _WebKitGLVideoSinkPrivate {
GRefPtr<GstElement> appSink;
MediaPlayerPrivateGStreamer* mediaPlayerPrivate;
- bool handlesRotationTags;
};
GST_DEBUG_CATEGORY_STATIC(webkit_gl_video_sink_debug);
@@ -84,14 +82,6 @@
GstElement* upload = makeGStreamerElement("glupload", nullptr);
GstElement* colorconvert = makeGStreamerElement("glcolorconvert", nullptr);
- GstElement* videoFlip = makeGStreamerElement("glvideoflip", nullptr);
- sink->priv->handlesRotationTags = videoFlip;
-
- if (videoFlip) {
- gst_util_set_object_arg(G_OBJECT(videoFlip), "method", "automatic");
- gst_bin_add(GST_BIN_CAST(sink), videoFlip);
- }
-
ASSERT(upload);
ASSERT(colorconvert);
gst_bin_add_many(GST_BIN_CAST(sink), upload, colorconvert, sink->priv->appSink.get(), nullptr);
@@ -122,10 +112,7 @@
gst_element_link(imxVideoConvertG2D, upload);
gst_element_link(upload, colorconvert);
- if (videoFlip)
- gst_element_link_many(colorconvert, videoFlip, sink->priv->appSink.get(), nullptr);
- else
- gst_element_link(colorconvert, sink->priv->appSink.get());
+ gst_element_link(colorconvert, sink->priv->appSink.get());
GstElement* sinkElement =
[&] {
@@ -222,9 +209,6 @@
gst_value_set_structure(value, stats.get());
}
break;
- case PROP_HANDLES_ROTATION_TAGS:
- g_value_set_boolean(value, sink->priv->handlesRotationTags);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, paramSpec);
RELEASE_ASSERT_NOT_REACHED();
@@ -247,9 +231,6 @@
g_object_class_install_property(objectClass, PROP_STATS, g_param_spec_boxed("stats", "Statistics",
"Sink Statistics", GST_TYPE_STRUCTURE, static_cast<GParamFlags>(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
- g_object_class_install_property(objectClass, PROP_HANDLES_ROTATION_TAGS, g_param_spec_boolean("handles-rotation-tags", "Handles Rotation Tags",
- "True if the sink is relying on glvideoflip to handle frame rotation", FALSE, static_cast<GParamFlags>(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
-
elementClass->change_state = GST_DEBUG_FUNCPTR(webKitGLVideoSinkChangeState);
}
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (278405 => 278406)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2021-06-03 13:39:56 UTC (rev 278405)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2021-06-03 14:27:11 UTC (rev 278406)
@@ -2802,17 +2802,6 @@
if (!m_player->isVideoPlayer())
return;
- if (!m_canRenderingBeAccelerated) {
- // If not using accelerated compositing, let GStreamer handle
- // the image-orientation tag.
- GstElement* videoFlip = makeGStreamerElement("videoflip", nullptr);
- if (videoFlip) {
- gst_util_set_object_arg(G_OBJECT(videoFlip), "method", "automatic");
- g_object_set(m_pipeline.get(), "video-filter", videoFlip, nullptr);
- } else
- m_shouldHandleOrientationTags = true;
- }
-
GRefPtr<GstPad> videoSinkPad = adoptGRef(gst_element_get_static_pad(m_videoSink.get(), "sink"));
if (videoSinkPad)
g_signal_connect(videoSinkPad.get(), "notify::caps", G_CALLBACK(+[](GstPad* videoSinkPad, GParamSpec*, MediaPlayerPrivateGStreamer* player) {
@@ -3058,17 +3047,11 @@
return;
}
- if (m_shouldHandleOrientationTags)
- setVideoSourceOrientation(getVideoOrientation(m_videoSink.get()));
+ setVideoSourceOrientation(getVideoOrientation(m_videoSink.get()));
+ // If the video is tagged as rotated 90 or 270 degrees, swap width and height.
+ if (m_videoSourceOrientation.usesWidthAsHeight())
+ originalSize = originalSize.transposedSize();
-#if USE(TEXTURE_MAPPER_GL)
- // When using accelerated compositing, if the video is tagged as rotated 90 or 270 degrees, swap width and height.
- if (m_canRenderingBeAccelerated) {
- if (m_videoSourceOrientation.usesWidthAsHeight())
- originalSize = originalSize.transposedSize();
- }
-#endif
-
GST_DEBUG_OBJECT(pipeline(), "Original video size: %dx%d", originalSize.width(), originalSize.height());
GST_DEBUG_OBJECT(pipeline(), "Pixel aspect ratio: %d/%d", pixelAspectRatioNumerator, pixelAspectRatioDenominator);
@@ -3326,7 +3309,9 @@
if (!gstImage)
return;
- context.drawImage(gstImage->image(), rect, gstImage->rect(), { gstImage->hasAlpha() ? CompositeOperator::SourceOver : CompositeOperator::Copy, m_shouldHandleOrientationTags ? m_videoSourceOrientation : ImageOrientation() });
+ FloatRect imageRect = m_videoSourceOrientation.usesWidthAsHeight() ? FloatRect(gstImage->rect().location(), gstImage->rect().size().transposedSize()) : gstImage->rect();
+
+ context.drawImage(gstImage->image(), rect, imageRect, { gstImage->hasAlpha() ? CompositeOperator::SourceOver : CompositeOperator::Copy, m_videoSourceOrientation });
}
#if USE(GSTREAMER_GL)
@@ -3429,10 +3414,6 @@
ASSERT(sink);
webKitGLVideoSinkSetMediaPlayerPrivate(WEBKIT_GL_VIDEO_SINK(sink), this);
- gboolean handlesRotationTags;
- g_object_get(sink, "handles-rotation-tags", &handlesRotationTags, nullptr);
- m_shouldHandleOrientationTags = !handlesRotationTags;
-
return sink;
}
#endif // USE(GSTREAMER_GL)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (278405 => 278406)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h 2021-06-03 13:39:56 UTC (rev 278405)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h 2021-06-03 14:27:11 UTC (rev 278406)
@@ -562,9 +562,6 @@
uint64_t m_totalVideoFrames { 0 };
uint64_t m_droppedVideoFrames { 0 };
- // This is set to true if no videoflip element has been added to the pipeline.
- bool m_shouldHandleOrientationTags { false };
-
DataMutex<TaskAtMediaTimeScheduler> m_TaskAtMediaTimeSchedulerDataMutex;
private: