Title: [245478] trunk/Source/WebCore
Revision
245478
Author
[email protected]
Date
2019-05-17 14:29:14 -0700 (Fri, 17 May 2019)

Log Message

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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (245477 => 245478)


--- trunk/Source/WebCore/ChangeLog	2019-05-17 21:23:06 UTC (rev 245477)
+++ trunk/Source/WebCore/ChangeLog	2019-05-17 21:29:14 UTC (rev 245478)
@@ -1,3 +1,18 @@
+2019-05-17  Youenn Fablet  <[email protected]>
+
+        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  <[email protected]>
 
         Implement imagesrcset and imagesizes attributes on link rel=preload

Modified: trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm (245477 => 245478)


--- trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm	2019-05-17 21:23:06 UTC (rev 245477)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm	2019-05-17 21:29:14 UTC (rev 245478)
@@ -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)];
+            } else
+                ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "cannot find proper frame rate range for the selected preset\n");
 
-            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];
         }
     } @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];
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to