Changeset 278406 in webkit
- Timestamp:
- Jun 3, 2021, 7:27:11 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp (modified) (6 diffs)
-
platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (modified) (4 diffs)
-
platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r278405 r278406 1 2021-06-03 Miguel Gomez <magomez@igalia.com> 2 3 [GStreamer] Remove dependency on glvideoflip and videoflip 4 https://bugs.webkit.org/show_bug.cgi?id=225456 5 6 Reviewed by Philippe Normand. 7 8 Stop using videoflip and glvideoflip to rotate the video frames inside GStreamer. These perform a copy 9 of the frame to perform the rotation that we can avoid if we rotate the frames ourselves when painting them. 10 11 Covered by existent tests. 12 13 * platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp: 14 (webKitGLVideoSinkConstructed): 15 (webKitGLVideoSinkGetProperty): 16 (webkit_gl_video_sink_class_init): 17 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: 18 (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): 19 (WebCore::MediaPlayerPrivateGStreamer::updateVideoSizeAndOrientationFromCaps): 20 (WebCore::MediaPlayerPrivateGStreamer::paint): 21 (WebCore::MediaPlayerPrivateGStreamer::createVideoSinkGL): 22 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: 23 1 24 2021-06-03 Antti Koivisto <antti@apple.com> 2 25 -
trunk/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp
r278253 r278406 41 41 PROP_0, 42 42 PROP_STATS, 43 PROP_HANDLES_ROTATION_TAGS,44 43 PROP_LAST 45 44 }; … … 48 47 GRefPtr<GstElement> appSink; 49 48 MediaPlayerPrivateGStreamer* mediaPlayerPrivate; 50 bool handlesRotationTags;51 49 }; 52 50 … … 84 82 GstElement* upload = makeGStreamerElement("glupload", nullptr); 85 83 GstElement* colorconvert = makeGStreamerElement("glcolorconvert", nullptr); 86 87 GstElement* videoFlip = makeGStreamerElement("glvideoflip", nullptr);88 sink->priv->handlesRotationTags = videoFlip;89 90 if (videoFlip) {91 gst_util_set_object_arg(G_OBJECT(videoFlip), "method", "automatic");92 gst_bin_add(GST_BIN_CAST(sink), videoFlip);93 }94 84 95 85 ASSERT(upload); … … 123 113 gst_element_link(upload, colorconvert); 124 114 125 if (videoFlip) 126 gst_element_link_many(colorconvert, videoFlip, sink->priv->appSink.get(), nullptr); 127 else 128 gst_element_link(colorconvert, sink->priv->appSink.get()); 115 gst_element_link(colorconvert, sink->priv->appSink.get()); 129 116 130 117 GstElement* sinkElement = … … 223 210 } 224 211 break; 225 case PROP_HANDLES_ROTATION_TAGS:226 g_value_set_boolean(value, sink->priv->handlesRotationTags);227 break;228 212 default: 229 213 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, paramSpec); … … 247 231 g_object_class_install_property(objectClass, PROP_STATS, g_param_spec_boxed("stats", "Statistics", 248 232 "Sink Statistics", GST_TYPE_STRUCTURE, static_cast<GParamFlags>(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS))); 249 250 g_object_class_install_property(objectClass, PROP_HANDLES_ROTATION_TAGS, g_param_spec_boolean("handles-rotation-tags", "Handles Rotation Tags",251 "True if the sink is relying on glvideoflip to handle frame rotation", FALSE, static_cast<GParamFlags>(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));252 233 253 234 elementClass->change_state = GST_DEBUG_FUNCPTR(webKitGLVideoSinkChangeState); -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
r278276 r278406 2803 2803 return; 2804 2804 2805 if (!m_canRenderingBeAccelerated) {2806 // If not using accelerated compositing, let GStreamer handle2807 // the image-orientation tag.2808 GstElement* videoFlip = makeGStreamerElement("videoflip", nullptr);2809 if (videoFlip) {2810 gst_util_set_object_arg(G_OBJECT(videoFlip), "method", "automatic");2811 g_object_set(m_pipeline.get(), "video-filter", videoFlip, nullptr);2812 } else2813 m_shouldHandleOrientationTags = true;2814 }2815 2816 2805 GRefPtr<GstPad> videoSinkPad = adoptGRef(gst_element_get_static_pad(m_videoSink.get(), "sink")); 2817 2806 if (videoSinkPad) … … 3059 3048 } 3060 3049 3061 if (m_shouldHandleOrientationTags) 3062 setVideoSourceOrientation(getVideoOrientation(m_videoSink.get())); 3063 3064 #if USE(TEXTURE_MAPPER_GL) 3065 // When using accelerated compositing, if the video is tagged as rotated 90 or 270 degrees, swap width and height. 3066 if (m_canRenderingBeAccelerated) { 3067 if (m_videoSourceOrientation.usesWidthAsHeight()) 3068 originalSize = originalSize.transposedSize(); 3069 } 3070 #endif 3050 setVideoSourceOrientation(getVideoOrientation(m_videoSink.get())); 3051 // If the video is tagged as rotated 90 or 270 degrees, swap width and height. 3052 if (m_videoSourceOrientation.usesWidthAsHeight()) 3053 originalSize = originalSize.transposedSize(); 3071 3054 3072 3055 GST_DEBUG_OBJECT(pipeline(), "Original video size: %dx%d", originalSize.width(), originalSize.height()); … … 3327 3310 return; 3328 3311 3329 context.drawImage(gstImage->image(), rect, gstImage->rect(), { gstImage->hasAlpha() ? CompositeOperator::SourceOver : CompositeOperator::Copy, m_shouldHandleOrientationTags ? m_videoSourceOrientation : ImageOrientation() }); 3312 FloatRect imageRect = m_videoSourceOrientation.usesWidthAsHeight() ? FloatRect(gstImage->rect().location(), gstImage->rect().size().transposedSize()) : gstImage->rect(); 3313 3314 context.drawImage(gstImage->image(), rect, imageRect, { gstImage->hasAlpha() ? CompositeOperator::SourceOver : CompositeOperator::Copy, m_videoSourceOrientation }); 3330 3315 } 3331 3316 … … 3430 3415 webKitGLVideoSinkSetMediaPlayerPrivate(WEBKIT_GL_VIDEO_SINK(sink), this); 3431 3416 3432 gboolean handlesRotationTags;3433 g_object_get(sink, "handles-rotation-tags", &handlesRotationTags, nullptr);3434 m_shouldHandleOrientationTags = !handlesRotationTags;3435 3436 3417 return sink; 3437 3418 } -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
r278253 r278406 563 563 uint64_t m_droppedVideoFrames { 0 }; 564 564 565 // This is set to true if no videoflip element has been added to the pipeline.566 bool m_shouldHandleOrientationTags { false };567 568 565 DataMutex<TaskAtMediaTimeScheduler> m_TaskAtMediaTimeSchedulerDataMutex; 569 566
Note:
See TracChangeset
for help on using the changeset viewer.