WebKit Bugzilla
Attachment 369797 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]
Patch
bug-197707-20190513155342.patch (text/plain), 5.69 KB, created by
youenn fablet
on 2019-05-13 15:53:42 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-05-13 15:53:42 PDT
Size:
5.69 KB
patch
obsolete
>Subversion Revision: 245178 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 4b1643600562a41f15ca9c5552b7e5a45a184e56..b98540ceefa57ae8a12df1c53dab59043027c802 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 NOBODY (OOPS!). >+ >+ 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 Youenn Fablet <youenn@apple.com> > > getUserMedia capture changes on iOS after homing out >diff --git a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h >index 417a73b29a1c2edc92c2d9fb73d1378fee3fcc43..c0815afe6369c2c181c46bea43ef530da8377f6f 100644 >--- a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h >+++ b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h >@@ -96,6 +96,7 @@ private: > 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 106734ffe905ab29ac844b835307e145008d39d3..aa0553bb47b0c9da88258eefe84710f9bafcf5ec 100644 >--- a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm >+++ b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm >@@ -289,16 +289,19 @@ void AVVideoCaptureSource::setSizeAndFrameRateWithPreset(IntSize requestedSize, > > auto* avPreset = preset ? downcast<AVVideoPreset>(preset.get()) : nullptr; > >- if (!m_session) { >- m_pendingPreset = avPreset; >- m_pendingSize = requestedSize; >- m_pendingFrameRate = requestedFrameRate; >- return; >- } >+ m_currentPreset = avPreset; >+ m_currentSize = requestedSize; >+ m_currentFrameRate = requestedFrameRate; > >- m_pendingPreset = nullptr; >- m_pendingFrameRate = 0; >+ setSessionSizeAndFrameRate(); >+} > >+void AVVideoCaptureSource::setSessionSizeAndFrameRate() >+{ >+ if (!m_session) >+ return; >+ >+ auto* avPreset = m_currentPreset.get(); > if (!avPreset) > return; > >@@ -321,19 +324,19 @@ void AVVideoCaptureSource::setSizeAndFrameRateWithPreset(IntSize requestedSize, > [m_videoOutput setVideoSettings:settingsDictionary]; > #endif > } >- auto* frameRateRange = frameDurationForFrameRate(requestedFrameRate); >+ auto* frameRateRange = frameDurationForFrameRate(m_currentFrameRate); > ASSERT(frameRateRange); > if (!frameRateRange) > return; > >- if (requestedFrameRate < frameRateRange.minFrameRate) >- requestedFrameRate = frameRateRange.minFrameRate; >- else if (requestedFrameRate > frameRateRange.maxFrameRate) >- requestedFrameRate = frameRateRange.maxFrameRate; >+ if (m_currentFrameRate < frameRateRange.minFrameRate) >+ m_currentFrameRate = frameRateRange.minFrameRate; >+ else if (m_currentFrameRate > frameRateRange.maxFrameRate) >+ m_currentFrameRate = 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]; > } >@@ -343,8 +346,6 @@ void AVVideoCaptureSource::setSizeAndFrameRateWithPreset(IntSize requestedSize, > } > [m_session commitConfiguration]; > >- m_currentPreset = avPreset; >- > ERROR_LOG_IF(error && loggerPtr(), LOGIDENTIFIER, [[error localizedDescription] UTF8String]); > } > >@@ -451,8 +452,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();
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