Enable conversion of libwebrtc internal frames as CVPixelBuffer
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2018 20:15:17 +0000 (20:15 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2018 20:15:17 +0000 (20:15 +0000)
commit33bf763712327e09b5b252ddcdbd6ad7ce497ed7
treec425af3375fc3e78c6df25dd21802d7561d34b50
parentdd19eb574ce367a84a01f76ee99fc35cd9e4968b
Enable conversion of libwebrtc internal frames as CVPixelBuffer
https://bugs.webkit.org/show_bug.cgi?id=189892

Reviewed by Eric Carlson.

Source/ThirdParty/libwebrtc:

Renamed encoder/decoder factory creation routine.
Make pixelBufferFromFrame take a function to create a CVPixelBuffer
if the frame does not wrap one.
Initialize the CVPixelBuffer with libwebrtc internal frame.

* 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::createWebKitEncoderFactory):
(webrtc::createWebKitDecoderFactory):
(webrtc::CopyVideoFrameToPixelBuffer):
(webrtc::pixelBufferFromFrame):
(webrtc::createVideoToolboxEncoderFactory): Deleted.
(webrtc::createVideoToolboxDecoderFactory): Deleted.

Source/WebCore:

Make sure to handle the case of libwebrtc frames that are not backed by CVPixelBuffer.
No observable change of behavior.

* platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
(WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
(WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
Update according renamed methods.
* platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h:
* platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
(WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
In case of libwebrtc frame that are not backed by CVPixelBuffer, we create
a CVPixelBuffer from a pixel buffer pool.
This CVPixelBuffer is then filled as part of webrtc::pixelBufferFromFrame.
* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm:
(WebCore::RealtimeOutgoingVideoSourceCocoa::convertToYUV):
Make sure to use preferred pixel buffer format.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236423 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/ThirdParty/libwebrtc/ChangeLog
Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp
Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp
Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp
Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.h
Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.mm
Source/WebCore/ChangeLog
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp
Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h
Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm
Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm