Diff
Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (229919 => 229920)
--- trunk/Source/ThirdParty/libwebrtc/ChangeLog 2018-03-23 21:03:36 UTC (rev 229919)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog 2018-03-23 21:18:56 UTC (rev 229920)
@@ -1,3 +1,25 @@
+2018-03-23 Youenn Fablet <you...@apple.com>
+
+ Add support for VCP encoder on MacOS and iOS
+ https://bugs.webkit.org/show_bug.cgi?id=183924
+
+ Reviewed by Eric Carlson.
+
+ Soft-Link VideoProcessing functions and use them in H264 encoder.
+ This is conditional on recent MacOS and iOS platforms.
+
+ * Source/webrtc/sdk/WebKit/EncoderUtilities.h: Added.
+ * Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.cpp: Added.
+ * Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h: Added.
+ * Source/webrtc/sdk/WebKit/WebKitUtilities.mm:
+ (webrtc::createVideoToolboxEncoderFactory):
+ * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm:
+ (-[RTCVideoEncoderH264 encode:codecSpecificInfo:frameTypes:]):
+ (-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):
+ (-[RTCVideoEncoderH264 destroyCompressionSession]):
+ * WebKit/0001-Using-VCP.patch: Added.
+ * libwebrtc.xcodeproj/project.pbxproj:
+
2018-03-23 David Kilzer <ddkil...@apple.com>
Stop using dispatch_set_target_queue()
Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/EncoderUtilities.h (0 => 229920)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/EncoderUtilities.h (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/EncoderUtilities.h 2018-03-23 21:18:56 UTC (rev 229920)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2018 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
+
+#include "VideoProcessingSoftLink.h"
+
+#if ENABLE_VCP_ENCODER
+
+#define CompressionSessionRef VCPCompressionSessionRef
+#define CompressionSessionSetProperty webrtc::VCPCompressionSessionSetProperty
+#define CompressionSessionGetPixelBufferPool webrtc::VCPCompressionSessionGetPixelBufferPool
+#define CompressionSessionEncodeFrame webrtc::VCPCompressionSessionEncodeFrame
+#define CompressionSessionCreate webrtc::VCPCompressionSessionCreate
+#define kCodecTypeH264 kVCPCodecType4CC_H264
+#define CompressionSessionInvalidate webrtc::VCPCompressionSessionInvalidate
+
+#else
+
+#define CompressionSessionRef VTCompressionSessionRef
+#define CompressionSessionSetProperty VTCompressionSessionSetProperty
+#define CompressionSessionGetPixelBufferPool VTCompressionSessionGetPixelBufferPool
+#define CompressionSessionEncodeFrame VTCompressionSessionEncodeFrame
+#define CompressionSessionCreate VTCompressionSessionCreate
+#define kCodecTypeH264 kCMVideoCodecType_H264
+#define CompressionSessionInvalidate VTCompressionSessionInvalidate
+
+#endif
Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.cpp (0 => 229920)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.cpp (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.cpp 2018-03-23 21:18:56 UTC (rev 229920)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2018 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 "VideoProcessingSoftLink.h"
+
+#if ENABLE_VCP_ENCODER
+
+#include "webrtc/base/logging.h"
+#import <dlfcn.h>
+#import <objc/runtime.h>
+
+// Macros copied from <wtf/cocoa/SoftLinking.h>
+#define SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE(functionNamespace, framework) \
+ namespace functionNamespace { \
+ void* framework##Library(bool isOptional) \
+ { \
+ static void* frameworkLibrary; \
+ static dispatch_once_t once; \
+ dispatch_once(&once, ^{ \
+ frameworkLibrary = dlopen("/System/Library/PrivateFrameworks/" #framework ".framework/" #framework, RTLD_NOW); \
+ if (!isOptional && !frameworkLibrary) \
+ LOG(LS_ERROR) << "Cannot open framework: " << dlerror(); \
+ }); \
+ return frameworkLibrary; \
+ } \
+ }
+
+#define SOFT_LINK_FUNCTION_FOR_SOURCE(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames) \
+ extern "C" { \
+ resultType functionName parameterDeclarations; \
+ } \
+ namespace functionNamespace { \
+ static resultType init##framework##functionName parameterDeclarations; \
+ resultType (*softLink##framework##functionName) parameterDeclarations = init##framework##functionName; \
+ static resultType init##framework##functionName parameterDeclarations \
+ { \
+ static dispatch_once_t once; \
+ dispatch_once(&once, ^{ \
+ softLink##framework##functionName = (resultType (*) parameterDeclarations) dlsym(framework##Library(), #functionName); \
+ if (!softLink##framework##functionName) \
+ LOG(LS_ERROR) << "Cannot find function ##functionName: " << dlerror(); \
+ }); \
+ return softLink##framework##functionName parameterNames; \
+ } \
+}
+
+SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE(webrtc, VideoProcessing)
+
+SOFT_LINK_FUNCTION_FOR_SOURCE(webrtc, VideoProcessing, VCPCompressionSessionSetProperty, OSStatus, (VCPCompressionSessionRef session, CFStringRef key, CFTypeRef value), (session, key, value))
+SOFT_LINK_FUNCTION_FOR_SOURCE(webrtc, VideoProcessing, VCPCompressionSessionGetPixelBufferPool, CVPixelBufferPoolRef, (VCPCompressionSessionRef session), (session))
+SOFT_LINK_FUNCTION_FOR_SOURCE(webrtc, VideoProcessing, VCPCompressionSessionEncodeFrame, OSStatus, (VCPCompressionSessionRef session, CVImageBufferRef buffer, CMTime timestamp, CMTime time, CFDictionaryRef dictionary, void* data, VTEncodeInfoFlags* flags), (session, buffer, timestamp, time, dictionary, data, flags))
+SOFT_LINK_FUNCTION_FOR_SOURCE(webrtc, VideoProcessing, VCPCompressionSessionCreate, OSStatus, (CFAllocatorRef allocator1, int32_t value1 , int32_t value2, CMVideoCodecType type, CFDictionaryRef dictionary1, CFDictionaryRef dictionary2, CFAllocatorRef allocator3, VTCompressionOutputCallback callback, void* data, VCPCompressionSessionRef* session), (allocator1, value1, value2, type, dictionary1, dictionary2, allocator3, callback, data, session))
+SOFT_LINK_FUNCTION_FOR_SOURCE(webrtc, VideoProcessing, VCPCompressionSessionInvalidate, void, (VCPCompressionSessionRef session), (session))
+SOFT_LINK_FUNCTION_FOR_SOURCE(webrtc, VideoProcessing, VPModuleInitialize, void, (), ())
+
+#endif // ENABLE_VCP_ENCODER
Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h (0 => 229920)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h 2018-03-23 21:18:56 UTC (rev 229920)
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2018 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
+
+#ifdef __APPLE__
+#include <Availability.h>
+#include <AvailabilityMacros.h>
+#include <TargetConditionals.h>
+
+#if (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)
+#define ENABLE_VCP_ENCODER 0
+#elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
+#define ENABLE_VCP_ENCODER (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110300)
+#elif (defined(TARGET_OS_MAC) && TARGET_OS_MAC)
+#define ENABLE_VCP_ENCODER (__MAC_OS_X_VERSION_MAX_ALLOWED >= 101304)
+#endif
+
+#if ENABLE_VCP_ENCODER
+
+#include <VideoProcessing/VideoProcessing.h>
+
+#define ALWAYS_INLINE inline
+
+#ifdef __cplusplus
+#define WTF_EXTERN_C_BEGIN extern "C" {
+#define WTF_EXTERN_C_END }
+#else
+#define WTF_EXTERN_C_BEGIN
+#define WTF_EXTERN_C_END
+#endif
+
+// Macros copied from <wtf/cocoa/SoftLinking.h>
+#define SOFT_LINK_FRAMEWORK_FOR_HEADER(functionNamespace, framework) \
+ namespace functionNamespace { \
+ extern void* framework##Library(bool isOptional = false); \
+ bool is##framework##FrameworkAvailable(); \
+ inline bool is##framework##FrameworkAvailable() { \
+ return framework##Library(true) != nullptr; \
+ } \
+ }
+
+#define SOFT_LINK_FUNCTION_FOR_HEADER(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames) \
+ WTF_EXTERN_C_BEGIN \
+ resultType functionName parameterDeclarations; \
+ WTF_EXTERN_C_END \
+ namespace functionNamespace { \
+ extern resultType (*softLink##framework##functionName) parameterDeclarations; \
+ inline resultType softLink_##framework##_##functionName parameterDeclarations \
+ { \
+ return softLink##framework##functionName parameterNames; \
+ } \
+ } \
+ ALWAYS_INLINE resultType functionName parameterDeclarations \
+ {\
+ return functionNamespace::softLink##framework##functionName parameterNames; \
+ }
+
+SOFT_LINK_FRAMEWORK_FOR_HEADER(webrtc, VideoProcessing)
+
+SOFT_LINK_FUNCTION_FOR_HEADER(webrtc, VideoProcessing, VCPCompressionSessionSetProperty, OSStatus, (VCPCompressionSessionRef session, CFStringRef key, CFTypeRef value), (session, key, value))
+#define VCPCompressionSessionSetProperty softLink_VideoProcessing_VCPCompressionSessionSetProperty
+
+SOFT_LINK_FUNCTION_FOR_HEADER(webrtc, VideoProcessing, VCPCompressionSessionGetPixelBufferPool, CVPixelBufferPoolRef, (VCPCompressionSessionRef session), (session))
+#define VCPCompressionSessionGetPixelBufferPool softLink_VideoProcessing_VCPCompressionSessionGetPixelBufferPool
+
+SOFT_LINK_FUNCTION_FOR_HEADER(webrtc, VideoProcessing, VCPCompressionSessionEncodeFrame, OSStatus, (VCPCompressionSessionRef session, CVImageBufferRef buffer, CMTime timestamp, CMTime time, CFDictionaryRef dictionary, void * data, VTEncodeInfoFlags * flags), (session, buffer, timestamp, time, dictionary, data, flags))
+#define VCPCompressionSessionEncodeFrame softLink_VideoProcessing_VCPCompressionSessionEncodeFrame
+
+SOFT_LINK_FUNCTION_FOR_HEADER(webrtc, VideoProcessing, VCPCompressionSessionCreate, OSStatus, (CFAllocatorRef allocator1, int32_t value1 , int32_t value2, CMVideoCodecType type, CFDictionaryRef dictionary1, CFDictionaryRef dictionary2, CFAllocatorRef allocator3, VTCompressionOutputCallback callback, void * data, VCPCompressionSessionRef *session), (allocator1, value1, value2, type, dictionary1, dictionary2, allocator3, callback, data, session))
+#define VCPCompressionSessionCreate softLink_VideoProcessing_VCPCompressionSessionCreate
+
+SOFT_LINK_FUNCTION_FOR_HEADER(webrtc, VideoProcessing, VCPCompressionSessionInvalidate, void, (VCPCompressionSessionRef session), (session))
+#define VCPCompressionSessionInvalidate softLink_VideoProcessing_VCPCompressionSessionInvalidate
+
+SOFT_LINK_FUNCTION_FOR_HEADER(webrtc, VideoProcessing, VPModuleInitialize, void, (), ())
+#define VPModuleInitialize softLink_VideoProcessing_VPModuleInitialize
+
+#endif // ENABLE_VCP_ENCODER
+
+#endif // __APPLE__
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.mm (229919 => 229920)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.mm 2018-03-23 21:03:36 UTC (rev 229919)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.mm 2018-03-23 21:18:56 UTC (rev 229920)
@@ -92,6 +92,12 @@
std::unique_ptr<webrtc::VideoEncoderFactory> createVideoToolboxEncoderFactory()
{
+#if ENABLE_VCP_ENCODER
+ static std::once_flag onceFlag;
+ std::call_once(onceFlag, [] {
+ webrtc::VPModuleInitialize();
+ });
+#endif
return std::make_unique<webrtc::ObjCVideoEncoderFactory>([[RTCVideoEncoderFactoryH264 alloc] init]);
}
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm (229919 => 229920)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm 2018-03-23 21:03:36 UTC (rev 229919)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm 2018-03-23 21:18:56 UTC (rev 229920)
@@ -34,6 +34,8 @@
#include "sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter.h"
#include "system_wrappers/include/clock.h"
#include "third_party/libyuv/include/libyuv/convert_from.h"
+
+#include "sdk/WebKit/EncoderUtilities.h"
#include "sdk/WebKit/WebKitUtilities.h"
@interface RTCVideoEncoderH264 ()
@@ -286,7 +288,7 @@
RTCVideoEncoderCallback _callback;
int32_t _width;
int32_t _height;
- VTCompressionSessionRef _compressionSession;
+ CompressionSessionRef _compressionSession;
RTCVideoCodecMode _mode;
webrtc::H264BitstreamParser _h264BitstreamParser;
@@ -363,9 +365,9 @@
// Get a pixel buffer from the pool and copy frame data over.
CVPixelBufferPoolRef pixelBufferPool =
- VTCompressionSessionGetPixelBufferPool(_compressionSession);
+ CompressionSessionGetPixelBufferPool(_compressionSession);
if ([self resetCompressionSessionIfNeededForPool:pixelBufferPool withFrame:frame]) {
- pixelBufferPool = VTCompressionSessionGetPixelBufferPool(_compressionSession);
+ pixelBufferPool = CompressionSessionGetPixelBufferPool(_compressionSession);
isKeyframeRequired = YES;
}
@@ -447,7 +449,7 @@
// Update the bitrate if needed.
[self setBitrateBps:_bitrateAdjuster->GetAdjustedBitrateBps()];
- OSStatus status = VTCompressionSessionEncodeFrame(_compressionSession,
+ OSStatus status = CompressionSessionEncodeFrame(_compressionSession,
pixelBuffer,
presentationTimeStamp,
kCMTimeInvalid,
@@ -582,10 +584,10 @@
webrtc::isH264HardwareEncoderAllowed() ? kCFBooleanTrue : kCFBooleanFalse);
#endif
OSStatus status =
- VTCompressionSessionCreate(nullptr, // use default allocator
+ CompressionSessionCreate(nullptr, // use default allocator
_width,
_height,
- kCMVideoCodecType_H264,
+ kCodecTypeH264,
encoder_specs, // use hardware accelerated encoder if available
sourceAttributes,
nullptr, // use default compressed data allocator
@@ -642,7 +644,7 @@
- (void)destroyCompressionSession {
if (_compressionSession) {
- VTCompressionSessionInvalidate(_compressionSession);
+ CompressionSessionInvalidate(_compressionSession);
CFRelease(_compressionSession);
_compressionSession = nullptr;
}
Added: trunk/Source/ThirdParty/libwebrtc/WebKit/0001-Using-VCP.patch (0 => 229920)
--- trunk/Source/ThirdParty/libwebrtc/WebKit/0001-Using-VCP.patch (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/WebKit/0001-Using-VCP.patch 2018-03-23 21:18:56 UTC (rev 229920)
@@ -0,0 +1,77 @@
+From f6d216e76cc576b7cac5a980c74d4cf60f28cb17 Mon Sep 17 00:00:00 2001
+From: Youenn Fablet <you...@apple.com>
+Date: Thu, 22 Mar 2018 15:44:50 -0700
+Subject: [PATCH] Using VCP
+
+---
+ .../Classes/VideoToolbox/RTCVideoEncoderH264.mm | 16 +++++++++-------
+ 1 file changed, 9 insertions(+), 7 deletions(-)
+
+diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm b/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm
+index d1af6e3c632..138d44573b8 100644
+--- a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm
++++ b/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm
+@@ -34,6 +34,8 @@
+ #include "sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter.h"
+ #include "system_wrappers/include/clock.h"
+ #include "third_party/libyuv/include/libyuv/convert_from.h"
++
++#include "sdk/WebKit/EncoderUtilities.h"
+ #include "sdk/WebKit/WebKitUtilities.h"
+
+ @interface RTCVideoEncoderH264 ()
+@@ -286,7 +288,7 @@ @implementation RTCVideoEncoderH264 {
+ RTCVideoEncoderCallback _callback;
+ int32_t _width;
+ int32_t _height;
+- VTCompressionSessionRef _compressionSession;
++ CompressionSessionRef _compressionSession;
+ RTCVideoCodecMode _mode;
+
+ webrtc::H264BitstreamParser _h264BitstreamParser;
+@@ -360,9 +362,9 @@ - (NSInteger)encode:(RTCVideoFrame *)frame
+
+ // Get a pixel buffer from the pool and copy frame data over.
+ CVPixelBufferPoolRef pixelBufferPool =
+- VTCompressionSessionGetPixelBufferPool(_compressionSession);
++ CompressionSessionGetPixelBufferPool(_compressionSession);
+ if ([self resetCompressionSessionIfNeededForPool:pixelBufferPool withFrame:frame]) {
+- pixelBufferPool = VTCompressionSessionGetPixelBufferPool(_compressionSession);
++ pixelBufferPool = CompressionSessionGetPixelBufferPool(_compressionSession);
+ isKeyframeRequired = YES;
+ }
+
+@@ -444,7 +446,7 @@ - (NSInteger)encode:(RTCVideoFrame *)frame
+ // Update the bitrate if needed.
+ [self setBitrateBps:_bitrateAdjuster->GetAdjustedBitrateBps()];
+
+- OSStatus status = VTCompressionSessionEncodeFrame(_compressionSession,
++ OSStatus status = CompressionSessionEncodeFrame(_compressionSession,
+ pixelBuffer,
+ presentationTimeStamp,
+ kCMTimeInvalid,
+@@ -579,10 +581,10 @@ - (int)resetCompressionSessionWithPixelFormat:(OSType)framePixelFormat {
+ webrtc::isH264HardwareEncoderAllowed() ? kCFBooleanTrue : kCFBooleanFalse);
+ #endif
+ OSStatus status =
+- VTCompressionSessionCreate(nullptr, // use default allocator
++ CompressionSessionCreate(nullptr, // use default allocator
+ _width,
+ _height,
+- kCMVideoCodecType_H264,
++ kCodecTypeH264,
+ encoder_specs, // use hardware accelerated encoder if available
+ sourceAttributes,
+ nullptr, // use default compressed data allocator
+@@ -639,7 +641,7 @@ - (void)configureCompressionSession {
+
+ - (void)destroyCompressionSession {
+ if (_compressionSession) {
+- VTCompressionSessionInvalidate(_compressionSession);
++ CompressionSessionInvalidate(_compressionSession);
+ CFRelease(_compressionSession);
+ _compressionSession = nullptr;
+ }
+--
+2.15.1 (Apple Git-101)
+
Modified: trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj (229919 => 229920)
--- trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj 2018-03-23 21:03:36 UTC (rev 229919)
+++ trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj 2018-03-23 21:18:56 UTC (rev 229920)
@@ -837,6 +837,9 @@
41ECEAE7206417E9009D5141 /* webrtcvideoencoderfactory.cc in Sources */ = {isa = PBXBuildFile; fileRef = 41ECEAE5206417E8009D5141 /* webrtcvideoencoderfactory.cc */; };
41ECEAE8206417E9009D5141 /* webrtcvideodecoderfactory.cc in Sources */ = {isa = PBXBuildFile; fileRef = 41ECEAE6206417E9009D5141 /* webrtcvideodecoderfactory.cc */; };
41ECEAEA20641812009D5141 /* RTCVideoEncoderSettings.mm in Sources */ = {isa = PBXBuildFile; fileRef = 41ECEAE920641812009D5141 /* RTCVideoEncoderSettings.mm */; };
+ 41ECEAFC20646664009D5141 /* EncoderUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 41ECEAF920646663009D5141 /* EncoderUtilities.h */; };
+ 41ECEAFD20646664009D5141 /* VideoProcessingSoftLink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41ECEAFA20646663009D5141 /* VideoProcessingSoftLink.cpp */; };
+ 41ECEAFE20646664009D5141 /* VideoProcessingSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 41ECEAFB20646664009D5141 /* VideoProcessingSoftLink.h */; };
41F411AD1EF8D91F00343C26 /* null_aec_dump_factory.cc in Sources */ = {isa = PBXBuildFile; fileRef = 41F411AC1EF8D91E00343C26 /* null_aec_dump_factory.cc */; };
41F411B01EF8DA0100343C26 /* rtcerror.cc in Sources */ = {isa = PBXBuildFile; fileRef = 41F411AE1EF8DA0000343C26 /* rtcerror.cc */; };
41F411B11EF8DA0200343C26 /* rtcerror.h in Headers */ = {isa = PBXBuildFile; fileRef = 41F411AF1EF8DA0000343C26 /* rtcerror.h */; };
@@ -3983,6 +3986,9 @@
41ECEAE6206417E9009D5141 /* webrtcvideodecoderfactory.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = webrtcvideodecoderfactory.cc; path = engine/webrtcvideodecoderfactory.cc; sourceTree = "<group>"; };
41ECEAE920641812009D5141 /* RTCVideoEncoderSettings.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RTCVideoEncoderSettings.mm; path = PeerConnection/RTCVideoEncoderSettings.mm; sourceTree = "<group>"; };
41ECEAF620645CE6009D5141 /* UIDevice+RTCDevice.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "UIDevice+RTCDevice.mm"; path = "Common/UIDevice+RTCDevice.mm"; sourceTree = "<group>"; };
+ 41ECEAF920646663009D5141 /* EncoderUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EncoderUtilities.h; sourceTree = "<group>"; };
+ 41ECEAFA20646663009D5141 /* VideoProcessingSoftLink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VideoProcessingSoftLink.cpp; sourceTree = "<group>"; };
+ 41ECEAFB20646664009D5141 /* VideoProcessingSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoProcessingSoftLink.h; sourceTree = "<group>"; };
41F411AC1EF8D91E00343C26 /* null_aec_dump_factory.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = null_aec_dump_factory.cc; path = Source/webrtc/modules/audio_processing/aec_dump/null_aec_dump_factory.cc; sourceTree = SOURCE_ROOT; };
41F411AE1EF8DA0000343C26 /* rtcerror.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rtcerror.cc; sourceTree = "<group>"; };
41F411AF1EF8DA0000343C26 /* rtcerror.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rtcerror.h; sourceTree = "<group>"; };
@@ -6845,6 +6851,9 @@
419C849A1FE2FEC00040C30F /* encoder.mm */,
419C849C1FE2FEC00040C30F /* encoder_vcp.h */,
419C84991FE2FEBF0040C30F /* encoder_vcp.mm */,
+ 41ECEAF920646663009D5141 /* EncoderUtilities.h */,
+ 41ECEAFA20646663009D5141 /* VideoProcessingSoftLink.cpp */,
+ 41ECEAFB20646664009D5141 /* VideoProcessingSoftLink.h */,
419C84AF1FE304C70040C30F /* VideoToolBoxDecoderFactory.cpp */,
419C84AD1FE304C60040C30F /* VideoToolBoxDecoderFactory.h */,
419C84AE1FE304C60040C30F /* VideoToolBoxEncoderFactory.cpp */,
@@ -11201,6 +11210,7 @@
419C84A41FE300810040C30F /* encoder.h in Headers */,
5CDD85A01E43B5C000621E92 /* encoder_rtcp_feedback.h in Headers */,
419C84C11FE31A0B0040C30F /* encoder_vcp.h in Headers */,
+ 41ECEAFC20646664009D5141 /* EncoderUtilities.h in Headers */,
5CDD8B991E43C2B500621E92 /* energy_inverse.h in Headers */,
5CDD8B9B1E43C2B500621E92 /* enh_upsample.h in Headers */,
5CDD8B9F1E43C2B500621E92 /* enhancer.h in Headers */,
@@ -11968,6 +11978,7 @@
5C4B49071E42C1E3002651C8 /* videocommon.h in Headers */,
5CD286251E6A666D0094FDC8 /* videodecodersoftwarefallbackwrapper.h in Headers */,
5C4B488A1E42C1BA002651C8 /* videoencodersoftwarefallbackwrapper.h in Headers */,
+ 41ECEAFE20646664009D5141 /* VideoProcessingSoftLink.h in Headers */,
41F9BF892051C80100ABF0B9 /* videosinkinterface.h in Headers */,
5C4B490C1E42C1E3002651C8 /* videosourcebase.h in Headers */,
41F9BF8A2051C80100ABF0B9 /* videosourceinterface.h in Headers */,
@@ -13720,6 +13731,7 @@
5C4B49061E42C1E3002651C8 /* videocommon.cc in Sources */,
5CD286241E6A666D0094FDC8 /* videodecodersoftwarefallbackwrapper.cc in Sources */,
5C4B48891E42C1BA002651C8 /* videoencodersoftwarefallbackwrapper.cc in Sources */,
+ 41ECEAFD20646664009D5141 /* VideoProcessingSoftLink.cpp in Sources */,
5C4B490B1E42C1E3002651C8 /* videosourcebase.cc in Sources */,
41F9BF8F2051C80100ABF0B9 /* videosourceinterface.cc in Sources */,
419C84B31FE304C70040C30F /* VideoToolBoxDecoderFactory.cpp in Sources */,