Changeset 268971 in webkit


Ignore:
Timestamp:
Oct 26, 2020 5:50:41 AM (21 months ago)
Author:
youenn@apple.com
Message:

Add support for VP9 Profile 2 (10-bit color) in WebRTC
https://bugs.webkit.org/show_bug.cgi?id=217673
<rdar://problem/70283885>

Reviewed by Eric Carlson.

Source/ThirdParty/libwebrtc:

Add support for VP9 profile 0 and 2.
This requires correctly handling 10-bit decoded buffers as is done by the MSE code path.

  • Configurations/libwebrtc.iOS.exp:
  • Configurations/libwebrtc.iOSsim.exp:
  • Configurations/libwebrtc.mac.exp:
  • Source/webrtc/sdk/WebKit/WebKitUtilities.h:
  • Source/webrtc/sdk/WebKit/WebKitUtilities.mm:

(webrtc::pixelBufferFromFrame):

  • Source/webrtc/sdk/WebKit/WebKitVP9Decoder.cpp:

(webrtc::WebKitVP9DecoderReceiver::Decoded):

  • Source/webrtc/sdk/objc/api/video_codec/RTCVideoEncoderVP9.h:
  • Source/webrtc/sdk/objc/api/video_codec/RTCVideoEncoderVP9.mm:

(+[RTCVideoEncoderVP9 vp9Encoder:]):

  • Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m:

(-[RTCDefaultVideoDecoderFactory supportedCodecs]):

  • Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m:

(+[RTCDefaultVideoEncoderFactory supportedCodecsWithH265:vp9:]):
(-[RTCDefaultVideoEncoderFactory createEncoder:]):

Source/WebCore:

In case software VP9 decoded buffer is 10 bits, we use kCVPixelFormatType_420YpCbCr10BiPlanarFullRange.

Test: webrtc/vp9-profile2.html

  • platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h:
  • platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:

(WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferPool):
(WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):

  • platform/mediastream/mac/RealtimeVideoUtilities.h:
  • platform/mediastream/mac/RealtimeVideoUtilities.mm:

(WebCore::createPixelBufferPool):

Source/WebKit:

  • WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:

(WebKit::LibWebRTCCodecs::pixelBufferPool):

LayoutTests:

  • webrtc/vp9-profile2-expected.txt: Added.
  • webrtc/vp9-profile2.html: Added.
Location:
trunk
Files:
2 added
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r268969 r268971  
     12020-10-26  Youenn Fablet  <youenn@apple.com>
     2
     3        Add support for VP9 Profile 2 (10-bit color) in WebRTC
     4        https://bugs.webkit.org/show_bug.cgi?id=217673
     5        <rdar://problem/70283885>
     6
     7        Reviewed by Eric Carlson.
     8
     9        * webrtc/vp9-profile2-expected.txt: Added.
     10        * webrtc/vp9-profile2.html: Added.
     11
    1122020-10-26  Philippe Normand  <pnormand@igalia.com>
    213
  • trunk/Source/ThirdParty/libwebrtc/ChangeLog

    r268952 r268971  
     12020-10-26  Youenn Fablet  <youenn@apple.com>
     2
     3        Add support for VP9 Profile 2 (10-bit color) in WebRTC
     4        https://bugs.webkit.org/show_bug.cgi?id=217673
     5        <rdar://problem/70283885>
     6
     7        Reviewed by Eric Carlson.
     8
     9        Add support for VP9 profile 0 and 2.
     10        This requires correctly handling 10-bit decoded buffers as is done by the MSE code path.
     11
     12        * Configurations/libwebrtc.iOS.exp:
     13        * Configurations/libwebrtc.iOSsim.exp:
     14        * Configurations/libwebrtc.mac.exp:
     15        * Source/webrtc/sdk/WebKit/WebKitUtilities.h:
     16        * Source/webrtc/sdk/WebKit/WebKitUtilities.mm:
     17        (webrtc::pixelBufferFromFrame):
     18        * Source/webrtc/sdk/WebKit/WebKitVP9Decoder.cpp:
     19        (webrtc::WebKitVP9DecoderReceiver::Decoded):
     20        * Source/webrtc/sdk/objc/api/video_codec/RTCVideoEncoderVP9.h:
     21        * Source/webrtc/sdk/objc/api/video_codec/RTCVideoEncoderVP9.mm:
     22        (+[RTCVideoEncoderVP9 vp9Encoder:]):
     23        * Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m:
     24        (-[RTCDefaultVideoDecoderFactory supportedCodecs]):
     25        * Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m:
     26        (+[RTCDefaultVideoEncoderFactory supportedCodecsWithH265:vp9:]):
     27        (-[RTCDefaultVideoEncoderFactory createEncoder:]):
     28
    1292020-10-24  Jer Noble  <jer.noble@apple.com>
    230
  • trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp

    r268805 r268971  
    110110__ZN6webrtc31setH264LowLatencyEncoderEnabledEb
    111111__ZN6webrtc24registerWebKitVP9DecoderEv
    112 __ZN6webrtc20pixelBufferFromFrameERKNS_10VideoFrameERKNSt3__18functionIFP10__CVBuffermmEEE
     112__ZN6webrtc20pixelBufferFromFrameERKNS_10VideoFrameERKNSt3__18functionIFP10__CVBuffermmNS_10BufferTypeEEEE
    113113__ZN6webrtc18pixelBufferToFrameEP10__CVBuffer
    114114__ZN3rtc24BasicPacketSocketFactory19CreateAsyncResolverEv
  • trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp

    r268805 r268971  
    110110__ZN6webrtc31setH264LowLatencyEncoderEnabledEb
    111111__ZN6webrtc24registerWebKitVP9DecoderEv
    112 __ZN6webrtc20pixelBufferFromFrameERKNS_10VideoFrameERKNSt3__18functionIFP10__CVBuffermmEEE
     112__ZN6webrtc20pixelBufferFromFrameERKNS_10VideoFrameERKNSt3__18functionIFP10__CVBuffermmNS_10BufferTypeEEEE
    113113__ZN6webrtc18pixelBufferToFrameEP10__CVBuffer
    114114__ZN3rtc24BasicPacketSocketFactory19CreateAsyncResolverEv
  • trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp

    r268805 r268971  
    110110__ZN6webrtc31setH264LowLatencyEncoderEnabledEb
    111111__ZN6webrtc24registerWebKitVP9DecoderEv
    112 __ZN6webrtc20pixelBufferFromFrameERKNS_10VideoFrameERKNSt3__18functionIFP10__CVBuffermmEEE
     112__ZN6webrtc20pixelBufferFromFrameERKNS_10VideoFrameERKNSt3__18functionIFP10__CVBuffermmNS_10BufferTypeEEEE
    113113__ZN6webrtc18pixelBufferToFrameEP10__CVBuffer
    114114__ZN3rtc24BasicPacketSocketFactory19CreateAsyncResolverEv
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.h

    r268805 r268971  
    5656bool isH264LowLatencyEncoderEnabled();
    5757
    58 CVPixelBufferRef pixelBufferFromFrame(const VideoFrame&, const std::function<CVPixelBufferRef(size_t, size_t)>&);
     58enum class BufferType { I420, I010 };
     59CVPixelBufferRef pixelBufferFromFrame(const VideoFrame&, const std::function<CVPixelBufferRef(size_t, size_t, BufferType)>&);
    5960rtc::scoped_refptr<webrtc::VideoFrameBuffer> pixelBufferToFrame(CVPixelBufferRef);
    6061
    61 CVPixelBufferPoolRef createPixelBufferPool(size_t width, size_t height);
    62 
    6362}
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.mm

    r268288 r268971  
    2727
    2828#include "native/src/objc_frame_buffer.h"
     29#include "rtc_base/logging.h"
    2930#include "third_party/libyuv/include/libyuv/convert_from.h"
    3031#include "libyuv/cpu_id.h"
     
    198199}
    199200
    200 CVPixelBufferRef pixelBufferFromFrame(const VideoFrame& frame, const std::function<CVPixelBufferRef(size_t, size_t)>& makePixelBuffer)
    201 {
    202     if (frame.video_frame_buffer()->type() != VideoFrameBuffer::Type::kNative) {
    203         auto pixelBuffer = makePixelBuffer(frame.video_frame_buffer()->width(), frame.video_frame_buffer()->height());
    204         if (!pixelBuffer)
     201CVPixelBufferRef pixelBufferFromFrame(const VideoFrame& frame, const std::function<CVPixelBufferRef(size_t, size_t, BufferType)>& makePixelBuffer)
     202{
     203    auto buffer = frame.video_frame_buffer();
     204    if (buffer->type() != VideoFrameBuffer::Type::kNative) {
     205        auto type = buffer->type();
     206        if (type != VideoFrameBuffer::Type::kI420 && type != VideoFrameBuffer::Type::kI010) {
     207            RTC_LOG(WARNING) << "Video frame buffer type is not expected.";
    205208            return nullptr;
    206 
    207         if (frame.video_frame_buffer()->type() == VideoFrameBuffer::Type::kI420)
    208             CopyVideoFrameToPixelBuffer(frame.video_frame_buffer()->GetI420(), pixelBuffer);
    209         else if (frame.video_frame_buffer()->type() == VideoFrameBuffer::Type::kI010)
    210             CopyVideoFrameToPixelBuffer(frame.video_frame_buffer()->GetI010(), pixelBuffer);
     209        }
     210
     211        auto pixelBuffer = makePixelBuffer(buffer->width(), buffer->height(), type == VideoFrameBuffer::Type::kI420 ? BufferType::I420 : BufferType::I010);
     212        if (!pixelBuffer) {
     213            RTC_LOG(WARNING) << "Pixel buffer creation failed.";
     214            return nullptr;
     215        }
     216
     217        if (type == VideoFrameBuffer::Type::kI420)
     218            CopyVideoFrameToPixelBuffer(buffer->GetI420(), pixelBuffer);
     219        else
     220            CopyVideoFrameToPixelBuffer(buffer->GetI010(), pixelBuffer);
    211221        return pixelBuffer;
    212222    }
    213223
    214     auto *frameBuffer = static_cast<ObjCFrameBuffer*>(frame.video_frame_buffer().get())->wrapped_frame_buffer();
     224    auto *frameBuffer = static_cast<ObjCFrameBuffer*>(buffer.get())->wrapped_frame_buffer();
    215225    if (![frameBuffer isKindOfClass:[RTCCVPixelBuffer class]])
    216226        return nullptr;
     
    220230}
    221231
    222 CVPixelBufferPoolRef createPixelBufferPool(size_t width, size_t height)
    223 {
    224     const OSType videoCaptureFormat = kCVPixelFormatType_420YpCbCr8BiPlanarFullRange;
    225     auto pixelAttributes = @{
    226         (__bridge NSString *)kCVPixelBufferWidthKey: @(width),
    227         (__bridge NSString *)kCVPixelBufferHeightKey: @(height),
    228         (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(videoCaptureFormat),
    229         (__bridge NSString *)kCVPixelBufferCGImageCompatibilityKey: @NO,
    230 #if defined(WEBRTC_IOS)
    231         (__bridge NSString *)kCVPixelFormatOpenGLESCompatibility : @YES,
    232 #else
    233         (__bridge NSString *)kCVPixelBufferOpenGLCompatibilityKey : @YES,
    234 #endif
    235         (__bridge NSString *)kCVPixelBufferIOSurfacePropertiesKey : @{ }
    236     };
    237 
    238     CVPixelBufferPoolRef pool = nullptr;
    239     auto status = CVPixelBufferPoolCreate(kCFAllocatorDefault, nullptr, (__bridge CFDictionaryRef)pixelAttributes, &pool);
    240 
    241     if (status != kCVReturnSuccess)
    242         return nullptr;
    243 
    244     return pool;
    245 }
    246 
    247 }
     232}
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitVP9Decoder.cpp

    r268805 r268971  
    363363int32_t WebKitVP9DecoderReceiver::Decoded(VideoFrame& frame)
    364364{
    365     auto pixelBuffer = pixelBufferFromFrame(frame, [this](size_t width, size_t height) -> CVPixelBufferRef {
     365    auto pixelBuffer = pixelBufferFromFrame(frame, [this](size_t width, size_t height, BufferType) -> CVPixelBufferRef {
    366366        CVPixelBufferRef pixelBuffer = nullptr;
    367367        if (CVPixelBufferPoolCreatePixelBuffer(kCFAllocatorDefault, m_pixelBufferPool, &pixelBuffer) == kCVReturnSuccess)
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/api/video_codec/RTCVideoEncoderVP9.h

    r263734 r268971  
    1212
    1313#import "RTCMacros.h"
     14#import "RTCVideoCodecInfo.h"
    1415#import "RTCVideoEncoder.h"
    1516
     
    2223 * used independently from the RTCPeerConnectionFactory.
    2324 */
    24 + (id<RTCVideoEncoder>)vp9Encoder;
     25+ (id<RTCVideoEncoder>)vp9Encoder:(RTCVideoCodecInfo *)codecInfo;
    2526
    2627@end
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/api/video_codec/RTCVideoEncoderVP9.mm

    r237075 r268971  
    1616
    1717#include "modules/video_coding/codecs/vp9/include/vp9.h"
     18#include "sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.h"
    1819
    1920@implementation RTCVideoEncoderVP9
    2021
    21 + (id<RTCVideoEncoder>)vp9Encoder {
     22+ (id<RTCVideoEncoder>)vp9Encoder:(RTCVideoCodecInfo *)codecInfo {
    2223  return [[RTCWrappedNativeVideoEncoder alloc]
    23       initWithNativeEncoder:std::unique_ptr<webrtc::VideoEncoder>(webrtc::VP9Encoder::Create())];
     24      initWithNativeEncoder:std::unique_ptr<webrtc::VideoEncoder>(webrtc::VP9Encoder::Create(cricket::VideoCodec(codecInfo.nativeSdpVideoFormat)))];
    2425}
    2526
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m

    r268805 r268971  
    8080#if defined(RTC_ENABLE_VP9)
    8181  if (_supportsVP9) {
    82     RTCVideoCodecInfo *vp9Info = [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name];
    83     [codecs addObject:vp9Info];
     82    [codecs addObject:[[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name parameters: @{
     83      @"profile-id" : @"0",
     84    }]];
     85
     86    [codecs addObject:[[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name parameters: @{
     87      @"profile-id" : @"2",
     88    }]];
    8489  }
    8590#endif
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m

    r263734 r268971  
    7878#if defined(RTC_ENABLE_VP9)
    7979  if (supportsVP9) {
    80     RTCVideoCodecInfo *vp9Info = [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name];
    81     [codecs addObject:vp9Info];
     80    [codecs addObject:[[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name parameters: @{
     81      @"profile-id" : @"0",
     82    }]];
     83
     84    [codecs addObject:[[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name parameters: @{
     85      @"profile-id" : @"2",
     86    }]];
    8287  }
    8388#endif
     
    9398#if defined(RTC_ENABLE_VP9)
    9499  } else if ([info.name isEqualToString:kRTCVideoCodecVp9Name]) {
    95     return [RTCVideoEncoderVP9 vp9Encoder];
     100    return [RTCVideoEncoderVP9 vp9Encoder:info];
    96101#endif
    97102#if !defined(DISABLE_H265)
  • trunk/Source/WebCore/ChangeLog

    r268970 r268971  
     12020-10-26  Youenn Fablet  <youenn@apple.com>
     2
     3        Add support for VP9 Profile 2 (10-bit color) in WebRTC
     4        https://bugs.webkit.org/show_bug.cgi?id=217673
     5        <rdar://problem/70283885>
     6
     7        Reviewed by Eric Carlson.
     8
     9        In case software VP9 decoded buffer is 10 bits, we use kCVPixelFormatType_420YpCbCr10BiPlanarFullRange.
     10
     11        Test: webrtc/vp9-profile2.html
     12
     13        * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h:
     14        * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
     15        (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferPool):
     16        (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
     17        * platform/mediastream/mac/RealtimeVideoUtilities.h:
     18        * platform/mediastream/mac/RealtimeVideoUtilities.mm:
     19        (WebCore::createPixelBufferPool):
     20
    1212020-10-26  Youenn Fablet  <youenn@apple.com>
    222
  • trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h

    r261908 r268971  
    3636using CVPixelBufferRef = struct __CVBuffer*;
    3737
     38namespace webrtc {
     39enum class BufferType;
     40};
     41
    3842namespace WebCore {
    3943
     
    4549    RealtimeIncomingVideoSourceCocoa(rtc::scoped_refptr<webrtc::VideoTrackInterface>&&, String&&);
    4650    RetainPtr<CVPixelBufferRef> pixelBufferFromVideoFrame(const webrtc::VideoFrame&);
    47     CVPixelBufferPoolRef pixelBufferPool(size_t width, size_t height);
     51    CVPixelBufferPoolRef pixelBufferPool(size_t width, size_t height, webrtc::BufferType);
    4852
    4953    // rtc::VideoSinkInterface
     
    5963    size_t m_pixelBufferPoolWidth { 0 };
    6064    size_t m_pixelBufferPoolHeight { 0 };
     65    webrtc::BufferType m_pixelBufferPoolBufferType;
    6166};
    6267
  • trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm

    r262238 r268971  
    8989}
    9090
    91 CVPixelBufferPoolRef RealtimeIncomingVideoSourceCocoa::pixelBufferPool(size_t width, size_t height)
    92 {
    93     if (!m_pixelBufferPool || m_pixelBufferPoolWidth != width || m_pixelBufferPoolHeight != height) {
    94         m_pixelBufferPool = createPixelBufferPool(width, height);
     91CVPixelBufferPoolRef RealtimeIncomingVideoSourceCocoa::pixelBufferPool(size_t width, size_t height, webrtc::BufferType bufferType)
     92{
     93    if (!m_pixelBufferPool || m_pixelBufferPoolWidth != width || m_pixelBufferPoolHeight != height || m_pixelBufferPoolBufferType != bufferType) {
     94        OSType poolBufferType;
     95        switch (bufferType) {
     96        case webrtc::BufferType::I420:
     97            poolBufferType = kCVPixelFormatType_420YpCbCr8BiPlanarFullRange;
     98            break;
     99        case webrtc::BufferType::I010:
     100            poolBufferType = kCVPixelFormatType_420YpCbCr10BiPlanarFullRange;
     101        }
     102        m_pixelBufferPool = createPixelBufferPool(width, height, poolBufferType);
    95103        m_pixelBufferPoolWidth = width;
    96104        m_pixelBufferPoolHeight = height;
     105        m_pixelBufferPoolBufferType = bufferType;
    97106    }
    98107    return m_pixelBufferPool.get();
     
    111120
    112121    RetainPtr<CVPixelBufferRef> newPixelBuffer;
    113     return webrtc::pixelBufferFromFrame(frame, [this, &newPixelBuffer](size_t width, size_t height) -> CVPixelBufferRef {
    114         auto pixelBufferPool = this->pixelBufferPool(width, height);
     122    return webrtc::pixelBufferFromFrame(frame, [this, &newPixelBuffer](size_t width, size_t height, webrtc::BufferType bufferType) -> CVPixelBufferRef {
     123        auto pixelBufferPool = this->pixelBufferPool(width, height, bufferType);
    115124        if (!pixelBufferPool)
    116125            return nullptr;
  • trunk/Source/WebCore/platform/mediastream/mac/RealtimeVideoUtilities.h

    r254050 r268971  
    4242}
    4343
    44 WEBCORE_EXPORT RetainPtr<CVPixelBufferPoolRef> createPixelBufferPool(size_t width, size_t height);
     44WEBCORE_EXPORT RetainPtr<CVPixelBufferPoolRef> createPixelBufferPool(size_t width, size_t height, OSType);
    4545WEBCORE_EXPORT RetainPtr<CVPixelBufferRef> createPixelBufferFromPool(CVPixelBufferPoolRef);
    4646
  • trunk/Source/WebCore/platform/mediastream/mac/RealtimeVideoUtilities.mm

    r260366 r268971  
    3131namespace WebCore {
    3232
    33 RetainPtr<CVPixelBufferPoolRef> createPixelBufferPool(size_t width, size_t height)
     33RetainPtr<CVPixelBufferPoolRef> createPixelBufferPool(size_t width, size_t height, OSType videoCaptureFormat)
    3434{
    35     const OSType videoCaptureFormat = kCVPixelFormatType_420YpCbCr8BiPlanarFullRange;
    3635    auto pixelAttributes = @{
    3736        (__bridge NSString *)kCVPixelBufferWidthKey: @(width),
  • trunk/Source/WebKit/ChangeLog

    r268965 r268971  
     12020-10-26  Youenn Fablet  <youenn@apple.com>
     2
     3        Add support for VP9 Profile 2 (10-bit color) in WebRTC
     4        https://bugs.webkit.org/show_bug.cgi?id=217673
     5        <rdar://problem/70283885>
     6
     7        Reviewed by Eric Carlson.
     8
     9        * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
     10        (WebKit::LibWebRTCCodecs::pixelBufferPool):
     11
    1122020-10-26  Zan Dobersek  <zdobersek@igalia.com>
    213
  • trunk/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp

    r268612 r268971  
    114114{
    115115    RetainPtr<CVPixelBufferRef> newPixelBuffer;
    116     auto pixelBuffer = webrtc::pixelBufferFromFrame(frame, [&newPixelBuffer](size_t width, size_t height) -> CVPixelBufferRef {
    117         auto pixelBufferPool = WebProcess::singleton().libWebRTCCodecs().pixelBufferPool(width, height);
     116    auto pixelBuffer = webrtc::pixelBufferFromFrame(frame, [&newPixelBuffer](size_t width, size_t height, webrtc::BufferType bufferType) -> CVPixelBufferRef {
     117        OSType poolBufferType;
     118        switch (bufferType) {
     119        case webrtc::BufferType::I420:
     120            poolBufferType = kCVPixelFormatType_420YpCbCr8BiPlanarFullRange;
     121            break;
     122        case webrtc::BufferType::I010:
     123            poolBufferType = kCVPixelFormatType_420YpCbCr10BiPlanarFullRange;
     124        }
     125        auto pixelBufferPool = WebProcess::singleton().libWebRTCCodecs().pixelBufferPool(width, height, poolBufferType);
    118126        if (!pixelBufferPool)
    119127            return nullptr;
     
    360368}
    361369
    362 CVPixelBufferPoolRef LibWebRTCCodecs::pixelBufferPool(size_t width, size_t height)
     370CVPixelBufferPoolRef LibWebRTCCodecs::pixelBufferPool(size_t width, size_t height, OSType type)
    363371{
    364372    if (!m_pixelBufferPool || m_pixelBufferPoolWidth != width || m_pixelBufferPoolHeight != height) {
    365         m_pixelBufferPool = createPixelBufferPool(width, height);
     373        m_pixelBufferPool = createPixelBufferPool(width, height, type);
    366374        m_pixelBufferPoolWidth = width;
    367375        m_pixelBufferPoolHeight = height;
  • trunk/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.h

    r259568 r268971  
    9595    void setEncodeRates(Encoder&, uint32_t bitRate, uint32_t frameRate);
    9696   
    97     CVPixelBufferPoolRef pixelBufferPool(size_t width, size_t height);
     97    CVPixelBufferPoolRef pixelBufferPool(size_t width, size_t height, OSType);
    9898
    9999    void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
Note: See TracChangeset for help on using the changeset viewer.