Diff
Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (215410 => 215411)
--- trunk/Source/ThirdParty/libwebrtc/ChangeLog 2017-04-17 15:00:33 UTC (rev 215410)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog 2017-04-17 15:01:32 UTC (rev 215411)
@@ -1,3 +1,20 @@
+2017-04-17 Youenn Fablet <you...@apple.com>
+
+ Add an external libwebrtc encoder factory in WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=170883
+
+ Reviewed by Alex Christensen.
+
+ Exporting some symbols.
+ Allowing to customize the creation of the H264 encoder.
+
+ * Source/webrtc/media/base/codec.h:
+ * Source/webrtc/media/engine/webrtcvideoencoderfactory.h
+ * Source/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc:
+ * Source/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.h:
+ * Source/webrtc/video_decoder.h
+ * Source/webrtc/video_encoder.h
+
2017-04-14 Mark Lam <mark....@apple.com>
Update architectures in xcconfig files.
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/media/engine/webrtcvideoencoderfactory.h (215410 => 215411)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/media/engine/webrtcvideoencoderfactory.h 2017-04-17 15:00:33 UTC (rev 215410)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/media/engine/webrtcvideoencoderfactory.h 2017-04-17 15:01:32 UTC (rev 215411)
@@ -22,7 +22,7 @@
namespace cricket {
-class WebRtcVideoEncoderFactory {
+class WEBRTC_DYLIB_EXPORT WebRtcVideoEncoderFactory {
public:
// This VideoCodec class is deprecated. Use cricket::VideoCodec directly
// instead and the corresponding factory function. See
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.h (215410 => 215411)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.h 2017-04-17 15:00:33 UTC (rev 215410)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.h 2017-04-17 15:01:32 UTC (rev 215411)
@@ -30,7 +30,7 @@
namespace webrtc {
-class H264VideoToolboxEncoder : public H264Encoder {
+class WEBRTC_DYLIB_EXPORT H264VideoToolboxEncoder : public H264Encoder {
public:
explicit H264VideoToolboxEncoder(const cricket::VideoCodec& codec);
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc (215410 => 215411)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc 2017-04-17 15:00:33 UTC (rev 215410)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc 2017-04-17 15:01:32 UTC (rev 215411)
@@ -43,6 +43,10 @@
return nullptr;
}
+VideoEncoder* VideoToolboxVideoEncoderFactory::CreateSupportedVideoEncoder(const cricket::VideoCodec& codec) {
+ return new H264VideoToolboxEncoder(codec);
+}
+
void VideoToolboxVideoEncoderFactory::DestroyVideoEncoder(
VideoEncoder* encoder) {
delete encoder;
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.h (215410 => 215411)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.h 2017-04-17 15:00:33 UTC (rev 215410)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.h 2017-04-17 15:01:32 UTC (rev 215411)
@@ -17,10 +17,10 @@
namespace webrtc {
-class VideoToolboxVideoEncoderFactory
+class WEBRTC_DYLIB_EXPORT VideoToolboxVideoEncoderFactory
: public cricket::WebRtcVideoEncoderFactory {
public:
- WEBRTC_DYLIB_EXPORT VideoToolboxVideoEncoderFactory();
+ VideoToolboxVideoEncoderFactory();
~VideoToolboxVideoEncoderFactory();
// WebRtcVideoEncoderFactory implementation.
@@ -29,6 +29,8 @@
const std::vector<cricket::VideoCodec>& supported_codecs() const override;
private:
+ virtual VideoEncoder* CreateSupportedVideoEncoder(const cricket::VideoCodec& codec);
+
// TODO(magjed): Mutable because it depends on a field trial and it is
// recalculated every call to supported_codecs().
mutable std::vector<cricket::VideoCodec> supported_codecs_;
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/video_decoder.h (215410 => 215411)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/video_decoder.h 2017-04-17 15:00:33 UTC (rev 215410)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/video_decoder.h 2017-04-17 15:01:32 UTC (rev 215411)
@@ -35,7 +35,7 @@
// decode time excluding waiting time for any previous pending frame to
// return. This is necessary for breaking positive feedback in the delay
// estimation when the decoder has a single output buffer.
- virtual int32_t Decoded(VideoFrame& decodedImage, int64_t decode_time_ms) {
+ virtual int32_t Decoded(VideoFrame& decodedImage, int64_t /* decode_time_ms */) {
// The default implementation ignores custom decode time value.
return Decoded(decodedImage);
}
@@ -43,16 +43,16 @@
// updated.
virtual void Decoded(VideoFrame& decodedImage,
rtc::Optional<int32_t> decode_time_ms,
- rtc::Optional<uint8_t> qp) {
+ rtc::Optional<uint8_t> /* qp */) {
Decoded(decodedImage,
decode_time_ms ? static_cast<int32_t>(*decode_time_ms) : -1);
}
- virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId) {
+ virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t /* pictureId */) {
return -1;
}
- virtual int32_t ReceivedDecodedFrame(const uint64_t pictureId) { return -1; }
+ virtual int32_t ReceivedDecodedFrame(const uint64_t /* pictureId */) { return -1; }
};
class VideoDecoder {
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/video_encoder.h (215410 => 215411)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/video_encoder.h 2017-04-17 15:00:33 UTC (rev 215410)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/video_encoder.h 2017-04-17 15:01:32 UTC (rev 215411)
@@ -165,7 +165,7 @@
// - framerate : The target frame rate
//
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
- virtual int32_t SetRates(uint32_t bitrate, uint32_t framerate) {
+ virtual int32_t SetRates(uint32_t /* bitrate */, uint32_t /* framerate */) {
RTC_NOTREACHED() << "SetRate(uint32_t, uint32_t) is deprecated.";
return -1;
}
@@ -183,7 +183,7 @@
return ScalingSettings(false);
}
- virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; }
+ virtual int32_t SetPeriodicKeyFrames(bool /* enable */) { return -1; }
virtual bool SupportsNativeHandle() const { return false; }
virtual const char* ImplementationName() const { return "unknown"; }
};
Modified: trunk/Source/WebCore/ChangeLog (215410 => 215411)
--- trunk/Source/WebCore/ChangeLog 2017-04-17 15:00:33 UTC (rev 215410)
+++ trunk/Source/WebCore/ChangeLog 2017-04-17 15:01:32 UTC (rev 215411)
@@ -1,3 +1,20 @@
+2017-04-17 Youenn Fablet <you...@apple.com>
+
+ Add an external libwebrtc encoder factory in WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=170883
+
+ Reviewed by Alex Christensen.
+
+ No change of behavior, WebCore factory instantiating the default libwebrtc H264 encoder.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
+ (WebCore::staticFactoryAndThreads):
+ * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp: Added.
+ (WebCore::VideoToolboxVideoEncoderFactory::CreateVideoEncoder):
+ (WebCore::VideoToolboxVideoEncoderFactory::DestroyVideoEncoder):
+ * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h: Added.
+
2017-04-17 Antti Koivisto <an...@apple.com>
GraphicsLayerCA::recursiveCommitChanges should not descend into subtrees without changes
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (215410 => 215411)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-04-17 15:00:33 UTC (rev 215410)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-04-17 15:01:32 UTC (rev 215411)
@@ -1777,6 +1777,7 @@
41BF700F0FE86F61005E8DEC /* PlatformMessagePortChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41BF700D0FE86F61005E8DEC /* PlatformMessagePortChannel.cpp */; };
41BF70100FE86F61005E8DEC /* PlatformMessagePortChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 41BF700E0FE86F61005E8DEC /* PlatformMessagePortChannel.h */; };
41C760B10EDE03D300C1655F /* ScriptState.h in Headers */ = {isa = PBXBuildFile; fileRef = 41C760B00EDE03D300C1655F /* ScriptState.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 41CAD71E1EA090A100178164 /* VideoToolBoxEncoderFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41CAD71C1EA0905700178164 /* VideoToolBoxEncoderFactory.cpp */; };
41CF8BE71D46226700707DC9 /* FetchBodyConsumer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41CF8BE41D46222000707DC9 /* FetchBodyConsumer.cpp */; };
41D015CA0F4B5C71004A662F /* ContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 41D015C80F4B5C71004A662F /* ContentType.h */; };
41D015CB0F4B5C71004A662F /* ContentType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41D015C90F4B5C71004A662F /* ContentType.cpp */; };
@@ -9394,6 +9395,8 @@
41C7E1051E6A54360027B4DE /* CanvasCaptureMediaStreamTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CanvasCaptureMediaStreamTrack.cpp; sourceTree = "<group>"; };
41C7E1061E6A54360027B4DE /* CanvasCaptureMediaStreamTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CanvasCaptureMediaStreamTrack.h; sourceTree = "<group>"; };
41C7E1081E6AA37C0027B4DE /* CanvasCaptureMediaStreamTrack.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CanvasCaptureMediaStreamTrack.idl; sourceTree = "<group>"; };
+ 41CAD71C1EA0905700178164 /* VideoToolBoxEncoderFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VideoToolBoxEncoderFactory.cpp; path = libwebrtc/VideoToolBoxEncoderFactory.cpp; sourceTree = "<group>"; };
+ 41CAD71D1EA0905700178164 /* VideoToolBoxEncoderFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VideoToolBoxEncoderFactory.h; path = libwebrtc/VideoToolBoxEncoderFactory.h; sourceTree = "<group>"; };
41CF8BE41D46222000707DC9 /* FetchBodyConsumer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FetchBodyConsumer.cpp; sourceTree = "<group>"; };
41CF8BE51D46222000707DC9 /* FetchBodyConsumer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchBodyConsumer.h; sourceTree = "<group>"; };
41CF8BE61D46222C00707DC9 /* FetchInternals.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = FetchInternals.js; sourceTree = "<group>"; };
@@ -17551,6 +17554,8 @@
415747431E38699E00E914D8 /* LibWebRTCMacros.h */,
41A1B00D1E52656E007F3769 /* LibWebRTCProvider.cpp */,
415747441E38699E00E914D8 /* LibWebRTCProvider.h */,
+ 41CAD71C1EA0905700178164 /* VideoToolBoxEncoderFactory.cpp */,
+ 41CAD71D1EA0905700178164 /* VideoToolBoxEncoderFactory.h */,
);
name = libwebrtc;
sourceTree = "<group>";
@@ -30434,6 +30439,7 @@
512DD8FA0D91E6AF000F89EE /* ArchiveFactory.cpp in Sources */,
512DD8FB0D91E6AF000F89EE /* ArchiveResource.cpp in Sources */,
512DD8F70D91E6AF000F89EE /* ArchiveResourceCollection.cpp in Sources */,
+ 41CAD71E1EA090A100178164 /* VideoToolBoxEncoderFactory.cpp in Sources */,
FD5686C913AC180200B69C68 /* AsyncAudioDecoder.cpp in Sources */,
E1CDE92015018ED000862CC5 /* AsyncFileStream.cpp in Sources */,
0FFD4D6018651FA300512F6E /* AsyncScrollingCoordinator.cpp in Sources */,
Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp (215410 => 215411)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp 2017-04-17 15:00:33 UTC (rev 215410)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp 2017-04-17 15:01:32 UTC (rev 215411)
@@ -29,6 +29,7 @@
#if USE(LIBWEBRTC)
#include "LibWebRTCAudioModule.h"
#include "Logging.h"
+#include "VideoToolBoxEncoderFactory.h"
#include <dlfcn.h>
#include <webrtc/api/peerconnectionfactoryproxy.h>
#include <webrtc/base/physicalsocketserver.h>
@@ -59,7 +60,7 @@
{
static NeverDestroyed<PeerConnectionFactoryAndThreads> factoryAndThreads;
#if PLATFORM(COCOA)
- factoryAndThreads.get().encoderFactoryGetter = []() -> std::unique_ptr<cricket::WebRtcVideoEncoderFactory> { return std::make_unique<webrtc::VideoToolboxVideoEncoderFactory>(); };
+ factoryAndThreads.get().encoderFactoryGetter = []() -> std::unique_ptr<cricket::WebRtcVideoEncoderFactory> { return std::make_unique<VideoToolboxVideoEncoderFactory>(); };
factoryAndThreads.get().decoderFactoryGetter = []() -> std::unique_ptr<cricket::WebRtcVideoDecoderFactory> { return std::make_unique<webrtc::VideoToolboxVideoDecoderFactory>(); };
#endif
return factoryAndThreads.get();
Added: trunk/Source/WebCore/platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp (0 => 215411)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp 2017-04-17 15:01:32 UTC (rev 215411)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "VideoToolBoxEncoderFactory.h"
+
+#if USE(LIBWEBRTC) && PLATFORM(COCOA)
+
+#include <webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.h>
+
+namespace WebCore {
+
+webrtc::VideoEncoder* VideoToolboxVideoEncoderFactory::CreateSupportedVideoEncoder(const cricket::VideoCodec& codec)
+{
+ return new webrtc::H264VideoToolboxEncoder(codec);
+}
+
+void VideoToolboxVideoEncoderFactory::DestroyVideoEncoder(webrtc::VideoEncoder* encoder)
+{
+ delete encoder;
+ encoder = nullptr;
+}
+
+}
+#endif
Added: trunk/Source/WebCore/platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h (0 => 215411)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h 2017-04-17 15:01:32 UTC (rev 215411)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if USE(LIBWEBRTC) && PLATFORM(COCOA)
+
+#include "LibWebRTCMacros.h"
+#include <webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.h>
+
+namespace WebCore {
+
+class VideoToolboxVideoEncoderFactory final : public webrtc::VideoToolboxVideoEncoderFactory {
+public:
+ VideoToolboxVideoEncoderFactory() = default;
+
+private:
+ webrtc::VideoEncoder* CreateSupportedVideoEncoder(const cricket::VideoCodec&) final;
+ void DestroyVideoEncoder(webrtc::VideoEncoder*) final;
+};
+
+}
+
+#endif