Title: [270181] trunk/Source/ThirdParty/libwebrtc
Revision
270181
Author
[email protected]
Date
2020-11-27 00:07:42 -0800 (Fri, 27 Nov 2020)

Log Message

RTCVideoEncoderH264 does not need to support case without ENABLE_VCP_ENCODER and without HAVE_VTB_REQUIREDLOWLATENCY
https://bugs.webkit.org/show_bug.cgi?id=219224

Reviewed by Eric Carlson.

* Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h:
Make sure to compile the same with public SDK
* Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm:
(-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):
Remove code path that is no longer useful.

Modified Paths

Diff

Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (270180 => 270181)


--- trunk/Source/ThirdParty/libwebrtc/ChangeLog	2020-11-27 04:42:34 UTC (rev 270180)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog	2020-11-27 08:07:42 UTC (rev 270181)
@@ -1,3 +1,16 @@
+2020-11-27  Youenn Fablet  <[email protected]>
+
+        RTCVideoEncoderH264 does not need to support case without ENABLE_VCP_ENCODER and without HAVE_VTB_REQUIREDLOWLATENCY
+        https://bugs.webkit.org/show_bug.cgi?id=219224
+
+        Reviewed by Eric Carlson.
+
+        * Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h:
+        Make sure to compile the same with public SDK
+        * Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm:
+        (-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):
+        Remove code path that is no longer useful.
+
 2020-11-13  Youenn Fablet  <[email protected]>
 
         Remote encoder should set its encoder frame callback to nullptr when being released

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h (270180 => 270181)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h	2020-11-27 04:42:34 UTC (rev 270180)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h	2020-11-27 08:07:42 UTC (rev 270181)
@@ -28,11 +28,9 @@
 #ifdef __APPLE__
 #include <Availability.h>
 #include <AvailabilityMacros.h>
+#include <VideoToolbox/VideoToolbox.h>
 #include <TargetConditionals.h>
 
-// Macro taken from WTF/wtf/Platform.h
-#if defined __has_include && __has_include(<CoreFoundation/CFPriv.h>)
-
 #if (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)
 #define ENABLE_VCP_ENCODER 0
 #define ENABLE_VCP_VTB_ENCODER 0
@@ -46,8 +44,6 @@
 #define HAVE_VTB_REQUIREDLOWLATENCY __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000
 #endif
 
-#endif
-
 #if !defined(ENABLE_VCP_ENCODER)
 #define ENABLE_VCP_ENCODER 0
 #endif
@@ -124,8 +120,6 @@
 
 #if ENABLE_VCP_ENCODER || ENABLE_VCP_VTB_ENCODER
 
-#include <VideoProcessing/VideoProcessing.h>
-
 SOFT_LINK_FRAMEWORK_FOR_HEADER(webrtc, VideoProcessing)
 
 SOFT_LINK_FUNCTION_FOR_HEADER(webrtc, VideoProcessing, VPModuleInitialize, void, (), ())
@@ -133,6 +127,8 @@
 
 #endif
 
+using VCPCompressionSessionRef = void*;
+
 #if ENABLE_VCP_ENCODER
 
 SOFT_LINK_FUNCTION_FOR_HEADER(webrtc, VideoProcessing, VCPCompressionSessionSetProperty, OSStatus, (VCPCompressionSessionRef session, CFStringRef key, CFTypeRef value), (session, key, value))
@@ -150,8 +146,6 @@
 SOFT_LINK_FUNCTION_FOR_HEADER(webrtc, VideoProcessing, VCPCompressionSessionInvalidate, void, (VCPCompressionSessionRef session), (session))
 #define VCPCompressionSessionInvalidate softLink_VideoProcessing_VCPCompressionSessionInvalidate
 
-#else
-using VCPCompressionSessionRef = void*;
 #endif // ENABLE_VCP_ENCODER
 
 #endif // __APPLE__

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm (270180 => 270181)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm	2020-11-27 04:42:34 UTC (rev 270180)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm	2020-11-27 08:07:42 UTC (rev 270181)
@@ -718,8 +718,7 @@
                                  nullptr,
                                  &_vtCompressionSession);
 
-#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
-#if ENABLE_VCP_ENCODER
+#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) && ENABLE_VCP_ENCODER
   CFBooleanRef hwaccl_enabled = nullptr;
   if (status == noErr) {
     status = VTSessionCopyProperty(_vtCompressionSession,
@@ -743,7 +742,7 @@
         webrtc::VCPCompressionSessionCreate(nullptr,  // use default allocator
                                _width,
                                _height,
-                               kVCPCodecType4CC_H264,
+                               'ftvc',
                                encoderSpecs,
                                sourceAttributes,
                                nullptr,  // use default compressed data allocator
@@ -751,98 +750,9 @@
                                nullptr,
                                &_vcpCompressionSession);
   }
-#elif HAVE_VTB_REQUIREDLOWLATENCY
+#else
   // Provided encoder should be good enough.
-#else
-  if (status != noErr) {
-    if (encoderSpecs) {
-        CFRelease(encoderSpecs);
-        encoderSpecs = nullptr;
-    }
-    if (sourceAttributes) {
-      CFRelease(sourceAttributes);
-      sourceAttributes = nullptr;
-    }
-
-    auto isStandardFrameSize = [](int32_t width, int32_t height) {
-        // FIXME: Envision relaxing this rule, something like width and height dividable by 4 or 8 should be good enough.
-        if (width == 1280)
-            return height == 720;
-        if (width == 720)
-            return height == 1280;
-        if (width == 960)
-            return height == 540;
-        if (width == 540)
-            return height == 960;
-        if (width == 640)
-            return height == 480;
-        if (width == 480)
-            return height == 640;
-        if (width == 288)
-            return height == 352;
-        if (width == 352)
-            return height == 288;
-        if (width == 320)
-            return height == 240;
-        if (width == 240)
-            return height == 320;
-        return false;
-    };
-
-    if (!isStandardFrameSize(_width, _height)) {
-      _disableEncoding = true;
-      RTC_LOG(LS_ERROR) << "Using H264 software encoder with non standard size is not supported";
-      return WEBRTC_VIDEO_CODEC_ERROR;
-    }
-    [self destroyCompressionSession];
-
-    CFDictionaryRef ioSurfaceValue = CreateCFTypeDictionary(nullptr, nullptr, 0);
-    int64_t pixelFormatType = framePixelFormat;
-    CFNumberRef pixelFormat = CFNumberCreate(nullptr, kCFNumberLongType, &pixelFormatType);
-
-    const size_t attributesSize = 3;
-    CFTypeRef keys[attributesSize] = {
-      kCVPixelBufferOpenGLCompatibilityKey,
-      kCVPixelBufferIOSurfacePropertiesKey,
-      kCVPixelBufferPixelFormatTypeKey
-    };
-    CFTypeRef values[attributesSize] = {
-      kCFBooleanTrue,
-      ioSurfaceValue,
-      pixelFormat};
-    sourceAttributes = CreateCFTypeDictionary(keys, values, attributesSize);
-
-    if (ioSurfaceValue) {
-      CFRelease(ioSurfaceValue);
-      ioSurfaceValue = nullptr;
-    }
-    if (pixelFormat) {
-      CFRelease(pixelFormat);
-      pixelFormat = nullptr;
-    }
-
-    encoderSpecs = CFDictionaryCreateMutable(nullptr, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
-    CFDictionarySetValue(encoderSpecs, kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder, kCFBooleanFalse);
-    int usageValue = 1;
-    CFNumberRef usage = CFNumberCreate(nullptr, kCFNumberIntType, &usageValue);
-    CFDictionarySetValue(encoderSpecs, kVTVideoEncoderSpecification_Usage, usage);
-    if (usage) {
-      CFRelease(usage);
-      usage = nullptr;
-    }
-    status = VTCompressionSessionCreate(nullptr,  // use default allocator
-                                 _width,
-                                 _height,
-                                 kCMVideoCodecType_H264,
-                                 encoderSpecs,  // use hardware accelerated encoder if available
-                                 sourceAttributes,
-                                 nullptr,  // use default compressed data allocator
-                                 compressionOutputCallback,
-                                 nullptr,
-                                 &_vtCompressionSession);
-  }
-#endif // !HAVE_VTB_REQUIREDLOWLATENCY
-#endif // defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
+#endif // defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) && ENABLE_VCP_ENCODER
   if (sourceAttributes) {
     CFRelease(sourceAttributes);
     sourceAttributes = nullptr;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to