WebKit Bugzilla
Attachment 350164 Details for
Bug 189772
: Centralize which CVPixelBuffer format is being used
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189772-20180919173834.patch (text/plain), 10.46 KB, created by
youenn fablet
on 2018-09-19 17:38:35 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2018-09-19 17:38:35 PDT
Size:
10.46 KB
patch
obsolete
>Subversion Revision: 236212 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index dbfda725013e01789379390a1ef082595660ee21..4edae3f89a158320b9b0a80f0b6b7ffa15eea217 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,27 @@ >+2018-09-19 Youenn Fablet <youenn@apple.com> >+ >+ Centralize which CVPixelBuffer format is being used >+ https://bugs.webkit.org/show_bug.cgi?id=189772 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Get the format type from a single point. >+ This changes the video capture and mock realtime video sources on Mac to use a biplanar format. >+ No observable change of behavior. >+ >+ * WebCore.xcodeproj/project.pbxproj: >+ * platform/mediastream/mac/AVVideoCaptureSource.mm: >+ (WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset): >+ (WebCore::AVVideoCaptureSource::setupCaptureSession): >+ (WebCore::AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection): >+ * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm: >+ (WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer): >+ (WebCore::MockRealtimeVideoSourceMac::setSizeAndFrameRateWithPreset): >+ * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: >+ (WebCore::createBlackPixelBuffer): >+ * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: >+ (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated): >+ > 2018-09-19 Youenn Fablet <youenn@apple.com> > > Layout Test webrtc/video-mute.html is flaky. >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 4e66e92712b4808faf29430e3cb8017a5b478980..01fbbbbe4542f1edd7c5a91acafa7ea088437054 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -7376,6 +7376,7 @@ > 41D129CA1F3D0EE300D15E47 /* CacheStorageRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheStorageRecord.h; sourceTree = "<group>"; }; > 41D129CC1F3D0EE300D15E47 /* CacheStorageConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheStorageConnection.h; sourceTree = "<group>"; }; > 41D129D41F3D0F6600D15E47 /* CacheStorageProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheStorageProvider.h; sourceTree = "<group>"; }; >+ 41D1938F2152C561006F14CA /* RealtimeVideoUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RealtimeVideoUtilities.h; sourceTree = "<group>"; }; > 41D1A046213EDDEB0063FB6B /* RTCRtpSenderBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCRtpSenderBackend.h; sourceTree = "<group>"; }; > 41D1A048213EDDEB0063FB6B /* RTCRtpReceiverBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCRtpReceiverBackend.h; sourceTree = "<group>"; }; > 41D1A049213EDDFD0063FB6B /* LibWebRTCUtils.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCUtils.cpp; path = libwebrtc/LibWebRTCUtils.cpp; sourceTree = "<group>"; }; >@@ -15362,6 +15363,7 @@ > 5CDD833B1E4324BB00621B83 /* RealtimeOutgoingVideoSourceCocoa.cpp */, > 5CDD833C1E4324BB00621B83 /* RealtimeOutgoingVideoSourceCocoa.h */, > 419242472127B7CC00634FCF /* RealtimeOutgoingVideoSourceCocoa.mm */, >+ 41D1938F2152C561006F14CA /* RealtimeVideoUtilities.h */, > 070A9F5E1FFECC70003DF649 /* ScreenDisplayCaptureSourceMac.h */, > 070A9F601FFECC71003DF649 /* ScreenDisplayCaptureSourceMac.mm */, > 07D6373E1BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.h */, >diff --git a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm >index adf1ff346e73b3581250b24d5347d98db98233fa..d43904711afa5f6048c6a6cdb5f98f05ceb35478 100644 >--- a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm >+++ b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm >@@ -37,6 +37,7 @@ > #import "PlatformLayer.h" > #import "RealtimeMediaSourceCenterMac.h" > #import "RealtimeMediaSourceSettings.h" >+#import "RealtimeVideoUtilities.h" > #import <AVFoundation/AVCaptureDevice.h> > #import <AVFoundation/AVCaptureInput.h> > #import <AVFoundation/AVCaptureOutput.h> >@@ -113,12 +114,6 @@ @end > > namespace WebCore { > >-#if PLATFORM(MAC) >-const OSType videoCaptureFormat = kCVPixelFormatType_420YpCbCr8Planar; >-#else >-const OSType videoCaptureFormat = kCVPixelFormatType_420YpCbCr8BiPlanarFullRange; >-#endif >- > static dispatch_queue_t globaVideoCaptureSerialQueue() > { > static dispatch_queue_t globalQueue; >@@ -340,7 +335,7 @@ void AVVideoCaptureSource::setSizeAndFrameRateWithPreset(IntSize requestedSize, > [device() setActiveFormat:avPreset->format.get()]; > #if PLATFORM(MAC) > auto settingsDictionary = @{ >- (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(videoCaptureFormat), >+ (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(preferedPixelBufferFormat()), > (__bridge NSString *)kCVPixelBufferWidthKey: @(avPreset->size.width()), > (__bridge NSString *)kCVPixelBufferHeightKey: @(avPreset->size.height()) > }; >@@ -449,7 +444,7 @@ bool AVVideoCaptureSource::setupCaptureSession() > [session() addInput:videoIn.get()]; > > m_videoOutput = adoptNS([allocAVCaptureVideoDataOutputInstance() init]); >- auto settingsDictionary = adoptNS([[NSMutableDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:videoCaptureFormat], kCVPixelBufferPixelFormatTypeKey, nil]); >+ auto settingsDictionary = adoptNS([[NSMutableDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:preferedPixelBufferFormat()], kCVPixelBufferPixelFormatTypeKey, nil]); > > [m_videoOutput setVideoSettings:settingsDictionary.get()]; > [m_videoOutput setAlwaysDiscardsLateVideoFrames:YES]; >@@ -554,7 +549,7 @@ void AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection(AVCa > m_pixelBufferResizer = nullptr; > > if (!m_pixelBufferResizer) >- m_pixelBufferResizer = std::make_unique<PixelBufferResizer>(m_requestedSize, videoCaptureFormat); >+ m_pixelBufferResizer = std::make_unique<PixelBufferResizer>(m_requestedSize, preferedPixelBufferFormat()); > } else > m_pixelBufferResizer = nullptr; > >diff --git a/Source/WebCore/platform/mediastream/mac/MockRealtimeVideoSourceMac.mm b/Source/WebCore/platform/mediastream/mac/MockRealtimeVideoSourceMac.mm >index 613f224dade6b881884d757e4dffee9aad48970b..43163a95a08b0c026bd750f29a921316aacd4c02 100644 >--- a/Source/WebCore/platform/mediastream/mac/MockRealtimeVideoSourceMac.mm >+++ b/Source/WebCore/platform/mediastream/mac/MockRealtimeVideoSourceMac.mm >@@ -40,6 +40,7 @@ > #import "PixelBufferResizer.h" > #import "PlatformLayer.h" > #import "RealtimeMediaSourceSettings.h" >+#import "RealtimeVideoUtilities.h" > #import <QuartzCore/CALayer.h> > #import <QuartzCore/CATransaction.h> > #import <objc/runtime.h> >@@ -50,11 +51,6 @@ > namespace WebCore { > using namespace PAL; > >-#if PLATFORM(MAC) >-const OSType videoCaptureFormat = kCVPixelFormatType_420YpCbCr8Planar; >-#else >-const OSType videoCaptureFormat = kCVPixelFormatType_420YpCbCr8BiPlanarFullRange; >-#endif > static const int videoSampleRate = 90000; > > CaptureSourceOrError MockRealtimeVideoSource::create(const String& deviceID, const String& name, const MediaConstraints* constraints) >@@ -154,7 +150,7 @@ void MockRealtimeVideoSourceMac::updateSampleBuffer() > else { > if (!m_pixelBufferConformer) { > m_pixelBufferConformer = std::make_unique<PixelBufferConformerCV>((__bridge CFDictionaryRef)@{ >- (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(videoCaptureFormat) >+ (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(preferedPixelBufferFormat()) > }); > } > >@@ -210,7 +206,7 @@ void MockRealtimeVideoSourceMac::setSizeAndFrameRateWithPreset(IntSize requested > m_pixelBufferResizer = nullptr; > > if (!m_pixelBufferResizer) >- m_pixelBufferResizer = std::make_unique<PixelBufferResizer>(requestedSize, videoCaptureFormat); >+ m_pixelBufferResizer = std::make_unique<PixelBufferResizer>(requestedSize, preferedPixelBufferFormat()); > } else > m_pixelBufferResizer = nullptr; > } >diff --git a/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm b/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm >index 4e4a0f8676d61093e67d91a8520cd5f4aa8f977b..7860b3935152f0fe4bea62e61c628d559decb879 100644 >--- a/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm >+++ b/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm >@@ -66,6 +66,7 @@ RealtimeIncomingVideoSourceCocoa::RealtimeIncomingVideoSourceCocoa(rtc::scoped_r > > RetainPtr<CVPixelBufferRef> createBlackPixelBuffer(size_t width, size_t height) > { >+ // FIXME: change to biplanar format type. > CVPixelBufferRef pixelBuffer = nullptr; > auto status = CVPixelBufferCreate(kCFAllocatorDefault, width, height, kCVPixelFormatType_420YpCbCr8Planar, nullptr, &pixelBuffer); > ASSERT_UNUSED(status, status == noErr); >diff --git a/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp b/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp >index fddb5ea573b5fc681760ad8a9fff9bd173252039..702b73339a74f2cd6610023c368eabaa2ad487ab 100644 >--- a/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp >+++ b/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp >@@ -30,6 +30,7 @@ > > #include "Logging.h" > #include "RealtimeIncomingVideoSourceCocoa.h" >+#include "RealtimeVideoUtilities.h" > > ALLOW_UNUSED_PARAMETERS_BEGIN > >@@ -126,7 +127,7 @@ void RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated(MediaStreamTrackPriva > auto pixelFormatType = CVPixelBufferGetPixelFormatType(pixelBuffer); > > RetainPtr<CVPixelBufferRef> convertedBuffer = pixelBuffer; >- if (pixelFormatType != kCVPixelFormatType_420YpCbCr8Planar && pixelFormatType != kCVPixelFormatType_420YpCbCr8BiPlanarFullRange) >+ if (pixelFormatType != preferedPixelBufferFormat()) > convertedBuffer = convertToYUV(pixelBuffer); > > if (m_shouldApplyRotation && m_currentRotation != webrtc::kVideoRotation_0)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189772
:
350164
|
350234