Title: [279153] branches/safari-611.3.8.1-branch/Source/ThirdParty/libwebrtc
Revision
279153
Author
[email protected]
Date
2021-06-22 15:00:49 -0700 (Tue, 22 Jun 2021)

Log Message

Cherry-pick r278906. rdar://problem/79634523

    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:]):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278906 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-611.3.8.1-branch/Source/ThirdParty/libwebrtc/ChangeLog (279152 => 279153)


--- branches/safari-611.3.8.1-branch/Source/ThirdParty/libwebrtc/ChangeLog	2021-06-22 21:58:58 UTC (rev 279152)
+++ branches/safari-611.3.8.1-branch/Source/ThirdParty/libwebrtc/ChangeLog	2021-06-22 22:00:49 UTC (rev 279153)
@@ -1,3 +1,38 @@
+2021-06-22  Russell Epstein  <[email protected]>
+
+        Cherry-pick r278906. rdar://problem/79634523
+
+    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:]):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278906 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-06-15  Youenn Fablet  <[email protected]>
+
+            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  Alan Coon  <[email protected]>
 
         Cherry-pick r278410. rdar://problem/79355285

Modified: branches/safari-611.3.8.1-branch/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm (279152 => 279153)


--- branches/safari-611.3.8.1-branch/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm	2021-06-22 21:58:58 UTC (rev 279152)
+++ branches/safari-611.3.8.1-branch/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm	2021-06-22 22:00:49 UTC (rev 279153)
@@ -768,7 +768,27 @@
   CFBooleanRef hwaccl_enabled = nullptr;
   if (status == noErr) {
     auto result = VTSessionCopyProperty(_vtCompressionSession, kVTCompressionPropertyKey_UsingHardwareAcceleratedVideoEncoder, nullptr, &hwaccl_enabled);
-    _isUsingSoftwareEncoder = result == noErr ? !CFBooleanGetValue(hwaccl_enabled) : _width <= 480 && _height <= 480;
+    _isUsingSoftwareEncoder = result == noErr ? !CFBooleanGetValue(hwaccl_enabled) : true;
+#if HAVE_VTB_REQUIREDLOWLATENCY
+    if (_isUsingSoftwareEncoder && _isH264LowLatencyEncoderEnabled && _vtCompressionSession && !_useVCP) {
+      VTCompressionSessionInvalidate(_vtCompressionSession);
+      CFRelease(_vtCompressionSession);
+      _vtCompressionSession = nullptr;
+
+      CFDictionarySetValue(encoderSpecs, kVTVideoEncoderSpecification_RequiredLowLatency, kCFBooleanTrue);
+      CFDictionarySetValue(encoderSpecs, kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder, kCFBooleanFalse);
+      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
   }
 #else
   // Provided encoder should be good enough.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to