Title: [242881] trunk/Source/WebCore
Revision
242881
Author
[email protected]
Date
2019-03-13 08:28:08 -0700 (Wed, 13 Mar 2019)

Log Message

[GStreamer][WebRTC]: Use codec setting video height/width as fallback
https://bugs.webkit.org/show_bug.cgi?id=195675

Patch by Thibault Saunier <[email protected]> on 2019-03-13
Reviewed by Philippe Normand.

In some cases the frame height and width is not set (not sure why/ in
what conditions but it happens) so make sure to get the information from
the VideoCodec when configuring the encoder.

* platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
(WebCore::GStreamerVideoDecoder::GStreamerVideoDecoder):
(WebCore::GStreamerVideoDecoder::GetCapsForFrame):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (242880 => 242881)


--- trunk/Source/WebCore/ChangeLog	2019-03-13 11:27:08 UTC (rev 242880)
+++ trunk/Source/WebCore/ChangeLog	2019-03-13 15:28:08 UTC (rev 242881)
@@ -1,3 +1,18 @@
+2019-03-13  Thibault Saunier  <[email protected]>
+
+        [GStreamer][WebRTC]: Use codec setting video height/width as fallback
+        https://bugs.webkit.org/show_bug.cgi?id=195675
+
+        Reviewed by Philippe Normand.
+
+        In some cases the frame height and width is not set (not sure why/ in
+        what conditions but it happens) so make sure to get the information from
+        the VideoCodec when configuring the encoder.
+
+        * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
+        (WebCore::GStreamerVideoDecoder::GStreamerVideoDecoder):
+        (WebCore::GStreamerVideoDecoder::GetCapsForFrame):
+
 2019-03-13  Miguel Gomez  <[email protected]>
 
         [CoordinatedGraphics] Null dereference in CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded

Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp (242880 => 242881)


--- trunk/Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp	2019-03-13 11:27:08 UTC (rev 242880)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp	2019-03-13 15:28:08 UTC (rev 242881)
@@ -54,6 +54,8 @@
 public:
     GStreamerVideoDecoder()
         : m_pictureId(0)
+        , m_width(0)
+        , m_height(0)
         , m_firstBufferPts(GST_CLOCK_TIME_NONE)
         , m_firstBufferDts(GST_CLOCK_TIME_NONE)
     {
@@ -80,7 +82,7 @@
         return gst_element_factory_make(factoryName, name.get());
     }
 
-    int32_t InitDecode(const webrtc::VideoCodec*, int32_t) override
+    int32_t InitDecode(const webrtc::VideoCodec* codecSettings, int32_t) override
     {
         m_src = makeElement("appsrc");
 
@@ -87,6 +89,11 @@
         auto capsfilter = CreateFilter();
         auto decoder = makeElement("decodebin");
 
+        if (codecSettings) {
+            m_width = codecSettings->width;
+            m_height = codecSettings->height;
+        }
+
         // Make the decoder output "parsed" frames only and let the main decodebin
         // do the real decoding. This allows us to have optimized decoding/rendering
         // happening in the main pipeline.
@@ -193,8 +200,8 @@
     {
         if (!m_caps) {
             m_caps = adoptGRef(gst_caps_new_simple(Caps(),
-                "width", G_TYPE_INT, image._encodedWidth,
-                "height", G_TYPE_INT, image._encodedHeight,
+                "width", G_TYPE_INT, image._encodedWidth ? image._encodedWidth : m_width,
+                "height", G_TYPE_INT, image._encodedHeight ? image._encodedHeight : m_height,
                 nullptr));
         }
 
@@ -269,6 +276,8 @@
 protected:
     GRefPtr<GstCaps> m_caps;
     gint m_pictureId;
+    gint m_width;
+    gint m_height;
 
 private:
     static GstFlowReturn newSampleCallbackTramp(GstElement* sink, GStreamerVideoDecoder* enc)
@@ -327,10 +336,8 @@
     {
         if (!m_caps) {
             m_caps = adoptGRef(gst_caps_new_simple(Caps(),
-                "width", G_TYPE_INT, image._encodedWidth,
-                "height", G_TYPE_INT, image._encodedHeight,
-                "profile", G_TYPE_STRING, m_profile ? m_profile : "baseline",
-                "stream-format", G_TYPE_STRING, "byte-stream",
+                "width", G_TYPE_INT, image._encodedWidth ? image._encodedWidth : m_width,
+                "height", G_TYPE_INT, image._encodedHeight ? image._encodedHeight : m_height,
                 "alignment", G_TYPE_STRING, "au",
                 nullptr));
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to