Changeset 245032 in webkit


Ignore:
Timestamp:
May 7, 2019 2:04:09 PM (5 years ago)
Author:
youenn@apple.com
Message:

getUserMedia framerate unusable under low light in iOS 12.2
https://bugs.webkit.org/show_bug.cgi?id=196214
<rdar://problem/49232193>

Reviewed by Geoffrey Garen.

When setting the frame rate, set it to the exact value instead of a range.
Otherwise, the capture device might use the lowest frame rate according the light conditions
for best picture quality which is not what is expected by most web pages.

Move frame rate range computation to closer where actually used.
Since frame rate matching is fuzzy, add some checks in case the expected frame rate is slightly out of min/max range.

Manually tested on a real device.

  • platform/mediastream/mac/AVVideoCaptureSource.mm:

(WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r245031 r245032  
     12019-05-07  Youenn Fablet  <youenn@apple.com>
     2
     3        getUserMedia framerate unusable under low light in iOS 12.2
     4        https://bugs.webkit.org/show_bug.cgi?id=196214
     5        <rdar://problem/49232193>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        When setting the frame rate, set it to the exact value instead of a range.
     10        Otherwise, the capture device might use the lowest frame rate according the light conditions
     11        for best picture quality which is not what is expected by most web pages.
     12
     13        Move frame rate range computation to closer where actually used.
     14        Since frame rate matching is fuzzy, add some checks in case the expected frame rate is slightly out of min/max range.
     15
     16        Manually tested on a real device.
     17
     18        * platform/mediastream/mac/AVVideoCaptureSource.mm:
     19        (WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset):
     20
    1212019-05-07  Robin Morisset  <rmorisset@apple.com>
    222
  • trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm

    r244704 r245032  
    300300    m_pendingFrameRate = 0;
    301301
    302     auto* frameRateRange = frameDurationForFrameRate(requestedFrameRate);
    303     ASSERT(frameRateRange);
    304     if (!frameRateRange)
    305         return;
    306 
    307302    if (!avPreset)
    308303        return;
     
    316311            if (!m_currentPreset || ![m_currentPreset->format.get() isEqual:avPreset->format.get()]) {
    317312                [device() setActiveFormat:avPreset->format.get()];
    318 
    319                 frameRateRange = frameDurationForFrameRate(requestedFrameRate);
    320                 ASSERT(frameRateRange);
    321                 if (!frameRateRange)
    322                     return;
    323313
    324314#if PLATFORM(MAC)
     
    332322#endif
    333323            }
    334 
    335             ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, "setting frame rate ", CMTimeGetSeconds([frameRateRange minFrameDuration]), " .. ", CMTimeGetSeconds([frameRateRange maxFrameDuration]));
    336             [device() setActiveVideoMinFrameDuration:[frameRateRange minFrameDuration]];
    337             [device() setActiveVideoMaxFrameDuration:[frameRateRange maxFrameDuration]];
     324            auto* frameRateRange = frameDurationForFrameRate(requestedFrameRate);
     325            ASSERT(frameRateRange);
     326            if (!frameRateRange)
     327                return;
     328
     329            if (requestedFrameRate < frameRateRange.minFrameRate)
     330                requestedFrameRate = frameRateRange.minFrameRate;
     331            else if (requestedFrameRate > frameRateRange.maxFrameRate)
     332                requestedFrameRate = frameRateRange.maxFrameRate;
     333
     334            ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, "setting frame rate to ", requestedFrameRate);
     335            [device() setActiveVideoMinFrameDuration: CMTimeMake(1, requestedFrameRate)];
     336            [device() setActiveVideoMaxFrameDuration: CMTimeMake(1, requestedFrameRate)];
     337
    338338            [device() unlockForConfiguration];
    339339        }
Note: See TracChangeset for help on using the changeset viewer.