2021-08-19 Youenn Fablet Add support for RTCDtlsTransport https://bugs.webkit.org/show_bug.cgi?id=229133 Reviewed by Eric Carlson. * Configurations/libwebrtc.iOS.exp: * Configurations/libwebrtc.iOSsim.exp: * Configurations/libwebrtc.mac.exp: 2021-08-13 Youenn Fablet Use profile auto level for WebRTC H264 encoder on Apple Silicon https://bugs.webkit.org/show_bug.cgi?id=229071 Reviewed by Eric Carlson. AS H264 encoder will fail if its profile is too low compared to the size of the video. Use autolevel to prevent this. * Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm: 2021-07-01 Youenn Fablet Disable ABSL_HAVE_THREAD_LOCAL in libwebrtc https://bugs.webkit.org/show_bug.cgi?id=227577 Reviewed by Eric Carlson. We do no want to resort on thread local yet so disable ABSL_HAVE_THREAD_LOCAL until we can use it properly. * Source/third_party/abseil-cpp/absl/base/config.h: 2021-07-01 Youenn Fablet [Cocoa] Migrate WebRTC UDP socket handling to NW API https://bugs.webkit.org/show_bug.cgi?id=227210 Reviewed by Eric Carlson. * Configurations/libwebrtc.iOS.exp: * Configurations/libwebrtc.iOSsim.exp: * Configurations/libwebrtc.mac.exp: 2021-06-30 Truitt Savell Unreviewed, reverting r279405. Casued 50+ webrtc crashes on Big Sur Debug Reverted changeset: "[Cocoa] Migrate WebRTC UDP socket handling to NW API" https://bugs.webkit.org/show_bug.cgi?id=227210 https://commits.webkit.org/r279405 2021-06-30 Youenn Fablet [Cocoa] Migrate WebRTC UDP socket handling to NW API https://bugs.webkit.org/show_bug.cgi?id=227210 Reviewed by Eric Carlson. * Configurations/libwebrtc.iOS.exp: * Configurations/libwebrtc.iOSsim.exp: * Configurations/libwebrtc.mac.exp: 2021-06-23 Eric Carlson WebKitDecoder.h should include TargetConditionals.h https://bugs.webkit.org/show_bug.cgi?id=227314 Reviewed by Geoff Garen. * Source/webrtc/sdk/WebKit/WebKitDecoder.h: Include TargetConditionals.h so the TARGET_ defines are initialized correctly. 2021-06-21 Eric Carlson [Mac] libwebrtc CMBaseClass objects need alignment fixup https://bugs.webkit.org/show_bug.cgi?id=227137 Reviewed by Youenn Fablet. * Source/webrtc/sdk/WebKit/WebKitDecoder.h: Define CMBASE_OBJECT_NEEDS_ALIGNMENT. * Source/webrtc/sdk/WebKit/WebKitVP8Decoder.cpp: (webrtc::createWebKitVP8Decoder): Add padding to the CMBaseClass object on Mac and Mac Catalyst when building for x86_64 so function pointers are naturally aligned. Add static_asserts to ensure alignment and sizes are correct. * Source/webrtc/sdk/WebKit/WebKitVP9Decoder.cpp: (webrtc::createWebKitVP9Decoder): Ditto. 2021-06-21 Philippe Normand [GLIB] REGRESSION(r278701): numerous WebRTC tests failing after libwebrtc update to M92 https://bugs.webkit.org/show_bug.cgi?id=227172 Reviewed by Adrian Perez de Castro. Non-apple ports do not use the bundled libvpx library, they rely on the host libvpx instead. LibWebRTC expects to depend on the bundled version, thus using its API. So we need to be very careful with which libvpx version is used from the host, in order to avoid API/ABI issues. Hence the version check should specify a version that is API/ABI compatible with what libwebrtc expects. This patch also re-enables data channel support, which was disabled during the update to M92 in CMake ports. * CMakeLists.txt: 2021-06-17 Commit Queue Unreviewed, reverting r279011. https://bugs.webkit.org/show_bug.cgi?id=227153 broke ios build Reverted changeset: "[Mac] libwebrtc CMBaseClass objects need alignment fixup" https://bugs.webkit.org/show_bug.cgi?id=227137 https://trac.webkit.org/changeset/279011 2021-06-17 Eric Carlson [Mac] libwebrtc CMBaseClass objects need alignment fixup https://bugs.webkit.org/show_bug.cgi?id=227137 Reviewed by Youenn Fablet. * Source/webrtc/sdk/WebKit/WebKitVP8Decoder.cpp: (webrtc::createWebKitVP8Decoder): Add padding to the CMBaseClass object on x86_64 so function pointers are naturally aligned. Add static_asserts to ensure alignment and sizes are correct. * Source/webrtc/sdk/WebKit/WebKitVP9Decoder.cpp: (webrtc::createWebKitVP9Decoder): Ditto. 2021-06-15 Youenn Fablet Enable kVTVideoEncoderSpecification_RequiredLowLatency in case of MacOS software encoder https://bugs.webkit.org/show_bug.cgi?id=226873 Reviewed by Eric Carlson. In case software encoder is being created for baseline, we can use kVTVideoEncoderSpecification_RequiredLowLatency which provides better bitrate management than the regular SW encoder while still generating baseline content. We check whether SW encoder is created based on kVTCompressionPropertyKey_UsingHardwareAcceleratedVideoEncoder. If property is unsupported or if its value is false, it means the encoder is software. * Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm: (-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]): 2021-06-15 Youenn Fablet REGRESSION: [ BigSur iOS wk1 Debug ] imported/w3c/web-platform-tests/html/dom/usvstring-reflection.https.html is flaky crashing https://bugs.webkit.org/show_bug.cgi?id=226928 Reviewed by Eric Carlson. * Source/webrtc/rtc_base/task_queue_stdlib.cc: thread_ is created in TaskQueueStdlib constructor before other members pending_queue_ or delayed_queue_. It might happen that thread_ will start executing its callback which will read delayed_queue_ before it is initialized by TaskQueueStdlib constructor. Update to create thread_ before all other members. 2021-06-10 Youenn Fablet and Victor M. Jaquez L. Update libwebrtc to M92 https://bugs.webkit.org/show_bug.cgi?id=226494 Reviewed by Eric Carlson. * CMakeLists.txt: * Source/webrtc: Resynced. * libwebrtc.xcodeproj/project.pbxproj: 2021-06-08 Truitt Savell Unreviewed, reverting r278609. Broke builds with a linker error. Reverted changeset: "Update libwebrtc to M92" https://bugs.webkit.org/show_bug.cgi?id=226494 https://commits.webkit.org/r278609 2021-06-08 Youenn Fablet and Victor M. Jaquez L. Update libwebrtc to M92 https://bugs.webkit.org/show_bug.cgi?id=226494 Reviewed by Eric Carlson. * CMakeLists.txt: * Source/webrtc: Resynced. * libwebrtc.xcodeproj/project.pbxproj: 2021-06-08 Youenn Fablet Update usrsctp to M92 https://bugs.webkit.org/show_bug.cgi?id=226493 Reviewed by Alex Christensen. * Source/third_party/usrsctp: Resynced. * Source/third_party/usrsctp/usrsctplib/.gitattributes: Added. 2021-06-07 Youenn Fablet Update libvpx to M92 https://bugs.webkit.org/show_bug.cgi?id=226488 Reviewed by Eric Carlson. * CMakeLists.txt: * Source/third_party/libvpx: Resynced. * libwebrtc.xcodeproj/project.pbxproj: 2021-06-07 Youenn Fablet and Victor M. Jaquez L. Update libyuv to M92 https://bugs.webkit.org/show_bug.cgi?id=226489 Reviewed by Eric Carlson. * CMakeLists.txt: * Source/third_party/libyuv: Resynced. * Source/webrtc/sdk/WebKit/WebKitUtilities.mm: Updated 10 bits frame conversion routine to use new libyuv routines (covered by webrtc/vp9-profile2.html) * libwebrtc.xcodeproj/project.pbxproj: 2021-06-06 Youenn Fablet Update libsrtp to M92 https://bugs.webkit.org/show_bug.cgi?id=226487 Reviewed by Eric Carlson. * Configurations/libsrtp.xcconfig: * Source/third_party/libsrtp: Resynced. * libwebrtc.xcodeproj/project.pbxproj: 2021-06-03 Youenn Fablet Cherry-pick webrtc fix to correctly handle audio track state in case of renegotiation https://bugs.webkit.org/show_bug.cgi?id=226577 Reviewed by Eric Carlson. Cherry-pick https://webrtc.googlesource.com/src/+/c335b0e63bff56ca0fbfa617dee6a644c85df164%5E%21/. We need to do small changes to peer_connection.cc given the upstream fix is based on a newer version which has some code moved from peer_connection.cc to rtp_transmission_manager.cc. * Source/webrtc/pc/audio_rtp_receiver.cc: * Source/webrtc/pc/audio_rtp_receiver.h: * Source/webrtc/pc/peer_connection.cc: * Source/webrtc/pc/peer_connection_rtp_unittest.cc: * Source/webrtc/pc/remote_audio_source.cc: * Source/webrtc/pc/remote_audio_source.h: * Source/webrtc/pc/rtp_sender_receiver_unittest.cc: 2021-06-02 Youenn Fablet Update boringssl to M92 https://bugs.webkit.org/show_bug.cgi?id=226486 Reviewed by Alex Christensen. * CMakeLists.txt: * Source/third_party/boringssl/BUILD.generated.gni: Resynced. * libwebrtc.xcodeproj/project.pbxproj: 2021-06-02 Youenn Fablet Update pffft to M92 https://bugs.webkit.org/show_bug.cgi?id=226491 Reviewed by Alex Christensen. * Source/third_party/pffft/BUILD.gn: * Source/third_party/pffft/DIR_METADATA: Added. 2021-06-02 Youenn Fablet Update opus to M92 https://bugs.webkit.org/show_bug.cgi?id=226490 Reviewed by Alex Christensen. * Source/third_party: Resynced. 2021-06-02 Youenn Fablet Update to rnnoise to M92 https://bugs.webkit.org/show_bug.cgi?id=226492 Reviewed by Alex Christensen. * Source/third_party/rnnoise/DIR_METADATA: Added. * Source/third_party/rnnoise/OWNERS: 2021-06-02 Youenn Fablet Update abseil-cpp to M92 https://bugs.webkit.org/show_bug.cgi?id=226485 Reviewed by Alex Christensen. * Source/third_party/abseil-cpp: Resynced. 2021-05-31 Youenn Fablet Use tighter bitrate allocation rules for WebRTC H264 software encoder https://bugs.webkit.org/show_bug.cgi?id=226319 Reviewed by Eric Carlson. Software H264 encoder is sometimes overshooting target bitrate in which case WebRTC backend will start dropping frames. The encoder might then think it is on target and will not try to increase compression. This makes it possible to be locked in a very low frame rate but high quality image situation. It is often better to preserve frame rate and lower quality, the application could always lower frame rate if desired. To do so, we detect whether the encoder is using software code path or not. If so, we compute the actual frame rate and compare it with the expected frame rate. If the actual frame rate is twice smaller or even below, we enter in a low frame rate mode. Otherwise, we are in a regular frame rate mode where we apply the normal bitrate rules. In the low frame rate mode, we divide the target bitrate by 3 so as to quickly recover frame rate. This works well in situations where motion increases from time to time. It is still not perfect for instance in case the video is muted and gets unmuted or when the scene is completely still and suddenly large motion happens. In those cases, frame rate is recovered after a minute or so according my testing. * Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm: (-[RTCVideoEncoderH264 initWithCodecInfo:]): (-[RTCVideoEncoderH264 encode:codecSpecificInfo:frameTypes:]): (-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]): (-[RTCVideoEncoderH264 setEncoderBitrateBps:frameRate:]): (-[RTCVideoEncoderH264 updateBitRateAccordingActualFrameRate]): 2021-05-20 Youenn Fablet Enable VCP for H264 baseline https://bugs.webkit.org/show_bug.cgi?id=224043 Reviewed by Eric Carlson. Enable VCP for baseline past BigSur/iOS14. Add macros and introduce _useBaseline in addition to _useVCP for that purpose. * Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h: * Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm: (-[RTCVideoEncoderH264 initWithCodecInfo:]): (-[RTCVideoEncoderH264 configureCompressionSession]): 2021-05-11 Youenn Fablet Improve usrsctp restart handling https://bugs.webkit.org/show_bug.cgi?id=225638 Reviewed by Alex Christensen. * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c: (sctp_process_cookie_existing): 2021-05-07 Alex Christensen Allow libwebrtc to build for Mac Catalyst https://bugs.webkit.org/show_bug.cgi?id=225505 Reviewed by Youenn Fablet. This is progress towards rdar://77568774 Changes necessary to get it to build and link were: 1. kCVPixelBufferOpenGLESCompatibilityKey is unavailable on Catalyst, so use kCVPixelBufferOpenGLCompatibilityKey like we do on macOS. 2. SSE4 and AVX seem to be unavailable in the Catalyst SDK like they are in the iOS simulator SDK, so disable them similarly. 3. Link to UIKit and CoreGraphics in debug builds like we do with iOS family builds. 4. Don't use @loader_path/../../../ for DYLIB_INSTALL_NAME_BASE like we do with relocatable Safari builds, similar to an ANGLE change I made in r276318 5. Export the same symbols as iOS for now. This may need some tweaking when I get it to link with WebCore, but that's why this is only progress. * Configurations/DebugRelease.xcconfig: * Configurations/SDKVariant.xcconfig: * Configurations/libvpx.xcconfig: * Configurations/libwebrtc.xcconfig: * Configurations/opus.xcconfig: * Source/third_party/libvpx/source/config/mac/x64/vp8_rtcd.h: * Source/third_party/libvpx/source/config/mac/x64/vp9_rtcd.h: * Source/third_party/libvpx/source/config/mac/x64/vpx_dsp_rtcd.h: * Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderH264.mm: (-[RTCVideoDecoderH264 resetDecompressionSession]): * Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderH265.mm: (-[RTCVideoDecoderH265 resetDecompressionSession]): * Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderVTBVP9.mm: (-[RTCVideoDecoderVTBVP9 resetDecompressionSession]): * Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm: (-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]): * Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH265.mm: (-[RTCVideoEncoderH265 resetCompressionSession]): 2021-05-05 Yury Semikhatsky [LibWebRTC][WPE][GTK] do not use system installed vpx headers when building webrtc https://bugs.webkit.org/show_bug.cgi?id=225401 Reviewed by Philippe Normand. Use vpx headers from Source/ThirdParty/libwebrtc instead of those from the host system. * CMakeLists.txt: expose libvpx headers to webrtc 2021-04-27 Youenn Fablet Disable WebRTC trace event macros https://bugs.webkit.org/show_bug.cgi?id=225104 Reviewed by Eric Carlson. We are not using trace events so we can disable them as a small optimization. * Configurations/libwebrtc.xcconfig: * Configurations/libwebrtcpcrtc.xcconfig: 2021-04-23 Philippe Normand [LibWebRTC][WPE][GTK] Enable vp9 and NO_MAIN_THREAD_WRAPPING https://bugs.webkit.org/show_bug.cgi?id=222795 Reviewed by Xabier Rodriguez-Calvar. * CMakeLists.txt: Enable NO_MAIN_THREAD_WRAPPING as in the XCode build and harmonize options between Apple and non-Apple ports. * Source/webrtc/common_video/h265/h265_pps_parser.h: 2021-04-21 Kimmo Kinnunen WebRTC should be compiled with thread-safe statics https://bugs.webkit.org/show_bug.cgi?id=224863 Reviewed by Youenn Fablet. Compile libwebrtc with normal thread-safe c++ local statics. No known threading failures. Based on ad-hoc risk vs benefit evaluation of today and after future merges, it appears better to err in the side of caution. * Configurations/Base.xcconfig: 2021-04-21 Youenn Fablet [ BigSur wk2 ARM64 ] http/wpt/webrtc/change-encoded-transform.html is a flakey crash https://bugs.webkit.org/show_bug.cgi?id=224696 Reviewed by Eric Carlson. On stream recreation, the new delegate may have to process a transformed frame before receiving one from the encoder. Check for encoder_queue to not be null in that case. * Source/webrtc/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc: 2021-04-15 Philippe Normand [WebRTC][GStreamer] Build and use the openh264 based encoder if present on the system https://bugs.webkit.org/show_bug.cgi?id=202538 Reviewed by Xabier Rodriguez-Calvar. In WPE/GTK we would like to have the libwebrtc openh264 encoder enabled if libopenh264 is present on the host (eg not vendored). * CMakeLists.txt: * LibWebRTCWebKitMacros.h.in: Added. * Source/webrtc/modules/video_coding/codecs/h264/h264.cc: * Source/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc: * Source/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.h: * cmake/FindOpenh264.cmake: Added. 2021-04-06 Philippe Normand REGRESSION(r275275): Broke some build configs lacking openh264 https://bugs.webkit.org/show_bug.cgi?id=224244 Unreviewed, manual revert of r275275 and r275409. * CMakeLists.txt: * LibWebRTCWebKitMacros.h.in: Removed. * Source/webrtc/modules/video_coding/codecs/h264/h264.cc: * Source/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc: * Source/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.h: * cmake/FindOpenh264.cmake: Removed. 2021-04-05 Alex Christensen Resurrect Mac CMake build https://bugs.webkit.org/show_bug.cgi?id=224084 Reviewed by Tim Horton. * CMakeLists.txt: 2021-04-02 Carlos Alberto Lopez Perez [CMake][GStremer] Fails to build if OpenH264 is not present https://bugs.webkit.org/show_bug.cgi?id=224089 Reviewed by Philippe Normand. * CMakeLists.txt: Only try to link with OpenH264 when it is found. 2021-03-31 Youenn Fablet In case WebRTC VTB decoder returns a null frame, mark the decoder as failing https://bugs.webkit.org/show_bug.cgi?id=223993 Reviewed by Eric Carlson. In case VTB does not return any pixel buffer, consider decoding is failing. Set the error so that we we will send the error on the next frame we try to decode. * Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderH264.mm: (decompressionOutputCallback): * Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderH265.mm: (h265DecompressionOutputCallback): (-[RTCVideoDecoderH265 setError:]): * Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderVTBVP9.mm: (vp9DecompressionOutputCallback): 2021-03-31 Thibault Saunier and Philippe Normand [WebRTC][GStreamer] Build and use the openh264 based encoder if present on the system https://bugs.webkit.org/show_bug.cgi?id=202538 Reviewed by Xabier Rodriguez-Calvar and Adrian Perez de Castro. In WPE/GTK we would like to have the libwebrtc openh264 encoder enabled if libopenh264 is present on the host (eg not vendored). * CMakeLists.txt: * Source/webrtc/modules/video_coding/codecs/h264/h264.cc: * Source/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc: * Source/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.h: 2021-03-26 Jessie Berlin Update the BEFORE/SINCE, SYSTEM_VERSION_PREFIX, and MACOSX_DEPLOYMENT_TARGET flags https://bugs.webkit.org/show_bug.cgi?id=223779 Reviewed by Tim Horton. * Configurations/DebugRelease.xcconfig: * Configurations/Version.xcconfig: * Configurations/WebKitTargetConditionals.xcconfig: 2021-03-25 Jessie Berlin Remove 10.13 DEPLOYMENT_TARGETs and SYSTEM_VERSION_PREFIXs https://bugs.webkit.org/show_bug.cgi?id=223765 Reviewed by Tim Horton. * Configurations/Base.xcconfig: * Configurations/DebugRelease.xcconfig: * Configurations/Version.xcconfig: 2021-03-25 Youenn Fablet Switch from PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION to filtering interfaces in Network process https://bugs.webkit.org/show_bug.cgi?id=223679 Reviewed by Eric Carlson. * Configurations/libwebrtc.iOS.exp: * Configurations/libwebrtc.iOSsim.exp: * Configurations/libwebrtc.mac.exp: 2021-03-25 Youenn Fablet Align RemoteVideoDecoder destruction strategy with RemoteVideoEncoder https://bugs.webkit.org/show_bug.cgi?id=223745 Reviewed by Eric Carlson. When decoder is released, we make sure to nullify the decoder callback. We wait to release WebKit decoder at RemoteVideoDecoder destruction time. * Source/webrtc/sdk/WebKit/WebKitDecoder.mm: (webrtc::RemoteVideoDecoder::~RemoteVideoDecoder): (webrtc::RemoteVideoDecoder::Release): 2021-03-10 Jer Noble CRASH in MergeUVRow_AVX2 https://bugs.webkit.org/show_bug.cgi?id=222996 Reviewed by Geoff Garen. Crash logging shows occasional crashes in MergeUVRow_AVX2. These crashes all occur when calling -[AVAssetImageGenerator copyCGImageAtTime:actualTime:error:]. This path is only used when there was no prior image generated, and a new image is not available from AVPlayerItemVideoOutput, which is a scenario which only occurs when doing a software-paint immedately after a