Make AVVideoCaptureSource more robust to configuration failures
https://bugs.webkit.org/show_bug.cgi?id=197997
rdar://problem/50875662
Reviewed by Eric Carlson.
Covered by manual testing.
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::setSessionSizeAndFrameRate):
Make sure to commit configuration once calling beginConfiguration.
In case of error in setting frame rate, log the error but continue capturing.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@245478 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 5b989f3..fc3fdc9 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2019-05-17 Youenn Fablet <youenn@apple.com>
+
+ Make AVVideoCaptureSource more robust to configuration failures
+ https://bugs.webkit.org/show_bug.cgi?id=197997
+ rdar://problem/50875662
+
+ Reviewed by Eric Carlson.
+
+ Covered by manual testing.
+
+ * platform/mediastream/mac/AVVideoCaptureSource.mm:
+ (WebCore::AVVideoCaptureSource::setSessionSizeAndFrameRate):
+ Make sure to commit configuration once calling beginConfiguration.
+ In case of error in setting frame rate, log the error but continue capturing.
+
2019-05-17 Rob Buis <rbuis@igalia.com>
Implement imagesrcset and imagesizes attributes on link rel=preload
diff --git a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm
index 3cdca30..f66d011 100644
--- a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm
+++ b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm
@@ -324,20 +324,21 @@
auto* frameRateRange = frameDurationForFrameRate(m_currentFrameRate);
ASSERT(frameRateRange);
- if (!frameRateRange)
- return;
+ if (frameRateRange) {
+ m_currentFrameRate = clampTo(m_currentFrameRate, frameRateRange.minFrameRate, frameRateRange.maxFrameRate);
- m_currentFrameRate = clampTo(m_currentFrameRate, frameRateRange.minFrameRate, frameRateRange.maxFrameRate);
-
- ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, "setting frame rate to ", m_currentFrameRate);
- [device() setActiveVideoMinFrameDuration: CMTimeMake(1, m_currentFrameRate)];
- [device() setActiveVideoMaxFrameDuration: CMTimeMake(1, m_currentFrameRate)];
+ ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, "setting frame rate to ", m_currentFrameRate);
+ [device() setActiveVideoMinFrameDuration: CMTimeMake(1, m_currentFrameRate)];
+ [device() setActiveVideoMaxFrameDuration: CMTimeMake(1, m_currentFrameRate)];
+ } else
+ ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "cannot find proper frame rate range for the selected preset\n");
[device() unlockForConfiguration];
}
} @catch(NSException *exception) {
ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "error configuring device ", [[exception name] UTF8String], ", reason : ", [[exception reason] UTF8String]);
- return;
+ [device() unlockForConfiguration];
+ ASSERT_NOT_REACHED();
}
[m_session commitConfiguration];