WebKit Bugzilla
Attachment 369865 Details for
Bug 197707
: getUserMedia capture changes on iOS after homing out
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Further cleanup
bug-197707-20190514101339.patch (text/plain), 10.77 KB, created by
youenn fablet
on 2019-05-14 10:13:40 PDT
(
hide
)
Description:
Further cleanup
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-05-14 10:13:40 PDT
Size:
10.77 KB
patch
obsolete
>Subversion Revision: 245233 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0702237834a7edb1da138c7d8322d90ae5c4130e..85a49c3bc05afb9972a8f31e1a4b3e95af2568b2 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,20 @@ >+2019-05-13 Youenn Fablet <youenn@apple.com> >+ >+ getUserMedia capture changes on iOS after homing out >+ https://bugs.webkit.org/show_bug.cgi?id=197707 >+ >+ Reviewed by Eric Carlson. >+ >+ In case of muting an AVVideoCaptureSource on iOS, the session is cleared. >+ We need to store the preset information, to setup the new session on unnmuting correctly. >+ Manually tested. >+ >+ * platform/mediastream/mac/AVVideoCaptureSource.h: >+ * platform/mediastream/mac/AVVideoCaptureSource.mm: >+ (WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset): >+ (WebCore::AVVideoCaptureSource::setSessionSizeAndFrameRate): >+ (WebCore::AVVideoCaptureSource::setupCaptureSession): >+ > 2019-05-13 Darin Adler <darin@apple.com> > > WHLSLPrepare.cpp always recompiles, even if nothing was changed >diff --git a/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp b/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp >index ada1ec3a2c60b1121ad131ecc9aabe610f9c162d..f24e0080691caa9b1d735b612347e4ff4f4188b2 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp >+++ b/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp >@@ -366,7 +366,7 @@ void RealtimeVideoSource::setSizeAndFrameRate(Optional<int> width, Optional<int> > if (!match) > return; > >- setSizeAndFrameRateWithPreset(match->requestedSize, match->requestedFrameRate, match->encodingPreset); >+ setFrameRateWithPreset(match->requestedFrameRate, match->encodingPreset); > > if (!match->requestedSize.isEmpty()) > setSize(match->requestedSize); >diff --git a/Source/WebCore/platform/mediastream/RealtimeVideoSource.h b/Source/WebCore/platform/mediastream/RealtimeVideoSource.h >index 99bacbe242399ba46459c3bfda8c9a0daff18ea0..1a17938c5349af51c0fd620d4c55eae0bf3e9a59 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeVideoSource.h >+++ b/Source/WebCore/platform/mediastream/RealtimeVideoSource.h >@@ -51,7 +51,7 @@ protected: > > virtual void generatePresets() = 0; > virtual bool prefersPreset(VideoPreset&) { return true; } >- virtual void setSizeAndFrameRateWithPreset(IntSize, double, RefPtr<VideoPreset>) { }; >+ virtual void setFrameRateWithPreset(double, RefPtr<VideoPreset>) { }; > virtual bool canResizeVideoFrames() const { return false; } > bool shouldUsePreset(VideoPreset& current, VideoPreset& candidate); > >diff --git a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h >index 417a73b29a1c2edc92c2d9fb73d1378fee3fcc43..5d6cb1ed7d8fccd1f03578c08dcf894f1facb75e 100644 >--- a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h >+++ b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h >@@ -91,11 +91,12 @@ private: > CaptureDevice::DeviceType deviceType() const final { return CaptureDevice::DeviceType::Camera; } > bool interrupted() const final; > >- void setSizeAndFrameRateWithPreset(IntSize, double, RefPtr<VideoPreset>) final; >+ void setFrameRateWithPreset(double, RefPtr<VideoPreset>) final; > bool prefersPreset(VideoPreset&) final; > void generatePresets() final; > bool canResizeVideoFrames() const final { return true; } > >+ void setSessionSizeAndFrameRate(); > bool setPreset(NSString*); > void computeSampleRotation(); > AVFrameRateRange* frameDurationForFrameRate(double); >@@ -127,12 +128,11 @@ private: > RetainPtr<WebCoreAVVideoCaptureSourceObserver> m_objcObserver; > RetainPtr<AVCaptureSession> m_session; > RetainPtr<AVCaptureDevice> m_device; >- RefPtr<VideoPreset> m_pendingPreset; > > Lock m_presetMutex; > RefPtr<AVVideoPreset> m_currentPreset; >- IntSize m_pendingSize; >- double m_pendingFrameRate; >+ IntSize m_currentSize; >+ double m_currentFrameRate; > InterruptionReason m_interruption { InterruptionReason::None }; > int m_framesToDropAtStartup { 0 }; > bool m_isRunning { false }; >diff --git a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm >index a5376430a2308d84ada452a6250a892c88158188..3cdca3042311658ba6839bf4812fdef8fbb032f0 100644 >--- a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm >+++ b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm >@@ -283,22 +283,23 @@ bool AVVideoCaptureSource::prefersPreset(VideoPreset& preset) > return true; > } > >-void AVVideoCaptureSource::setSizeAndFrameRateWithPreset(IntSize requestedSize, double requestedFrameRate, RefPtr<VideoPreset> preset) >+void AVVideoCaptureSource::setFrameRateWithPreset(double requestedFrameRate, RefPtr<VideoPreset> preset) > { >- ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, SizeAndFrameRate { requestedSize.width(), requestedSize.height(), requestedFrameRate }); >+ ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, SizeAndFrameRate { preset->size.width(), preset->size.height(), requestedFrameRate }); > > auto* avPreset = preset ? downcast<AVVideoPreset>(preset.get()) : nullptr; >+ m_currentPreset = avPreset; >+ m_currentFrameRate = requestedFrameRate; > >- if (!m_session) { >- m_pendingPreset = avPreset; >- m_pendingSize = requestedSize; >- m_pendingFrameRate = requestedFrameRate; >- return; >- } >+ setSessionSizeAndFrameRate(); >+} > >- m_pendingPreset = nullptr; >- m_pendingFrameRate = 0; >+void AVVideoCaptureSource::setSessionSizeAndFrameRate() >+{ >+ if (!m_session) >+ return; > >+ auto* avPreset = m_currentPreset.get(); > if (!avPreset) > return; > >@@ -308,29 +309,29 @@ void AVVideoCaptureSource::setSizeAndFrameRateWithPreset(IntSize requestedSize, > [m_session beginConfiguration]; > @try { > if ([device() lockForConfiguration:&error]) { >- if (!m_currentPreset || ![m_currentPreset->format.get() isEqual:avPreset->format.get()]) { >- [device() setActiveFormat:avPreset->format.get()]; >+ ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, "setting preset to ", m_currentSize); >+ [device() setActiveFormat:avPreset->format.get()]; > > #if PLATFORM(MAC) >- auto settingsDictionary = @{ >- (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(avVideoCapturePixelBufferFormat()), >- (__bridge NSString *)kCVPixelBufferWidthKey: @(avPreset->size.width()), >- (__bridge NSString *)kCVPixelBufferHeightKey: @(avPreset->size.height()), >- (__bridge NSString *)kCVPixelBufferIOSurfacePropertiesKey : @{ } >- }; >- [m_videoOutput setVideoSettings:settingsDictionary]; >+ auto settingsDictionary = @{ >+ (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(avVideoCapturePixelBufferFormat()), >+ (__bridge NSString *)kCVPixelBufferWidthKey: @(avPreset->size.width()), >+ (__bridge NSString *)kCVPixelBufferHeightKey: @(avPreset->size.height()), >+ (__bridge NSString *)kCVPixelBufferIOSurfacePropertiesKey : @{ } >+ }; >+ [m_videoOutput setVideoSettings:settingsDictionary]; > #endif >- } >- auto* frameRateRange = frameDurationForFrameRate(requestedFrameRate); >+ >+ auto* frameRateRange = frameDurationForFrameRate(m_currentFrameRate); > ASSERT(frameRateRange); > if (!frameRateRange) > return; > >- requestedFrameRate = clampTo(requestedFrameRate, frameRateRange.minFrameRate, frameRateRange.maxFrameRate); >+ m_currentFrameRate = clampTo(m_currentFrameRate, frameRateRange.minFrameRate, frameRateRange.maxFrameRate); > >- ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, "setting frame rate to ", requestedFrameRate); >- [device() setActiveVideoMinFrameDuration: CMTimeMake(1, requestedFrameRate)]; >- [device() setActiveVideoMaxFrameDuration: CMTimeMake(1, requestedFrameRate)]; >+ ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, "setting frame rate to ", m_currentFrameRate); >+ [device() setActiveVideoMinFrameDuration: CMTimeMake(1, m_currentFrameRate)]; >+ [device() setActiveVideoMaxFrameDuration: CMTimeMake(1, m_currentFrameRate)]; > > [device() unlockForConfiguration]; > } >@@ -340,8 +341,6 @@ void AVVideoCaptureSource::setSizeAndFrameRateWithPreset(IntSize requestedSize, > } > [m_session commitConfiguration]; > >- m_currentPreset = avPreset; >- > ERROR_LOG_IF(error && loggerPtr(), LOGIDENTIFIER, [[error localizedDescription] UTF8String]); > } > >@@ -448,8 +447,7 @@ bool AVVideoCaptureSource::setupCaptureSession() > } > [session() addOutput:m_videoOutput.get()]; > >- if (m_pendingPreset || m_pendingFrameRate) >- setSizeAndFrameRateWithPreset(m_pendingSize, m_pendingFrameRate, m_pendingPreset); >+ setSessionSizeAndFrameRate(); > > m_sensorOrientation = sensorOrientationFromVideoOutput(m_videoOutput.get()); > computeSampleRotation(); >diff --git a/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp b/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp >index f13c5b5b6e11fd38fadff0cdff151554288a01cd..36d8c75b451d22230fedf00dca084b45d5795ac1 100644 >--- a/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp >+++ b/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp >@@ -181,9 +181,9 @@ const RealtimeMediaSourceSettings& MockRealtimeVideoSource::settings() > return m_currentSettings.value(); > } > >-void MockRealtimeVideoSource::setSizeAndFrameRateWithPreset(IntSize, double, RefPtr<VideoPreset> preset) >+void MockRealtimeVideoSource::setFrameRateWithPreset(double, RefPtr<VideoPreset> preset) > { >- m_preset = preset; >+ m_preset = WTFMove(preset); > if (preset) > setIntrinsicSize(preset->size); > } >diff --git a/Source/WebCore/platform/mock/MockRealtimeVideoSource.h b/Source/WebCore/platform/mock/MockRealtimeVideoSource.h >index 3c7e29e2325785e38a41f3bdb50b69e9b920fa0e..866c1b0af1f73d9ea816059b99cb3c676573940c 100644 >--- a/Source/WebCore/platform/mock/MockRealtimeVideoSource.h >+++ b/Source/WebCore/platform/mock/MockRealtimeVideoSource.h >@@ -71,7 +71,7 @@ private: > CaptureDevice::DeviceType deviceType() const final { return CaptureDevice::DeviceType::Camera; } > bool supportsSizeAndFrameRate(Optional<int> width, Optional<int> height, Optional<double>) final; > void setSizeAndFrameRate(Optional<int> width, Optional<int> height, Optional<double>) final; >- void setSizeAndFrameRateWithPreset(IntSize, double, RefPtr<VideoPreset>) final; >+ void setFrameRateWithPreset(double, RefPtr<VideoPreset>) final; > IntSize captureSize() const; > > void generatePresets() final;
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 197707
:
369797
|
369801
|
369835
| 369865 |
369878