Changeset 276491 in webkit
- Timestamp:
- Apr 23, 2021, 2:23:04 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 12 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/platform/glib/TestExpectations (modified) (3 diffs)
-
LayoutTests/platform/glib/imported/w3c/web-platform-tests/webrtc (added)
-
LayoutTests/platform/glib/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-onnegotiationneeded-expected.txt (added)
-
LayoutTests/platform/glib/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-restartIce.https-expected.txt (added)
-
LayoutTests/platform/glib/imported/w3c/web-platform-tests/webrtc/RTCRtpTransceiver-setCodecPreferences-expected.txt (added)
-
Source/ThirdParty/libwebrtc/CMakeLists.txt (modified) (7 diffs)
-
Source/ThirdParty/libwebrtc/ChangeLog (modified) (1 diff)
-
Source/ThirdParty/libwebrtc/Source/webrtc/common_video/h265/h265_pps_parser.h (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp (modified) (4 diffs)
-
Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.h (modified) (2 diffs)
-
Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp (modified) (2 diffs)
-
Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp (modified) (15 diffs)
-
Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.h (modified) (3 diffs)
-
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderGStreamer.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r276489 r276491 1 2021-04-23 Philippe Normand <pnormand@igalia.com> 2 3 [LibWebRTC][WPE][GTK] Enable vp9 and NO_MAIN_THREAD_WRAPPING 4 https://bugs.webkit.org/show_bug.cgi?id=222795 5 6 Reviewed by Xabier Rodriguez-Calvar. 7 8 Update GLIB baselines for webrtc tests. 9 10 * platform/glib/TestExpectations: 11 * platform/glib/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-onnegotiationneeded-expected.txt: Added. 12 * platform/glib/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-restartIce.https-expected.txt: Added. 13 * platform/glib/imported/w3c/web-platform-tests/webrtc/RTCRtpTransceiver-setCodecPreferences-expected.txt: Added. 14 1 15 2021-04-22 Diego Pino Garcia <dpino@igalia.com> 2 16 -
trunk/LayoutTests/platform/glib/TestExpectations
r276489 r276491 1121 1121 webkit.org/b/212809 [ Release ] webrtc/datachannel/gather-candidates-networkprocess-crash.html [ Timeout Pass ] 1122 1122 1123 webkit.org/b/213780 webrtc/vp9.html [ Failure ]1124 1125 1123 webkit.org/b/215005 webkit.org/b/218787 webrtc/h264-baseline.html [ Crash Timeout ] 1126 1124 # h264-high.html is marked as slow in the root expectation … … 1139 1137 webkit.org/b/216763 webrtc/captureCanvas-webrtc-software-h264-high.html [ Crash Failure ] 1140 1138 1141 webkit.org/b/218221 webrtc/vp9-profile2.html [ Failure ]1139 webkit.org/b/218221 webrtc/vp9-profile2.html [ Timeout Failure ] 1142 1140 1143 1141 # Release timing out. … … 2028 2026 webkit.org/b/186100 fast/hidpi/filters-turbulence.html [ ImageOnlyFailure ] 2029 2027 webkit.org/b/187044 webanimations/opacity-animation-yields-compositing-span.html [ Failure ] 2030 webkit.org/b/187064 webrtc/audio-peer-connection-g722.html 2031 webkit.org/b/187064 webrtc/ captureCanvas-webrtc.html2028 2029 webkit.org/b/187064 webrtc/libwebrtc/descriptionGetters.html 2032 2030 webkit.org/b/187064 webrtc/datachannel/mdns-ice-candidates.html 2033 webkit.org/b/187064 webrtc/libwebrtc/descriptionGetters.html2034 webkit.org/b/187064 webrtc/peer-connection-track-end.html2035 2031 webkit.org/b/187064 webrtc/video-addTrack.html 2036 webkit.org/b/187064 webrtc/video-addTransceiver.html2037 2032 webkit.org/b/187064 webrtc/video-disabled-black.html 2038 webkit.org/b/187064 webrtc/video.html2039 webkit.org/b/187064 webrtc/video-mute.html2040 2033 webkit.org/b/187064 webrtc/video-remote-mute.html 2041 2034 webkit.org/b/187064 webrtc/video-replace-muted-track.html 2042 webkit.org/b/187064 webrtc/video-replace-track.html2043 2035 webkit.org/b/187064 webrtc/video-rotation.html 2044 webkit.org/b/187064 webrtc/video-unmute.html2045 2036 webkit.org/b/187064 webrtc/video-with-data-channel.html 2037 webkit.org/b/187064 webrtc/video-replace-track.html [ Failure Pass ] 2038 webkit.org/b/187064 imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-getStats.https.html [ Failure Pass ] 2039 2046 2040 webkit.org/b/187271 fast/text/emoji-with-joiner.html [ Failure ] 2047 2041 webkit.org/b/189343 imported/w3c/web-platform-tests/xhr/sync-no-timeout.any.worker.html [ Failure ] -
trunk/Source/ThirdParty/libwebrtc/CMakeLists.txt
r276019 r276491 539 539 Source/webrtc/common_video/h264/sps_parser.cc 540 540 Source/webrtc/common_video/h264/sps_vui_rewriter.cc 541 Source/webrtc/common_video/h265/h265_common.cc 542 Source/webrtc/common_video/h265/h265_pps_parser.cc 543 Source/webrtc/common_video/h265/h265_sps_parser.cc 544 Source/webrtc/common_video/h265/h265_vps_parser.cc 541 545 Source/webrtc/common_video/incoming_video_stream.cc 542 546 Source/webrtc/common_video/libyuv/webrtc_libyuv.cc … … 1043 1047 Source/webrtc/modules/video_coding/codecs/vp9/svc_config.cc 1044 1048 Source/webrtc/modules/video_coding/codecs/vp9/svc_rate_allocator.cc 1049 Source/webrtc/modules/video_coding/codecs/vp9/vp9.cc 1050 Source/webrtc/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.cc 1045 1051 Source/webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc 1046 Source/webrtc/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.cc1047 1052 Source/webrtc/modules/video_coding/codec_timer.cc 1048 1053 Source/webrtc/modules/video_coding/decoder_database.cc … … 1058 1063 Source/webrtc/modules/video_coding/h264_sprop_parameter_sets.cc 1059 1064 Source/webrtc/modules/video_coding/h264_sps_pps_tracker.cc 1065 Source/webrtc/modules/video_coding/h265_vps_sps_pps_tracker.cc 1060 1066 Source/webrtc/modules/video_coding/histogram.cc 1061 1067 Source/webrtc/modules/video_coding/include/video_codec_interface.cc … … 1609 1615 1610 1616 target_compile_definitions(webrtc PRIVATE 1611 OPENSSL_NO_ASM1612 1617 DYNAMIC_ANNOTATIONS_ENABLED=1 1613 1618 EXPAT_RELATIVE_PATH 1619 HAVE_CONFIG_H 1614 1620 HAVE_LRINT 1615 1621 HAVE_LRINTF 1616 1622 HAVE_NETINET_IN_H 1617 1623 HAVE_SCTP 1624 HAVE_STDINT_H 1625 HAVE_STDLIB_H 1626 HAVE_UINT64_T 1618 1627 HAVE_WEBRTC_VIDEO 1619 1628 HAVE_WEBRTC_VOICE 1620 1629 JSON_USE_EXCEPTION=0 1621 1630 NON_WINDOWS_DEFINE 1631 NO_MAIN_THREAD_WRAPPING 1632 OPENSSL_NO_ASM 1622 1633 OPUS_BUILD 1623 1634 OPUS_EXPORT= 1635 RTC_ENABLE_VP9 1624 1636 VAR_ARRAYS 1625 1637 WEBRTC_APM_DEBUG_DUMP=0 … … 1640 1652 WEBRTC_USE_BUILTIN_ISAC_FLOAT=0 1641 1653 WTF_USE_DYNAMIC_ANNOTATIONS=1 1642 RTC_DISABLE_VP91643 1654 _GNU_SOURCE 1644 1655 ) … … 1646 1657 if (APPLE) 1647 1658 target_compile_definitions(webrtc PRIVATE 1648 RTC_ENABLE_VP91649 1659 WEBRTC_ARCH_LITTLE_ENDIAN 1650 1660 WEBRTC_MAC … … 1652 1662 else () 1653 1663 target_compile_definitions(webrtc PRIVATE 1654 DISABLE_H2651655 1664 SCTP_PROCESS_LEVEL_LOCKS 1656 1665 SCTP_SIMPLE_ALLOCATOR -
trunk/Source/ThirdParty/libwebrtc/ChangeLog
r276362 r276491 1 2021-04-23 Philippe Normand <pnormand@igalia.com> 2 3 [LibWebRTC][WPE][GTK] Enable vp9 and NO_MAIN_THREAD_WRAPPING 4 https://bugs.webkit.org/show_bug.cgi?id=222795 5 6 Reviewed by Xabier Rodriguez-Calvar. 7 8 * CMakeLists.txt: Enable NO_MAIN_THREAD_WRAPPING as in the XCode build and harmonize options 9 between Apple and non-Apple ports. 10 * Source/webrtc/common_video/h265/h265_pps_parser.h: 11 1 12 2021-04-21 Kimmo Kinnunen <kkinnunen@apple.com> 2 13 -
trunk/Source/ThirdParty/libwebrtc/Source/webrtc/common_video/h265/h265_pps_parser.h
r259452 r276491 13 13 14 14 #include "absl/types/optional.h" 15 16 #ifdef HAVE_STDINT_H 17 #include <stdint.h> 18 #endif 15 19 16 20 namespace rtc { -
trunk/Source/WebCore/ChangeLog
r276488 r276491 1 2021-04-23 Philippe Normand <pnormand@igalia.com> 2 3 [LibWebRTC][WPE][GTK] Enable vp9 and NO_MAIN_THREAD_WRAPPING 4 https://bugs.webkit.org/show_bug.cgi?id=222795 5 6 Reviewed by Xabier Rodriguez-Calvar. 7 8 Add VP9 encoding and decoding support in the WPE/GTK LibWebRTC backend. The underlying 9 encoding support is based on LibWebRTC's internal VP9 support. The GStreamer VPx encoders 10 lack simulcast and high profile support, so can't really be used anyway. The 11 GStreamerVP8Encoder was removed for this reason as well. 12 13 * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp: 14 (WebCore::VP9Decoder::VP9Decoder): 15 (WebCore::VP9Decoder::Create): 16 (WebCore::GStreamerVideoDecoderFactory::CreateVideoDecoder): 17 (WebCore::GStreamerVideoDecoderFactory::GStreamerVideoDecoderFactory): 18 (WebCore::GStreamerVideoDecoderFactory::GetSupportedFormats const): 19 * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.h: 20 * platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp: 21 * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp: 22 (WebCore::GStreamerVideoEncoder::makeElement): 23 (WebCore::GStreamerVideoEncoder::createEncoder): 24 (WebCore::GStreamerVideoEncoder::SetRestrictionCaps): 25 (WebCore::GStreamerVideoEncoderFactory::CreateVideoEncoder): 26 (WebCore::GStreamerVideoEncoderFactory::GStreamerVideoEncoderFactory): 27 (WebCore::GStreamerVideoEncoderFactory::GetSupportedFormats const): 28 * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.h: 29 * platform/mediastream/libwebrtc/LibWebRTCProviderGStreamer.cpp: 30 (WebCore::LibWebRTCProviderGStreamer::createDecoderFactory): 31 (WebCore::LibWebRTCProviderGStreamer::createEncoderFactory): 32 1 33 2021-04-22 Tyler Wilcock <twilco.o@protonmail.com> 2 34 -
trunk/Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp
r276019 r276491 387 387 }; 388 388 389 class VP9Decoder : public GStreamerVideoDecoder { 390 public: 391 VP9Decoder(bool isSupportingVP9Profile0 = true, bool isSupportingVP9Profile2 = true) 392 : m_isSupportingVP9Profile0(isSupportingVP9Profile0) 393 , m_isSupportingVP9Profile2(isSupportingVP9Profile2) { }; 394 395 const gchar* Caps() final { return "video/x-vp9"; } 396 const gchar* Name() final { return cricket::kVp9CodecName; } 397 webrtc::VideoCodecType CodecType() final { return webrtc::kVideoCodecVP9; } 398 static std::unique_ptr<webrtc::VideoDecoder> Create() 399 { 400 return std::unique_ptr<webrtc::VideoDecoder>(new VP9Decoder()); 401 } 402 403 std::vector<webrtc::SdpVideoFormat> ConfigureSupportedDecoder() final 404 { 405 std::vector<webrtc::SdpVideoFormat> formats; 406 if (m_isSupportingVP9Profile0) 407 formats.push_back(webrtc::SdpVideoFormat(cricket::kVp9CodecName, { { "profile-id", "0" } })); 408 if (m_isSupportingVP9Profile2) 409 formats.push_back(webrtc::SdpVideoFormat(cricket::kVp9CodecName, { { "profile-id", "2" } })); 410 return formats; 411 } 412 private: 413 bool m_isSupportingVP9Profile0; 414 bool m_isSupportingVP9Profile2; 415 }; 416 389 417 std::unique_ptr<webrtc::VideoDecoder> GStreamerVideoDecoderFactory::CreateVideoDecoder(const webrtc::SdpVideoFormat& format) 390 418 { … … 395 423 else if (format.name == cricket::kVp8CodecName) 396 424 return VP8Decoder::Create(); 425 else if (format.name == cricket::kVp9CodecName) 426 return VP9Decoder::Create(); 397 427 else { 398 428 GST_ERROR("Could not create decoder for %s", format.name.c_str()); … … 404 434 } 405 435 406 GStreamerVideoDecoderFactory::GStreamerVideoDecoderFactory() 436 GStreamerVideoDecoderFactory::GStreamerVideoDecoderFactory(bool isSupportingVP9Profile0, bool isSupportingVP9Profile2) 437 : m_isSupportingVP9Profile0(isSupportingVP9Profile0) 438 , m_isSupportingVP9Profile2(isSupportingVP9Profile2) 407 439 { 408 440 ensureGStreamerInitialized(); … … 418 450 419 451 VP8Decoder().AddDecoderIfSupported(formats); 452 VP9Decoder(m_isSupportingVP9Profile0, m_isSupportingVP9Profile2).AddDecoderIfSupported(formats); 420 453 H264Decoder().AddDecoderIfSupported(formats); 421 454 -
trunk/Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.h
r248762 r276491 25 25 #include "LibWebRTCMacros.h" 26 26 #include "api/video_codecs/video_decoder_factory.h" 27 #include <gst/gst.h> 28 #include <wtf/text/WTFString.h> 27 #include <wtf/Forward.h> 29 28 30 29 namespace WebCore { … … 33 32 WTF_MAKE_FAST_ALLOCATED; 34 33 public: 35 GStreamerVideoDecoderFactory(); 36 static bool newSource(String trackId, GstElement *source); 34 GStreamerVideoDecoderFactory(bool isSupportingVP9Profile0, bool isSupportingVP9Profile2); 37 35 38 36 private: 39 37 std::unique_ptr<webrtc::VideoDecoder> CreateVideoDecoder(const webrtc::SdpVideoFormat&) final; 40 38 std::vector<webrtc::SdpVideoFormat> GetSupportedFormats() const final; 39 40 bool m_isSupportingVP9Profile0; 41 bool m_isSupportingVP9Profile2; 41 42 }; 42 43 } -
trunk/Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp
r274149 r276491 36 36 37 37 static GstStaticPadTemplate sinkTemplate = GST_STATIC_PAD_TEMPLATE("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS("video/x-raw(ANY)")); 38 static GstStaticPadTemplate srcTemplate = GST_STATIC_PAD_TEMPLATE("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS("video/x-h264 ;video/x-vp8"));38 static GstStaticPadTemplate srcTemplate = GST_STATIC_PAD_TEMPLATE("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS("video/x-h264")); 39 39 40 40 using SetBitrateFunc = Function<void(GObject* encoder, const char* propertyName, int bitrate)>; … … 52 52 }; 53 53 54 enum EncoderId { None, X264, OpenH264, OmxH264 , Vp8};54 enum EncoderId { None, X264, OpenH264, OmxH264 }; 55 55 56 56 class Encoders { -
trunk/Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp
r276019 r276491 29 29 #include "LibWebRTCWebKitMacros.h" 30 30 #include "webrtc/common_video/h264/h264_common.h" 31 #include "webrtc/media/base/vp9_profile.h" 31 32 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" 32 33 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" 33 34 #include "webrtc/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.h" 35 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" 34 36 #include "webrtc/modules/video_coding/include/video_codec_interface.h" 35 37 #include "webrtc/modules/video_coding/utility/simulcast_utility.h" 36 37 38 #include <gst/app/gstappsink.h> 38 39 #include <gst/app/gstappsrc.h> … … 108 109 109 110 if (m_encoder) 110 g_object_set(m_encoder , "bitrate", parameters.bitrate.get_sum_bps(), nullptr);111 g_object_set(m_encoder.get(), "bitrate", parameters.bitrate.get_sum_bps(), nullptr); 111 112 } 112 113 … … 120 121 static Atomic<uint32_t> elementId; 121 122 auto name = makeString(Name(), "-enc-", factoryName, "-", elementId.exchangeAdd(1)); 122 auto elem = gst_element_factory_make(factoryName, name.utf8().data()); 123 123 auto* elem = gst_element_factory_make(factoryName, name.utf8().data()); 124 124 return elem; 125 125 } … … 132 132 if (webrtc::SimulcastUtility::NumberOfSimulcastStreams(*codecSettings) > 1) { 133 133 GST_ERROR("Simulcast not supported."); 134 135 134 return WEBRTC_VIDEO_CODEC_ERR_SIMULCAST_PARAMETERS_NOT_SUPPORTED; 136 135 } … … 139 138 140 139 connectSimpleBusMessageCallback(m_pipeline.get()); 141 auto encoder = createEncoder(); 142 ASSERT(encoder); 143 m_encoder = encoder.get(); 144 145 g_object_set(m_encoder, "keyframe-interval", KeyframeInterval(codecSettings), nullptr); 140 m_encoder = createEncoder(); 141 ASSERT(m_encoder); 142 143 g_object_set(m_encoder.get(), "keyframe-interval", KeyframeInterval(codecSettings), nullptr); 146 144 147 145 m_src = makeElement("appsrc"); 148 g_object_set(m_src , "is-live", true, "format", GST_FORMAT_TIME, nullptr);149 150 auto videoconvert = makeElement("videoconvert");151 auto videoscale = makeElement("videoscale");146 g_object_set(m_src.get(), "is-live", true, "format", GST_FORMAT_TIME, nullptr); 147 148 auto* videoconvert = makeElement("videoconvert"); 149 auto* videoscale = makeElement("videoscale"); 152 150 m_sink = makeElement("appsink"); 153 g_object_set(m_sink , "sync", FALSE, nullptr);151 g_object_set(m_sink.get(), "sync", FALSE, nullptr); 154 152 155 153 m_capsFilter = makeElement("capsfilter"); 156 154 if (m_restrictionCaps) 157 g_object_set(m_capsFilter, "caps", m_restrictionCaps.get(), nullptr); 158 159 gst_bin_add_many(GST_BIN(m_pipeline.get()), m_src, videoconvert, videoscale, m_capsFilter, encoder.leakRef(), m_sink, nullptr); 160 if (!gst_element_link_many(m_src, videoconvert, videoscale, m_capsFilter, m_encoder, m_sink, nullptr)) { 161 GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(GST_BIN(m_pipeline.get()), GST_DEBUG_GRAPH_SHOW_VERBOSE, "webkit-webrtc-encoder.error"); 162 155 g_object_set(m_capsFilter.get(), "caps", m_restrictionCaps.get(), nullptr); 156 157 gst_bin_add_many(GST_BIN_CAST(m_pipeline.get()), m_src.get(), videoconvert, videoscale, m_capsFilter.get(), m_encoder.get(), m_sink.get(), nullptr); 158 if (!gst_element_link_many(m_src.get(), videoconvert, videoscale, m_capsFilter.get(), m_encoder.get(), m_sink.get(), nullptr)) { 159 GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(GST_BIN_CAST(m_pipeline.get()), GST_DEBUG_GRAPH_SHOW_VERBOSE, "webkit-webrtc-encoder.error"); 163 160 ASSERT_NOT_REACHED(); 164 161 } 165 162 166 163 gst_element_set_state(m_pipeline.get(), GST_STATE_PLAYING); 167 164 GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(GST_BIN_CAST(m_pipeline.get()), GST_DEBUG_GRAPH_SHOW_VERBOSE, "webkit-webrtc-encoder"); 168 165 return WEBRTC_VIDEO_CODEC_OK; 169 166 } … … 237 234 if (!GST_CLOCK_TIME_IS_VALID(m_firstFramePts)) { 238 235 m_firstFramePts = GST_BUFFER_PTS(buffer); 239 auto pad = adoptGRef(gst_element_get_static_pad(m_src , "src"));236 auto pad = adoptGRef(gst_element_get_static_pad(m_src.get(), "src")); 240 237 gst_pad_set_offset(pad.get(), -m_firstFramePts); 241 238 } … … 243 240 for (auto frame_type : *frameTypes) { 244 241 if (frame_type == webrtc::VideoFrameType::kVideoFrameKey) { 245 auto pad = adoptGRef(gst_element_get_static_pad(m_src , "src"));242 auto pad = adoptGRef(gst_element_get_static_pad(m_src.get(), "src")); 246 243 auto forceKeyUnit = gst_video_event_new_downstream_force_key_unit(GST_CLOCK_TIME_NONE, 247 244 GST_CLOCK_TIME_NONE, GST_CLOCK_TIME_NONE, FALSE, 1); … … 255 252 } 256 253 257 res = returnFromFlowReturn(gst_app_src_push_sample(GST_APP_SRC(m_src ), sample.get()));254 res = returnFromFlowReturn(gst_app_src_push_sample(GST_APP_SRC(m_src.get()), sample.get())); 258 255 if (res != WEBRTC_VIDEO_CODEC_OK) 259 256 return res; 260 257 261 auto encodedSample = adoptGRef(gst_app_sink_try_pull_sample(GST_APP_SINK(m_sink ), 5 * GST_SECOND));258 auto encodedSample = adoptGRef(gst_app_sink_try_pull_sample(GST_APP_SINK(m_sink.get()), 5 * GST_SECOND)); 262 259 if (!encodedSample) { 263 260 GST_ERROR("Didn't get any encodedSample"); … … 294 291 GRefPtr<GstElement> createEncoder(void) 295 292 { 293 GRefPtr<GstElement> webrtcencoder = gst_element_factory_make("webrtcvideoencoder", NULL); 294 g_object_set(webrtcencoder.get(), "format", adoptGRef(gst_caps_from_string(Caps())).get(), NULL); 295 296 296 GRefPtr<GstElement> encoder = nullptr; 297 GstElement* webrtcencoder = GST_ELEMENT(g_object_ref_sink(gst_element_factory_make("webrtcvideoencoder", NULL))); 298 299 g_object_set(webrtcencoder, "format", adoptGRef(gst_caps_from_string(Caps())).get(), NULL); 300 g_object_get(webrtcencoder, "encoder", &encoder.outPtr(), NULL); 301 297 g_object_get(webrtcencoder.get(), "encoder", &encoder.outPtr(), NULL); 302 298 if (!encoder) { 303 299 GST_INFO("No encoder found for %s", Caps()); 304 305 300 return nullptr; 306 301 } … … 335 330 { 336 331 if (m_restrictionCaps) 337 g_object_set(m_capsFilter , "caps", m_restrictionCaps.get(), nullptr);332 g_object_set(m_capsFilter.get(), "caps", m_restrictionCaps.get(), nullptr); 338 333 339 334 m_restrictionCaps = caps; … … 342 337 private: 343 338 GRefPtr<GstElement> m_pipeline; 344 G stElement*m_src;345 G stElement*m_encoder;346 G stElement*m_capsFilter;339 GRefPtr<GstElement> m_src; 340 GRefPtr<GstElement> m_encoder; 341 GRefPtr<GstElement> m_capsFilter; 347 342 348 343 webrtc::EncodedImageCallback* m_imageReadyCb; … … 352 347 353 348 Lock m_bufferMapLock; 354 G stElement*m_sink;349 GRefPtr<GstElement> m_sink; 355 350 }; 356 351 … … 394 389 }; 395 390 396 class GStreamerVP8Encoder : public GStreamerVideoEncoder {397 public:398 GStreamerVP8Encoder() { }399 GStreamerVP8Encoder(const webrtc::SdpVideoFormat&) { }400 const gchar* Caps() final { return "video/x-vp8"; }401 const gchar* Name() final { return cricket::kVp8CodecName; }402 webrtc::VideoCodecType CodecType() final { return webrtc::kVideoCodecVP8; }403 404 int KeyframeInterval(const webrtc::VideoCodec* codecSettings) final405 {406 return codecSettings->VP8().keyFrameInterval;407 }408 409 void PopulateCodecSpecific(webrtc::CodecSpecificInfo* codecSpecificInfos, const GstBuffer* buffer) final410 {411 codecSpecificInfos->codecType = webrtc::kVideoCodecVP8;412 webrtc::CodecSpecificInfoVP8* vp8Info = &(codecSpecificInfos->codecSpecific.VP8);413 vp8Info->temporalIdx = 0;414 415 vp8Info->keyIdx = webrtc::kNoKeyIdx;416 vp8Info->nonReference = GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DELTA_UNIT);417 }418 };419 420 391 std::unique_ptr<webrtc::VideoEncoder> GStreamerVideoEncoderFactory::CreateVideoEncoder(const webrtc::SdpVideoFormat& format) 421 392 { 393 // FIXME: vpxenc doesn't support simulcast nor SVC. vp9enc supports only profile 0. These 394 // shortcomings trigger webrtc/vp9.html and webrtc/simulcast-h264.html timeouts and most likely 395 // bad UX in WPE/GTK browsers. So for now we prefer to use LibWebRTC's VPx encoders. 396 if (format.name == cricket::kVp9CodecName) { 397 GST_INFO("Using VP9 Encoder from LibWebRTC."); 398 return webrtc::VP9Encoder::Create(cricket::VideoCodec(format)); 399 } 400 422 401 if (format.name == cricket::kVp8CodecName) { 423 GRefPtr<GstElement> webrtcencoder = adoptGRef(GST_ELEMENT(g_object_ref_sink(gst_element_factory_make("webrtcvideoencoder", NULL))));424 GRefPtr<GstElement> encoder = nullptr;425 426 g_object_set(webrtcencoder.get(), "format", adoptGRef(gst_caps_from_string("video/x-vp8")).get(), NULL);427 g_object_get(webrtcencoder.get(), "encoder", &encoder.outPtr(), NULL);428 429 if (encoder)430 return makeUnique<GStreamerVP8Encoder>(format);431 432 402 GST_INFO("Using VP8 Encoder from LibWebRTC."); 433 403 return makeUniqueWithoutFastMallocCheck<webrtc::LibvpxVp8Encoder>(webrtc::LibvpxInterface::CreateEncoder(), webrtc::VP8Encoder::Settings()); … … 447 417 } 448 418 449 GStreamerVideoEncoderFactory::GStreamerVideoEncoderFactory() 419 GStreamerVideoEncoderFactory::GStreamerVideoEncoderFactory(bool isSupportingVP9Profile0, bool isSupportingVP9Profile2) 420 : m_isSupportingVP9Profile0(isSupportingVP9Profile0) 421 , m_isSupportingVP9Profile2(isSupportingVP9Profile2) 450 422 { 451 423 ensureGStreamerInitialized(); … … 465 437 466 438 supportedCodecs.push_back(webrtc::SdpVideoFormat(cricket::kVp8CodecName)); 439 if (m_isSupportingVP9Profile0) 440 supportedCodecs.push_back(webrtc::SdpVideoFormat(cricket::kVp9CodecName, {{"profile-id", "0"}})); 441 if (m_isSupportingVP9Profile2) 442 supportedCodecs.push_back(webrtc::SdpVideoFormat(cricket::kVp9CodecName, {{"profile-id", "2"}})); 467 443 468 444 // If OpenH264 is present, prefer it over the GStreamer encoders (x264enc, usually). -
trunk/Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.h
r270190 r276491 24 24 #include "LibWebRTCMacros.h" 25 25 #include "api/video_codecs/video_encoder_factory.h" 26 #include <gst/gst.h>27 26 28 27 namespace WebCore { … … 31 30 WTF_MAKE_FAST_ALLOCATED; 32 31 public: 33 GStreamerVideoEncoderFactory( );32 GStreamerVideoEncoderFactory(bool isSupportingVP9Profile0, bool isSupportingVP9Profile2); 34 33 35 34 private: … … 38 37 CodecInfo QueryVideoEncoder(const webrtc::SdpVideoFormat&) const override 39 38 { 40 GST_FIXME("Detect whether the decoder is HW accelerated");39 // FIXME: Detect whether the decoder is HW accelerated. 41 40 42 41 return { false }; 43 42 } 43 44 bool m_isSupportingVP9Profile0; 45 bool m_isSupportingVP9Profile2; 44 46 }; 45 47 } -
trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderGStreamer.cpp
r248846 r276491 29 29 #if USE(LIBWEBRTC) && USE(GSTREAMER) 30 30 31 #include "RuntimeEnabledFeatures.h" 31 32 #include <wtf/UniqueRef.h> 32 33 … … 45 46 std::unique_ptr<webrtc::VideoDecoderFactory> LibWebRTCProviderGStreamer::createDecoderFactory() 46 47 { 47 return makeUnique<GStreamerVideoDecoderFactory>( );48 return makeUnique<GStreamerVideoDecoderFactory>(isSupportingVP9Profile0(), isSupportingVP9Profile2()); 48 49 } 49 50 50 51 std::unique_ptr<webrtc::VideoEncoderFactory> LibWebRTCProviderGStreamer::createEncoderFactory() 51 52 { 52 return makeUnique<GStreamerVideoEncoderFactory>( );53 return makeUnique<GStreamerVideoEncoderFactory>(isSupportingVP9Profile0(), isSupportingVP9Profile2()); 53 54 } 54 55
Note:
See TracChangeset
for help on using the changeset viewer.