Changeset 264966 in webkit


Ignore:
Timestamp:
Jul 28, 2020 1:01:20 AM (4 years ago)
Author:
youenn@apple.com
Message:

Disable low latency code path for H264 constrained baseline
https://bugs.webkit.org/show_bug.cgi?id=214830

Reviewed by Eric Carlson.

Source/ThirdParty/libwebrtc:

In case of baseline profile, use straight VTB encoder.
In case of high profile, use low latency code path if enabled.
In case of MacOS software code path, enable low latency code path as straight VTB encoder buffers frames.

  • Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm:

(-[RTCVideoEncoderH264 initWithCodecInfo:]):
(-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):

Source/WebKit:

Enable low latency code path on iOS.
Manually tested.

  • Shared/WebPreferences.yaml:
  • Shared/WebPreferencesDefaultValues.cpp:

(WebKit::defaultWebRTCH264LowLatencyEncoderEnabled):

  • Shared/WebPreferencesDefaultValues.h:
Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/ThirdParty/libwebrtc/ChangeLog

    r264904 r264966  
     12020-07-28  Youenn Fablet  <youenn@apple.com>
     2
     3        Disable low latency code path for H264 constrained baseline
     4        https://bugs.webkit.org/show_bug.cgi?id=214830
     5
     6        Reviewed by Eric Carlson.
     7
     8        In case of baseline profile, use straight VTB encoder.
     9        In case of high profile, use low latency code path if enabled.
     10        In case of MacOS software code path, enable low latency code path as straight VTB encoder buffers frames.
     11
     12        * Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm:
     13        (-[RTCVideoEncoderH264 initWithCodecInfo:]):
     14        (-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):
     15
    1162020-07-26  Michael Catanzaro  <mcatanzaro@gnome.org>
    217
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm

    r264822 r264966  
    365365    _profile_level_id =
    366366        webrtc::H264::ParseSdpProfileLevelId([codecInfo nativeSdpVideoFormat].parameters);
    367 #if ENABLE_VCP_VTB_ENCODER
    368367    if (_profile_level_id) {
    369368      auto profile = ExtractProfile(*_profile_level_id);
     
    372371      _useVCP = false;
    373372    }
    374 #else
    375     _useVCP = false;
    376 #endif
    377373    RTC_DCHECK(_profile_level_id);
    378374    RTC_LOG(LS_INFO) << "Using profile " << CFStringToString(ExtractProfile(*_profile_level_id));
     
    701697  }
    702698#elif HAVE_VTB_REQUIREDLOWLATENCY
    703   if (webrtc::isH264LowLatencyEncoderEnabled())
     699  if (webrtc::isH264LowLatencyEncoderEnabled() && _useVCP)
    704700    CFDictionarySetValue(encoderSpecs, kVTVideoEncoderSpecification_RequiredLowLatency, kCFBooleanTrue);
    705701#endif
     
    750746                               &_vcpCompressionSession);
    751747  }
    752 #elif !HAVE_VTB_REQUIREDLOWLATENCY
     748#elif HAVE_VTB_REQUIREDLOWLATENCY
     749  // In case VCP is disabled, we will use it anyway if using software encoder.
     750  if (webrtc::isH264LowLatencyEncoderEnabled() && !_useVCP) {
     751    CFBooleanRef hwaccl_enabled = nullptr;
     752    if (status == noErr) {
     753      status = VTSessionCopyProperty(_vtCompressionSession,
     754                               kVTCompressionPropertyKey_UsingHardwareAcceleratedVideoEncoder,
     755                               nullptr,
     756                               &hwaccl_enabled);
     757    }
     758    if (status == noErr && (CFBooleanGetValue(hwaccl_enabled))) {
     759      RTC_LOG(LS_INFO) << "Compression session created with hw accl enabled";
     760    } else {
     761      [self destroyCompressionSession];
     762      CFDictionarySetValue(encoderSpecs, kVTVideoEncoderSpecification_RequiredLowLatency, kCFBooleanTrue);
     763      status = VTCompressionSessionCreate(nullptr,  // use default allocator
     764                                 _width,
     765                                 _height,
     766                                 kCMVideoCodecType_H264,
     767                                 encoderSpecs,  // use hardware accelerated encoder if available
     768                                 sourceAttributes,
     769                                 nullptr,  // use default compressed data allocator
     770                                 compressionOutputCallback,
     771                                 nullptr,
     772                                 &_vtCompressionSession);
     773    }
     774  }
     775#else
    753776  if (status != noErr) {
    754777    if (encoderSpecs) {
  • trunk/Source/WebKit/ChangeLog

    r264961 r264966  
     12020-07-28  Youenn Fablet  <youenn@apple.com>
     2
     3        Disable low latency code path for H264 constrained baseline
     4        https://bugs.webkit.org/show_bug.cgi?id=214830
     5
     6        Reviewed by Eric Carlson.
     7
     8        Enable low latency code path on iOS.
     9        Manually tested.
     10
     11        * Shared/WebPreferences.yaml:
     12        * Shared/WebPreferencesDefaultValues.cpp:
     13        (WebKit::defaultWebRTCH264LowLatencyEncoderEnabled):
     14        * Shared/WebPreferencesDefaultValues.h:
     15
    1162020-07-27  Kate Cheney  <katherine_cheney@apple.com>
    217
  • trunk/Source/WebKit/Shared/WebPreferences.yaml

    r264747 r264966  
    600600WebRTCH264LowLatencyEncoderEnabled:
    601601  type: bool
    602   defaultValue: false
     602  defaultValue: defaultWebRTCH264LowLatencyEncoderEnabled()
    603603  webcoreBinding: RuntimeEnabledFeatures
    604604  condition: ENABLE(WEB_RTC)
  • trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.cpp

    r264747 r264966  
    266266#endif
    267267
     268#if ENABLE(WEB_RTC)
     269bool defaultWebRTCH264LowLatencyEncoderEnabled()
     270{
     271#if PLATFORM(IOS_FAMILY)
     272    return true;
     273#else
     274    return false;
     275#endif
     276}
     277#endif
     278
    268279} // namespace WebKit
  • trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h

    r264747 r264966  
    371371#endif
    372372
     373#if ENABLE(WEB_RTC)
     374bool defaultWebRTCH264LowLatencyEncoderEnabled();
     375#endif
     376
    373377} // namespace WebKit
Note: See TracChangeset for help on using the changeset viewer.