⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 278406 in webkit


Ignore:
Timestamp:
Jun 3, 2021, 7:27:11 AM (5 years ago)
Author:
magomez@igalia.com
Message:

[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:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r278405 r278406  
     12021-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
    1242021-06-03  Antti Koivisto  <antti@apple.com>
    225
  • trunk/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp

    r278253 r278406  
    4141    PROP_0,
    4242    PROP_STATS,
    43     PROP_HANDLES_ROTATION_TAGS,
    4443    PROP_LAST
    4544};
    … …  
    4847    GRefPtr<GstElement> appSink;
    4948    MediaPlayerPrivateGStreamer* mediaPlayerPrivate;
    50     bool handlesRotationTags;
    5149};
    5250
    … …  
    8482    GstElement* upload = makeGStreamerElement("glupload", nullptr);
    8583    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     }
    9484
    9585    ASSERT(upload);
    … …  
    123113    gst_element_link(upload, colorconvert);
    124114
    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());
    129116
    130117    GstElement* sinkElement =
    … …  
    223210        }
    224211        break;
    225     case PROP_HANDLES_ROTATION_TAGS:
    226         g_value_set_boolean(value, sink->priv->handlesRotationTags);
    227         break;
    228212    default:
    229213        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, paramSpec);
    … …  
    247231    g_object_class_install_property(objectClass, PROP_STATS, g_param_spec_boxed("stats", "Statistics",
    248232        "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)));
    252233
    253234    elementClass->change_state = GST_DEBUG_FUNCPTR(webKitGLVideoSinkChangeState);
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

    r278276 r278406  
    28032803        return;
    28042804
    2805     if (!m_canRenderingBeAccelerated) {
    2806         // If not using accelerated compositing, let GStreamer handle
    2807         // 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         } else
    2813             m_shouldHandleOrientationTags = true;
    2814     }
    2815 
    28162805    GRefPtr<GstPad> videoSinkPad = adoptGRef(gst_element_get_static_pad(m_videoSink.get(), "sink"));
    28172806    if (videoSinkPad)
    … …  
    30593048    }
    30603049
    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();
    30713054
    30723055    GST_DEBUG_OBJECT(pipeline(), "Original video size: %dx%d", originalSize.width(), originalSize.height());
    … …  
    33273310        return;
    33283311
    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 });
    33303315}
    33313316
    … …  
    34303415    webKitGLVideoSinkSetMediaPlayerPrivate(WEBKIT_GL_VIDEO_SINK(sink), this);
    34313416
    3432     gboolean handlesRotationTags;
    3433     g_object_get(sink, "handles-rotation-tags", &handlesRotationTags, nullptr);
    3434     m_shouldHandleOrientationTags = !handlesRotationTags;
    3435 
    34363417    return sink;
    34373418}
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h

    r278253 r278406  
    563563    uint64_t m_droppedVideoFrames { 0 };
    564564
    565     // This is set to true if no videoflip element has been added to the pipeline.
    566     bool m_shouldHandleOrientationTags { false };
    567 
    568565    DataMutex<TaskAtMediaTimeScheduler> m_TaskAtMediaTimeSchedulerDataMutex;
    569566
Note: See TracChangeset for help on using the changeset viewer.