Changeset 237800 in webkit


Ignore:
Timestamp:
Nov 5, 2018, 7:05:39 AM (7 years ago)
Author:
commit-queue@webkit.org
Message:

[GStreamer][WebRTC] properly mark H.264 stream type in the "decoder"
https://bugs.webkit.org/show_bug.cgi?id=190676

Patch by Thibault Saunier <tsaunier@igalia.com> on 2018-11-05
Reviewed by Philippe Normand.

Avoiding to have h264parse make assumption (which might be wrong at some
point).

  • platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:

(WebCore::GStreamerVideoDecoder::GetCapsForFrame):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r237799 r237800  
     12018-11-05  Thibault Saunier  <tsaunier@igalia.com>
     2
     3        [GStreamer][WebRTC] properly mark H.264 stream type in the "decoder"
     4        https://bugs.webkit.org/show_bug.cgi?id=190676
     5
     6        Reviewed by Philippe Normand.
     7
     8        Avoiding to have h264parse make assumption (which might be wrong at some
     9        point).
     10
     11        * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
     12        (WebCore::GStreamerVideoDecoder::GetCapsForFrame):
     13
    1142018-11-05  Thibault Saunier  <tsaunier@igalia.com>
    215
  • trunk/Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp

    r237075 r237800  
    7575    }
    7676
    77     int32_t InitDecode(const webrtc::VideoCodec*, int32_t)
     77    int32_t InitDecode(const webrtc::VideoCodec*, int32_t) override
    7878    {
    7979        m_src = makeElement("appsrc");
     
    183183    }
    184184
    185     GstCaps* GetCapsForFrame(const webrtc::EncodedImage& image)
     185    virtual GstCaps* GetCapsForFrame(const webrtc::EncodedImage& image)
    186186    {
    187187        if (!m_caps) {
     
    276276public:
    277277    H264Decoder() { }
     278
     279    int32_t InitDecode(const webrtc::VideoCodec* codecInfo, int32_t nCores) final
     280    {
     281        if (codecInfo && codecInfo->codecType != webrtc::kVideoCodecH264)
     282            return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
     283
     284        m_profile = nullptr;
     285        if (codecInfo) {
     286            auto h264Info = codecInfo->H264();
     287
     288            switch (h264Info.profile) {
     289            case webrtc::H264::kProfileConstrainedBaseline:
     290                m_profile = "constrained-baseline";
     291                break;
     292            case webrtc::H264::kProfileBaseline:
     293                m_profile = "baseline";
     294                break;
     295            case webrtc::H264::kProfileMain:
     296                m_profile = "main";
     297                break;
     298            case webrtc::H264::kProfileConstrainedHigh:
     299                m_profile = "constrained-high";
     300                break;
     301            case webrtc::H264::kProfileHigh:
     302                m_profile = "high";
     303                break;
     304            }
     305        }
     306
     307        return GStreamerVideoDecoder::InitDecode(codecInfo, nCores);
     308    }
     309
     310    GstCaps* GetCapsForFrame(const webrtc::EncodedImage& image) final
     311    {
     312        if (!m_caps) {
     313            m_caps = adoptGRef(gst_caps_new_simple(Caps(),
     314                "width", G_TYPE_INT, image._encodedWidth,
     315                "height", G_TYPE_INT, image._encodedHeight,
     316                "profile", G_TYPE_STRING, m_profile ? m_profile : "baseline",
     317                "stream-format", G_TYPE_STRING, "byte-stream",
     318                "alignment", G_TYPE_STRING, "au",
     319                nullptr));
     320        }
     321
     322        return m_caps.get();
     323    }
    278324    const gchar* Caps() final { return "video/x-h264"; }
    279325    const gchar* Name() final { return cricket::kH264CodecName; }
    280326    webrtc::VideoCodecType CodecType() final { return webrtc::kVideoCodecH264; }
     327
     328private:
     329    const gchar* m_profile;
    281330};
    282331
Note: See TracChangeset for help on using the changeset viewer.