Changeset 246263 in webkit


Ignore:
Timestamp:
Jun 10, 2019 8:59:14 AM (5 years ago)
Author:
youenn@apple.com
Message:

Call was negotiated with H264 Base Profile 42e01f but encoded in High Profile
https://bugs.webkit.org/show_bug.cgi?id=195124
<rdar://problem/48453085>

Reviewed by Eric Carlson.

Source/ThirdParty/libwebrtc:

Use VTB directly instead of VCP when baseline is requested.
For platforms supporting the VCP-in-VTB API, use VCP for high profile, VTB for baseline.
For platforms not supporting the VCP-in-VTB API, use regular VTB for both baseline and high profile.
On MacOS, if VTB session creation fails, use VCP as a fallback.
Keep VTB-only code path for non internal builds.

  • Source/webrtc/sdk/WebKit/EncoderUtilities.h: Removed.
  • Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h:
  • Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm:

(-[RTCSingleVideoEncoderH264 initWithCodecInfo:simulcastIndex:]):
(-[RTCSingleVideoEncoderH264 hasCompressionSession]):
(-[RTCSingleVideoEncoderH264 encode:codecSpecificInfo:frameTypes:]):
(-[RTCSingleVideoEncoderH264 resetCompressionSessionIfNeededWithFrame:]):
(-[RTCSingleVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):
(-[RTCSingleVideoEncoderH264 configureCompressionSession]):
(-[RTCSingleVideoEncoderH264 destroyCompressionSession]):
(-[RTCSingleVideoEncoderH264 setEncoderBitrateBps:]):

  • Source/webrtc/sdk/objc/components/video_codec/helpers.cc:
  • Source/webrtc/sdk/objc/components/video_codec/helpers.h:

LayoutTests:

  • webrtc/video-h264-expected.txt: Added.
  • webrtc/video-h264.html: Added.
Location:
trunk
Files:
2 added
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r246232 r246263  
     12019-06-10  Youenn Fablet  <youenn@apple.com>
     2
     3        Call was negotiated with H264 Base Profile 42e01f but encoded in High Profile
     4        https://bugs.webkit.org/show_bug.cgi?id=195124
     5        <rdar://problem/48453085>
     6
     7        Reviewed by Eric Carlson.
     8
     9        * webrtc/video-h264-expected.txt: Added.
     10        * webrtc/video-h264.html: Added.
     11
    1122019-06-08  Cathie Chen  <cathiechen@igalia.com>
    213
  • trunk/Source/ThirdParty/libwebrtc/ChangeLog

    r245829 r246263  
     12019-06-10  Youenn Fablet  <youenn@apple.com>
     2
     3        Call was negotiated with H264 Base Profile 42e01f but encoded in High Profile
     4        https://bugs.webkit.org/show_bug.cgi?id=195124
     5        <rdar://problem/48453085>
     6
     7        Reviewed by Eric Carlson.
     8
     9        Use VTB directly instead of VCP when baseline is requested.
     10        For platforms supporting the VCP-in-VTB API, use VCP for high profile, VTB for baseline.
     11        For platforms not supporting the VCP-in-VTB API, use regular VTB for both baseline and high profile.
     12        On MacOS, if VTB session creation fails, use VCP as a fallback.
     13        Keep VTB-only code path for non internal builds.
     14
     15        * Source/webrtc/sdk/WebKit/EncoderUtilities.h: Removed.
     16        * Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h:
     17        * Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm:
     18        (-[RTCSingleVideoEncoderH264 initWithCodecInfo:simulcastIndex:]):
     19        (-[RTCSingleVideoEncoderH264 hasCompressionSession]):
     20        (-[RTCSingleVideoEncoderH264 encode:codecSpecificInfo:frameTypes:]):
     21        (-[RTCSingleVideoEncoderH264 resetCompressionSessionIfNeededWithFrame:]):
     22        (-[RTCSingleVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):
     23        (-[RTCSingleVideoEncoderH264 configureCompressionSession]):
     24        (-[RTCSingleVideoEncoderH264 destroyCompressionSession]):
     25        (-[RTCSingleVideoEncoderH264 setEncoderBitrateBps:]):
     26        * Source/webrtc/sdk/objc/components/video_codec/helpers.cc:
     27        * Source/webrtc/sdk/objc/components/video_codec/helpers.h:
     28
    1292019-05-28  Youenn Fablet  <youenn@apple.com>
    230
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h

    r243811 r246263  
    3434#if defined __has_include && __has_include(<CoreFoundation/CFPriv.h>)
    3535
    36 #if (defined(TARGET_IPHONE_SIMULATOR)  && TARGET_IPHONE_SIMULATOR)
     36#if (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)
    3737#define ENABLE_VCP_ENCODER 0
    3838#define ENABLE_VCP_VTB_ENCODER 0
    39 #elif (defined(TARGET_OS_IPHONE)  && TARGET_OS_IPHONE)
    40 #define ENABLE_VCP_ENCODER __MAC_OS_X_VERSION_MAX_ALLOWED < 101500
     39#elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
     40#define ENABLE_VCP_ENCODER 1
    4141#define ENABLE_VCP_VTB_ENCODER __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
    4242#elif (defined(TARGET_OS_MAC) && TARGET_OS_MAC)
    43 #define ENABLE_VCP_ENCODER (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101300 && __MAC_OS_X_VERSION_MAX_ALLOWED < 101500)
     43#define ENABLE_VCP_ENCODER __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
    4444#define ENABLE_VCP_VTB_ENCODER __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
    4545#endif
     
    146146#define VCPCompressionSessionInvalidate softLink_VideoProcessing_VCPCompressionSessionInvalidate
    147147
     148#else
     149using VCPCompressionSessionRef = void*;
    148150#endif // ENABLE_VCP_ENCODER
    149151
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm

    r243811 r246263  
    3232#include "third_party/libyuv/include/libyuv/convert_from.h"
    3333
    34 #include "sdk/WebKit/EncoderUtilities.h"
    3534#include "sdk/WebKit/WebKitUtilities.h"
    3635
     
    4140VT_EXPORT const CFStringRef kVTCompressionPropertyKey_Usage;
    4241
    43 #if !ENABLE_VCP_ENCODER && !defined(WEBRTC_IOS) && !ENABLE_VCP_VTB_ENCODER
     42#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) && !ENABLE_VCP_ENCODER
    4443static inline bool isStandardFrameSize(int32_t width, int32_t height)
    4544{
     
    319318  int32_t _width;
    320319  int32_t _height;
    321   CompressionSessionRef _compressionSession;
     320  bool _useVCP;
     321  VTCompressionSessionRef _vtCompressionSession;
     322  VCPCompressionSessionRef _vcpCompressionSession;
    322323  CVPixelBufferPoolRef _pixelBufferPool;
    323324  RTCVideoCodecMode _mode;
     
    344345    _packetizationMode = RTCH264PacketizationModeNonInterleaved;
    345346    _profile = ExtractProfile([codecInfo nativeSdpVideoFormat]);
     347#if ENABLE_VCP_VTB_ENCODER
     348    _useVCP = [(__bridge NSString *)_profile containsString: @"High"];
     349#else
     350    _useVCP = false;
     351#endif
    346352    _simulcastIndex = index;
    347353    RTC_LOG(LS_INFO) << "Using profile " << CFStringToString(_profile);
     
    375381
    376382  return [self resetCompressionSessionWithPixelFormat:kNV12PixelFormat];
     383}
     384
     385- (bool)hasCompressionSession
     386{
     387    return _vtCompressionSession || _vcpCompressionSession;
    377388}
    378389
     
    382393  RTC_DCHECK_EQ(frame.width, _width);
    383394  RTC_DCHECK_EQ(frame.height, _height);
    384   if (!_callback || !_compressionSession) {
     395  if (!_callback || ![self hasCompressionSession]) {
    385396    return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
    386397  }
     
    475486  [self setBitrateBps:_bitrateAdjuster->GetAdjustedBitrateBps()];
    476487
    477   OSStatus status = CompressionSessionEncodeFrame(_compressionSession,
     488  OSStatus status;
     489  if (_vtCompressionSession) {
     490    status = VTCompressionSessionEncodeFrame(_vtCompressionSession,
    478491                                                    pixelBuffer,
    479492                                                    presentationTimeStamp,
     
    482495                                                    encodeParams.release(),
    483496                                                    nullptr);
     497  } else {
     498#if ENABLE_VCP_ENCODER
     499    status = webrtc::VCPCompressionSessionEncodeFrame(_vcpCompressionSession,
     500                                                    pixelBuffer,
     501                                                    presentationTimeStamp,
     502                                                    kCMTimeInvalid,
     503                                                    frameProperties,
     504                                                    encodeParams.release(),
     505                                                    nullptr);
     506#else
     507    status = 1;
     508#endif
     509  }
    484510  if (frameProperties) {
    485511    CFRelease(frameProperties);
     
    541567  OSType framePixelFormat = [self pixelFormatOfFrame:frame];
    542568
    543   if (_compressionSession) {
     569  if ([self hasCompressionSession]) {
    544570#if defined(WEBRTC_WEBKIT_BUILD)
    545571    if (!_pixelBufferPool) {
     
    619645  CFDictionarySetValue(encoderSpecs, kVTCompressionPropertyKey_RealTime, kCFBooleanTrue);
    620646
    621 #if ENABLE_VCP_ENCODER || ENABLE_VCP_VTB_ENCODER
    622   int usageValue = 1;
    623   auto usage = CFNumberCreate(nullptr, kCFNumberIntType, &usageValue);
    624   CFDictionarySetValue(encoderSpecs, kVTCompressionPropertyKey_Usage, usage);
    625   CFRelease(usage);
     647#if ENABLE_VCP_ENCODER
     648  if (_useVCP) {
     649    int usageValue = 1;
     650    auto usage = CFNumberCreate(nullptr, kCFNumberIntType, &usageValue);
     651    CFDictionarySetValue(encoderSpecs, kVTCompressionPropertyKey_Usage, usage);
     652    CFRelease(usage);
     653  }
    626654#endif
    627655#if ENABLE_VCP_VTB_ENCODER
     656  if (_useVCP) {
    628657    CFDictionarySetValue(encoderSpecs, kVTVideoEncoderList_EncoderID, CFSTR("com.apple.videotoolbox.videoencoder.h264.rtvc"));
     658  }
    629659#endif
    630660  OSStatus status =
    631       CompressionSessionCreate(nullptr,  // use default allocator
     661      VTCompressionSessionCreate(nullptr,  // use default allocator
    632662                                 _width,
    633663                                 _height,
    634                                  kCodecTypeH264,
     664                                 kCMVideoCodecType_H264,
    635665                                 encoderSpecs,  // use hardware accelerated encoder if available
    636666                                 sourceAttributes,
     
    638668                                 compressionOutputCallback,
    639669                                 nullptr,
    640                                  &_compressionSession);
    641   if (sourceAttributes) {
    642     CFRelease(sourceAttributes);
    643     sourceAttributes = nullptr;
    644   }
    645   if (encoderSpecs) {
    646     CFRelease(encoderSpecs);
    647     encoderSpecs = nullptr;
    648   }
    649 
    650 #if ENABLE_VCP_ENCODER || defined(WEBRTC_IOS)
    651   if (status != noErr) {
    652     RTC_LOG(LS_ERROR) << "Failed to create compression session: " << status;
    653     return WEBRTC_VIDEO_CODEC_ERROR;
    654   }
    655 #endif
     670                                 &_vtCompressionSession);
     671
    656672#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
    657   CFBooleanRef hwaccl_enabled = nullptr;
    658   if (status == noErr) {
    659     status = VTSessionCopyProperty(_compressionSession,
     673#if ENABLE_VCP_ENCODER
     674  if (!_useVCP) {
     675    CFBooleanRef hwaccl_enabled = nullptr;
     676    if (status == noErr) {
     677      status = VTSessionCopyProperty(_vtCompressionSession,
    660678                                 kVTCompressionPropertyKey_UsingHardwareAcceleratedVideoEncoder,
    661679                                 nullptr,
    662680                                 &hwaccl_enabled);
    663   }
    664   if (status == noErr && (CFBooleanGetValue(hwaccl_enabled))) {
    665     RTC_LOG(LS_INFO) << "Compression session created with hw accl enabled";
    666   } else {
    667     RTC_LOG(LS_INFO) << "Compression session created with hw accl disabled";
    668 
    669 #if !ENABLE_VCP_ENCODER && !ENABLE_VCP_VTB_ENCODER && !defined(WEBRTC_IOS)
     681    }
     682    if (status == noErr && (CFBooleanGetValue(hwaccl_enabled))) {
     683      RTC_LOG(LS_INFO) << "Compression session created with hw accl enabled";
     684    } else {
     685      [self destroyCompressionSession];
     686
     687      // Use VCP instead.
     688      int usageValue = 1;
     689      auto usage = CFNumberCreate(nullptr, kCFNumberIntType, &usageValue);
     690      CFDictionarySetValue(encoderSpecs, kVTCompressionPropertyKey_Usage, usage);
     691      CFRelease(usage);
     692
     693      RTC_LOG(LS_INFO) << "Compression session created with VCP";
     694      status =
     695          webrtc::VCPCompressionSessionCreate(nullptr,  // use default allocator
     696                                 _width,
     697                                 _height,
     698                                 kVCPCodecType4CC_H264,
     699                                 encoderSpecs,
     700                                 sourceAttributes,
     701                                 nullptr,  // use default compressed data allocator
     702                                 compressionOutputCallback,
     703                                 nullptr,
     704                                 &_vcpCompressionSession);
     705    }
     706  }
     707#else
     708  if (status != noErr) {
     709    if (encoderSpecs) {
     710        CFRelease(encoderSpecs);
     711        encoderSpecs = nullptr;
     712    }
     713    if (sourceAttributes) {
     714      CFRelease(sourceAttributes);
     715      sourceAttributes = nullptr;
     716    }
     717
    670718    if (!isStandardFrameSize(_width, _height)) {
    671719      _disableEncoding = true;
     
    673721      return WEBRTC_VIDEO_CODEC_ERROR;
    674722    }
     723    [self destroyCompressionSession];
    675724
    676725    CFDictionaryRef ioSurfaceValue = CreateCFTypeDictionary(nullptr, nullptr, 0);
     
    688737      ioSurfaceValue,
    689738      pixelFormat};
    690     CFDictionaryRef sourceAttributes = CreateCFTypeDictionary(keys, values, attributesSize);
     739    sourceAttributes = CreateCFTypeDictionary(keys, values, attributesSize);
    691740
    692741    if (ioSurfaceValue) {
     
    699748    }
    700749
    701     CFMutableDictionaryRef encoderSpecs = CFDictionaryCreateMutable(nullptr, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
     750    encoderSpecs = CFDictionaryCreateMutable(nullptr, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
    702751    CFDictionarySetValue(encoderSpecs, kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder, kCFBooleanFalse);
    703752    int usageValue = 1;
    704753    CFNumberRef usage = CFNumberCreate(nullptr, kCFNumberIntType, &usageValue);
    705754    CFDictionarySetValue(encoderSpecs, kVTVideoEncoderSpecification_Usage, usage);
    706 
    707755    if (usage) {
    708756      CFRelease(usage);
    709757      usage = nullptr;
    710758    }
    711 
    712     [self destroyCompressionSession];
    713 
    714     OSStatus status =
    715       CompressionSessionCreate(nullptr,  // use default allocator
     759    status = VTCompressionSessionCreate(nullptr,  // use default allocator
    716760                                 _width,
    717761                                 _height,
    718                                  kCodecTypeH264,
    719                                  encoderSpecs,
     762                                 kCMVideoCodecType_H264,
     763                                 encoderSpecs,  // use hardware accelerated encoder if available
    720764                                 sourceAttributes,
    721765                                 nullptr,  // use default compressed data allocator
    722766                                 compressionOutputCallback,
    723767                                 nullptr,
    724                                  &_compressionSession);
    725     if (sourceAttributes) {
    726       CFRelease(sourceAttributes);
    727       sourceAttributes = nullptr;
    728     }
    729     if (encoderSpecs) {
    730       CFRelease(encoderSpecs);
    731       encoderSpecs = nullptr;
    732     }
    733     if (status != noErr) {
    734       return WEBRTC_VIDEO_CODEC_ERROR;
    735     }
    736 #endif
    737   }
    738 #endif
     768                                 &_vtCompressionSession);
     769
     770  }
     771#endif // ENABLE_VCP_ENCODER
     772#endif // defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
     773  if (sourceAttributes) {
     774    CFRelease(sourceAttributes);
     775    sourceAttributes = nullptr;
     776  }
     777  if (encoderSpecs) {
     778    CFRelease(encoderSpecs);
     779    encoderSpecs = nullptr;
     780  }
     781
     782  if (status != noErr) {
     783    RTC_LOG(LS_ERROR) << "Failed to create compression session: " << status;
     784    return WEBRTC_VIDEO_CODEC_ERROR;
     785  }
     786
    739787  [self configureCompressionSession];
    740788
     
    742790  // The pixel buffer pool is dependent on the compression session so if the session is reset, the
    743791  // pool should be reset as well.
    744   _pixelBufferPool = CompressionSessionGetPixelBufferPool(_compressionSession);
     792  if (_vtCompressionSession)
     793    _pixelBufferPool = VTCompressionSessionGetPixelBufferPool(_vtCompressionSession);
     794#if ENABLE_VCP_ENCODER
     795  else
     796    _pixelBufferPool = webrtc::VCPCompressionSessionGetPixelBufferPool(_vtCompressionSession);
     797#endif
    745798#endif
    746799  return WEBRTC_VIDEO_CODEC_OK;
     
    748801
    749802- (void)configureCompressionSession {
    750   RTC_DCHECK(_compressionSession);
    751   SetVTSessionProperty(_compressionSession, kVTCompressionPropertyKey_RealTime, true);
    752   SetVTSessionProperty(_compressionSession, kVTCompressionPropertyKey_ProfileLevel, _profile);
    753   SetVTSessionProperty(_compressionSession, kVTCompressionPropertyKey_AllowFrameReordering, false);
     803  RTC_DCHECK([self hasCompressionSession]);
     804  SetVTSessionProperty(_vtCompressionSession, _vcpCompressionSession, kVTCompressionPropertyKey_RealTime, true);
     805  SetVTSessionProperty(_vtCompressionSession, _vcpCompressionSession, kVTCompressionPropertyKey_ProfileLevel, _profile);
     806  SetVTSessionProperty(_vtCompressionSession, _vcpCompressionSession, kVTCompressionPropertyKey_AllowFrameReordering, false);
    754807#if ENABLE_VCP_ENCODER
    755   SetVTSessionProperty(_compressionSession, kVTCompressionPropertyKey_Usage, 1);
     808  if (_useVCP) {
     809    SetVTSessionProperty(_vtCompressionSession, _vcpCompressionSession, kVTCompressionPropertyKey_Usage, 1);
     810  }
    756811#endif
    757812  [self setEncoderBitrateBps:_targetBitrateBps];
     
    765820
    766821  // Set a relatively large value for keyframe emission (7200 frames or 4 minutes).
    767   SetVTSessionProperty(_compressionSession, kVTCompressionPropertyKey_MaxKeyFrameInterval, 7200);
    768   SetVTSessionProperty(
    769       _compressionSession, kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration, 240);
     822  SetVTSessionProperty(_vtCompressionSession, _vcpCompressionSession, kVTCompressionPropertyKey_MaxKeyFrameInterval, 7200);
     823  SetVTSessionProperty(_vtCompressionSession, _vcpCompressionSession, kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration, 240);
    770824}
    771825
    772826- (void)destroyCompressionSession {
    773   if (_compressionSession) {
    774     CompressionSessionInvalidate(_compressionSession);
    775     CFRelease(_compressionSession);
    776     _compressionSession = nullptr;
    777     _pixelBufferPool = nullptr;
    778   }
     827  if (_vtCompressionSession) {
     828    VTCompressionSessionInvalidate(_vtCompressionSession);
     829    CFRelease(_vtCompressionSession);
     830    _vtCompressionSession = nullptr;
     831  }
     832#if ENABLE_VCP_ENCODER
     833  if (_vcpCompressionSession) {
     834    webrtc::VCPCompressionSessionInvalidate(_vcpCompressionSession);
     835    CFRelease(_vcpCompressionSession);
     836    _vcpCompressionSession = nullptr;
     837  }
     838#endif
     839  _pixelBufferPool = nullptr;
    779840}
    780841
     
    790851
    791852- (void)setEncoderBitrateBps:(uint32_t)bitrateBps {
    792   if (_compressionSession) {
    793     SetVTSessionProperty(_compressionSession, kVTCompressionPropertyKey_AverageBitRate, bitrateBps);
     853  if ([self hasCompressionSession]) {
     854    SetVTSessionProperty(_vtCompressionSession, _vcpCompressionSession, kVTCompressionPropertyKey_AverageBitRate, bitrateBps);
    794855
    795856    // TODO(tkchin): Add a helper method to set array value.
     
    803864    const void *nums[2] = {bytesPerSecond, oneSecond};
    804865    CFArrayRef dataRateLimits = CFArrayCreate(nullptr, nums, 2, &kCFTypeArrayCallBacks);
    805     OSStatus status = CompressionSessionSetProperty(
    806         _compressionSession, kVTCompressionPropertyKey_DataRateLimits, dataRateLimits);
     866
     867    OSStatus status = noErr;
     868    if (_vtCompressionSession)
     869      VTSessionSetProperty(_vtCompressionSession, kVTCompressionPropertyKey_DataRateLimits, dataRateLimits);
     870#if ENABLE_VCP_ENCODER
     871    else
     872      webrtc::VCPCompressionSessionSetProperty(_vcpCompressionSession, kVTCompressionPropertyKey_DataRateLimits, dataRateLimits);
     873#endif
     874    if (status != noErr) {
     875      RTC_LOG(LS_ERROR) << "VTSessionSetProperty failed to set: " << kVTCompressionPropertyKey_DataRateLimits
     876        << ": " << status;
     877    }
     878
    807879    if (bytesPerSecond) {
    808880      CFRelease(bytesPerSecond);
     
    814886      CFRelease(dataRateLimits);
    815887    }
    816     if (status != noErr) {
    817       RTC_LOG(LS_ERROR) << "Failed to set data rate limit";
    818     }
    819 
    820888    _encoderBitrateBps = bitrateBps;
    821889  }
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/helpers.cc

    r237075 r246263  
    3636
    3737// Convenience function for setting a VT property.
    38 void SetVTSessionProperty(CompressionSessionRef session,
     38void SetVTSessionProperty(VTCompressionSessionRef vtSession, VCPCompressionSessionRef vcpSession,
    3939                          CFStringRef key,
    4040                          int32_t value) {
     41  RTC_DCHECK(vtSession || vcpSession);
    4142  CFNumberRef cfNum =
    4243      CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value);
    43   OSStatus status = CompressionSessionSetProperty(session, key, cfNum);
     44  OSStatus status = noErr;
     45  if (vtSession)
     46    status = VTSessionSetProperty(vtSession, key, cfNum);
     47#if ENABLE_VCP_ENCODER
     48  else
     49    status = webrtc::VCPCompressionSessionSetProperty(vcpSession, key, cfNum);
     50#endif
    4451  CFRelease(cfNum);
    4552  if (status != noErr) {
     
    5158
    5259// Convenience function for setting a VT property.
    53 void SetVTSessionProperty(CompressionSessionRef session,
     60void SetVTSessionProperty(VTCompressionSessionRef vtSession, VCPCompressionSessionRef vcpSession,
    5461                          CFStringRef key,
    5562                          uint32_t value) {
     63  RTC_DCHECK(vtSession || vcpSession);
    5664  int64_t value_64 = value;
    5765  CFNumberRef cfNum =
    5866      CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &value_64);
    59   OSStatus status = CompressionSessionSetProperty(session, key, cfNum);
     67  OSStatus status = noErr;
     68  if (vtSession)
     69    status = VTSessionSetProperty(vtSession, key, cfNum);
     70#if ENABLE_VCP_ENCODER
     71  else
     72    status = webrtc::VCPCompressionSessionSetProperty(vcpSession, key, cfNum);
     73#endif
    6074  CFRelease(cfNum);
    6175  if (status != noErr) {
     
    6781
    6882// Convenience function for setting a VT property.
    69 void SetVTSessionProperty(CompressionSessionRef session, CFStringRef key, bool value) {
     83void SetVTSessionProperty(VTCompressionSessionRef vtSession, VCPCompressionSessionRef vcpSession, CFStringRef key, bool value) {
     84  RTC_DCHECK(vtSession || vcpSession);
    7085  CFBooleanRef cf_bool = (value) ? kCFBooleanTrue : kCFBooleanFalse;
    71   OSStatus status = CompressionSessionSetProperty(session, key, cf_bool);
     86  OSStatus status = noErr;
     87  if (vtSession)
     88    status = VTSessionSetProperty(vtSession, key, cf_bool);
     89#if ENABLE_VCP_ENCODER
     90  else
     91    status = webrtc::VCPCompressionSessionSetProperty(vcpSession, key, cf_bool);
     92#endif
    7293  if (status != noErr) {
    7394    std::string key_string = CFStringToString(key);
     
    7899
    79100// Convenience function for setting a VT property.
    80 void SetVTSessionProperty(CompressionSessionRef session,
     101void SetVTSessionProperty(VTCompressionSessionRef vtSession, VCPCompressionSessionRef vcpSession,
    81102                          CFStringRef key,
    82103                          CFStringRef value) {
    83   OSStatus status = CompressionSessionSetProperty(session, key, value);
     104  RTC_DCHECK(vtSession || vcpSession);
     105  OSStatus status = noErr;
     106  if (vtSession)
     107    status = VTSessionSetProperty(vtSession, key, value);
     108#if ENABLE_VCP_ENCODER
     109  else
     110    status = webrtc::VCPCompressionSessionSetProperty(vcpSession, key, value);
     111#endif
    84112  if (status != noErr) {
    85113    std::string key_string = CFStringToString(key);
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/helpers.h

    r237075 r246263  
    1717#include <string>
    1818
    19 #include "sdk/WebKit/EncoderUtilities.h"
     19#include "sdk/WebKit/VideoProcessingSoftLink.h"
    2020
    2121// Convenience function for creating a dictionary.
     
    3232
    3333// Convenience function for setting a VT property.
    34 void SetVTSessionProperty(CompressionSessionRef session, CFStringRef key, int32_t value);
     34void SetVTSessionProperty(VTCompressionSessionRef session, VCPCompressionSessionRef vcpSession,CFStringRef key, int32_t value);
    3535
    3636// Convenience function for setting a VT property.
    37 void SetVTSessionProperty(CompressionSessionRef session,
     37void SetVTSessionProperty(VTCompressionSessionRef session, VCPCompressionSessionRef vcpSession,
    3838                          CFStringRef key,
    3939                          uint32_t value);
    4040
    4141// Convenience function for setting a VT property.
    42 void SetVTSessionProperty(CompressionSessionRef session, CFStringRef key, bool value);
     42void SetVTSessionProperty(VTCompressionSessionRef session, VCPCompressionSessionRef vcpSession, CFStringRef key, bool value);
    4343
    4444// Convenience function for setting a VT property.
    45 void SetVTSessionProperty(CompressionSessionRef session,
     45void SetVTSessionProperty(VTCompressionSessionRef session, VCPCompressionSessionRef vcpSession,
    4646                          CFStringRef key,
    4747                          CFStringRef value);
Note: See TracChangeset for help on using the changeset viewer.