Title: [293149] trunk/Source/WebCore
Revision
293149
Author
vjaq...@igalia.com
Date
2022-04-21 02:35:54 -0700 (Thu, 21 Apr 2022)

Log Message

[GTK][WPE] Update libwebrtc API usage for video encoder factory
https://bugs.webkit.org/show_bug.cgi?id=239558

Reviewed by Philippe Normand.

Update GstreamerVideoEncoderFactory with current libwebrtc API.

No new tests required.

* platform/mediastream/libwebrtc/gstreamer/GStreamerVideoEncoderFactory.cpp:
(WebCore::GStreamerVideoEncoder::GStreamerVideoEncoder): Chain main constructor rather to
copy its initializations.
Update InitEncode method signature.
Remove deprecated attributes of EncoderInfo.
Fix code-style.
(WebCore::GStreamerH264Encoder::GStreamerH264Encoder): Remove unused class attribute and fix
a memleak.
* platform/mediastream/libwebrtc/gstreamer/GStreamerVideoEncoderFactory.h: Remove deprecated
method.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (293148 => 293149)


--- trunk/Source/WebCore/ChangeLog	2022-04-21 09:28:56 UTC (rev 293148)
+++ trunk/Source/WebCore/ChangeLog	2022-04-21 09:35:54 UTC (rev 293149)
@@ -1,3 +1,25 @@
+2022-04-21  Víctor Manuel Jáquez Leal  <vjaq...@igalia.com>
+
+        [GTK][WPE] Update libwebrtc API usage for video encoder factory
+        https://bugs.webkit.org/show_bug.cgi?id=239558
+
+        Reviewed by Philippe Normand.
+
+        Update GstreamerVideoEncoderFactory with current libwebrtc API.
+
+        No new tests required.
+
+        * platform/mediastream/libwebrtc/gstreamer/GStreamerVideoEncoderFactory.cpp:
+        (WebCore::GStreamerVideoEncoder::GStreamerVideoEncoder): Chain main constructor rather to
+        copy its initializations.
+        Update InitEncode method signature.
+        Remove deprecated attributes of EncoderInfo.
+        Fix code-style.
+        (WebCore::GStreamerH264Encoder::GStreamerH264Encoder): Remove unused class attribute and fix
+        a memleak.
+        * platform/mediastream/libwebrtc/gstreamer/GStreamerVideoEncoderFactory.h: Remove deprecated
+        method.
+
 2022-04-21  Rob Buis  <rb...@igalia.com>
 
         Skip release assert during container query resolution

Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoEncoderFactory.cpp (293148 => 293149)


--- trunk/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoEncoderFactory.cpp	2022-04-21 09:28:56 UTC (rev 293148)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoEncoderFactory.cpp	2022-04-21 09:35:54 UTC (rev 293149)
@@ -87,10 +87,10 @@
     WTF_MAKE_FAST_ALLOCATED;
 public:
     GStreamerVideoEncoder(const webrtc::SdpVideoFormat&)
-        : m_firstFramePts(GST_CLOCK_TIME_NONE)
-        , m_restrictionCaps(adoptGRef(gst_caps_new_empty_simple("video/x-raw")))
+        : GStreamerVideoEncoder()
     {
     }
+
     GStreamerVideoEncoder()
         : m_firstFramePts(GST_CLOCK_TIME_NONE)
         , m_restrictionCaps(adoptGRef(gst_caps_new_empty_simple("video/x-raw")))
@@ -123,7 +123,7 @@
         return elem;
     }
 
-    int32_t InitEncode(const webrtc::VideoCodec* codecSettings, int32_t, size_t) override
+    int32_t InitEncode(const webrtc::VideoCodec* codecSettings, const webrtc::VideoEncoder::Settings&) override
     {
         g_return_val_if_fail(codecSettings, WEBRTC_VIDEO_CODEC_ERR_PARAMETER);
         g_return_val_if_fail(codecSettings->codecType == CodecType(), WEBRTC_VIDEO_CODEC_ERR_PARAMETER);
@@ -201,17 +201,13 @@
 
     VideoEncoder::EncoderInfo GetEncoderInfo() const override
     {
-        EncoderInfo info;
-        info.supports_native_handle = false;
+        VideoEncoder::EncoderInfo info;
         info.implementation_name = "GStreamer";
         info.has_trusted_rate_controller = true;
-        info.is_hardware_accelerated = true;
-        info.has_internal_source = false;
         return info;
     }
 
-    int32_t Encode(const webrtc::VideoFrame& frame,
-        const std::vector<webrtc::VideoFrameType>* frameTypes) final
+    int32_t Encode(const webrtc::VideoFrame& frame, const std::vector<webrtc::VideoFrameType>* frameTypes) final
     {
         int32_t res;
 
@@ -274,8 +270,7 @@
         m_encodedFrame.capture_time_ms_ = frame.render_time_ms();
         m_encodedFrame.SetTimestamp(frame.timestamp());
 
-        GST_LOG_OBJECT(m_pipeline.get(), "Got buffer capture_time_ms: %" G_GINT64_FORMAT " _timestamp: %u",
-            m_encodedFrame.capture_time_ms_, m_encodedFrame.Timestamp());
+        GST_LOG_OBJECT(m_pipeline.get(), "Got buffer capture_time_ms: %" G_GINT64_FORMAT " _timestamp: %u", m_encodedFrame.capture_time_ms_, m_encodedFrame.Timestamp());
 
         webrtc::CodecSpecificInfo codecInfo;
         PopulateCodecSpecific(&codecInfo, encodedBuffer);
@@ -351,8 +346,7 @@
     GStreamerH264Encoder() { }
 
     GStreamerH264Encoder(const webrtc::SdpVideoFormat& format)
-        : m_parser(gst_h264_nal_parser_new())
-        , packetizationMode(webrtc::H264PacketizationMode::NonInterleaved)
+        : packetizationMode(webrtc::H264PacketizationMode::NonInterleaved)
     {
         auto it = format.parameters.find(cricket::kH264FmtpPacketizationMode);
 
@@ -372,7 +366,6 @@
 
     const gchar* Caps() final { return "video/x-h264"; }
     const gchar* Name() final { return cricket::kH264CodecName; }
-    GstH264NalParser* m_parser;
     webrtc::VideoCodecType CodecType() final { return webrtc::kVideoCodecH264; }
 
     void PopulateCodecSpecific(webrtc::CodecSpecificInfo* codecSpecificInfos, const GstBuffer*) final

Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoEncoderFactory.h (293148 => 293149)


--- trunk/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoEncoderFactory.h	2022-04-21 09:28:56 UTC (rev 293148)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoEncoderFactory.h	2022-04-21 09:35:54 UTC (rev 293149)
@@ -28,6 +28,7 @@
 
 class GStreamerVideoEncoderFactory final : public webrtc::VideoEncoderFactory {
     WTF_MAKE_FAST_ALLOCATED;
+
 public:
     GStreamerVideoEncoderFactory(bool isSupportingVP9Profile0, bool isSupportingVP9Profile2);
 
@@ -34,13 +35,7 @@
 private:
     std::vector<webrtc::SdpVideoFormat> GetSupportedFormats() const override;
     std::unique_ptr<webrtc::VideoEncoder> CreateVideoEncoder(const webrtc::SdpVideoFormat&) final;
-    CodecInfo QueryVideoEncoder(const webrtc::SdpVideoFormat&) const override
-    {
-        // FIXME: Detect whether the decoder is HW accelerated.
 
-        return { false };
-    }
-
     bool m_isSupportingVP9Profile0;
     bool m_isSupportingVP9Profile2;
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to