Skip to content

Commit b1f82ba

Browse files
committed
Disable verification timer in case of capture suspension
https://bugs.webkit.org/show_bug.cgi?id=220859 Reviewed by Eric Carlson. In case of suspension/unsuspension, make it as if the capture was interrupted. Update updateVerifyCapturingTimer to stop timer it capture is interrupted. Remove RealtimeMediaSource::m_interrupted which is unused and potentially confusing. Manually tested. * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::updateVerifyCapturingTimer): (WebCore::AVVideoCaptureSource::captureDeviceSuspendedDidChange): Canonical link: https://commits.webkit.org/233256@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271749 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 43f4c80 commit b1f82ba

3 files changed

Lines changed: 27 additions & 9 deletions

File tree

Source/WebCore/ChangeLog

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
2021-01-22 Youenn Fablet <youenn@apple.com>
2+
3+
Disable verification timer in case of capture suspension
4+
https://bugs.webkit.org/show_bug.cgi?id=220859
5+
6+
Reviewed by Eric Carlson.
7+
8+
In case of suspension/unsuspension, make it as if the capture was interrupted.
9+
Update updateVerifyCapturingTimer to stop timer it capture is interrupted.
10+
11+
Remove RealtimeMediaSource::m_interrupted which is unused and potentially confusing.
12+
Manually tested.
13+
14+
* platform/mediastream/RealtimeMediaSource.h:
15+
* platform/mediastream/mac/AVVideoCaptureSource.mm:
16+
(WebCore::AVVideoCaptureSource::updateVerifyCapturingTimer):
17+
(WebCore::AVVideoCaptureSource::captureDeviceSuspendedDidChange):
18+
119
2021-01-22 Ziran Sun <zsun@igalia.com>
220

321
[css-grid] Relayout grid items when definiteness changes.

Source/WebCore/platform/mediastream/RealtimeMediaSource.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class WEBCORE_EXPORT RealtimeMediaSource
131131

132132
bool captureDidFail() const { return m_captureDidFailed; }
133133

134-
virtual bool interrupted() const { return m_interrupted; }
134+
virtual bool interrupted() const { return false; }
135135

136136
const String& name() const { return m_name; }
137137
void setName(String&& name) { m_name = WTFMove(name); }
@@ -298,7 +298,6 @@ class WEBCORE_EXPORT RealtimeMediaSource
298298
bool m_pendingSettingsDidChangeNotification { false };
299299
bool m_echoCancellation { false };
300300
bool m_isProducingData { false };
301-
bool m_interrupted { false };
302301
bool m_captureDidFailed { false };
303302
bool m_isEnded { false };
304303
bool m_hasStartedProducingData { false };

Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ static dispatch_queue_t globaVideoCaptureSerialQueue()
164164

165165
void AVVideoCaptureSource::updateVerifyCapturingTimer()
166166
{
167-
if (!m_isRunning) {
167+
if (!m_isRunning || m_interrupted) {
168168
m_verifyCapturingTimer.stop();
169169
return;
170170
}
@@ -570,13 +570,14 @@ static inline int sensorOrientationFromVideoOutput(AVCaptureVideoDataOutput* vid
570570
void AVVideoCaptureSource::captureDeviceSuspendedDidChange()
571571
{
572572
#if !PLATFORM(IOS_FAMILY)
573-
scheduleDeferredTask([this] {
574-
auto isSuspended = [m_device isSuspended];
575-
ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, !!isSuspended);
576-
if (isSuspended == muted())
577-
return;
573+
scheduleDeferredTask([this, logIdentifier = LOGIDENTIFIER] {
574+
m_interrupted = [m_device isSuspended];
575+
ALWAYS_LOG_IF(loggerPtr(), logIdentifier, !!m_interrupted);
576+
577+
updateVerifyCapturingTimer();
578578

579-
notifyMutedChange(isSuspended);
579+
if (m_interrupted != muted())
580+
notifyMutedChange(m_interrupted);
580581
});
581582
#endif
582583
}

0 commit comments

Comments
 (0)