Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 253f33f069cf75743106931a7b6a698a9bcede2f
      
https://github.com/WebKit/WebKit/commit/253f33f069cf75743106931a7b6a698a9bcede2f
  Author: Eric Carlson <[email protected]>
  Date:   2026-04-28 (Tue, 28 Apr 2026)

  Changed paths:
    M LayoutTests/fast/mediastream/image-capture-take-photo-expected.txt
    M LayoutTests/fast/mediastream/image-capture-take-photo.html
    M Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.cpp
    M Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.h
    M Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp
    M Source/WebCore/platform/mock/MockRealtimeVideoSource.h

  Log Message:
  -----------
  ImageCapture: queue takePhoto() and applyConstraints() to avoid concurrent 
capture session reconfiguration
https://bugs.webkit.org/show_bug.cgi?id=312508
rdar://174950018

Reviewed by Youenn Fablet.

`takePhoto()` reconfigures the MediaStreamTrack when the requested photo size 
requires
a different preset, and `applyConstraints()` reconfigures it whenever size, 
frame rate,
or zoom constraints change. If either fires while a takePhoto() capture is 
in-flight
on the Cocoa port, the concurrent reconfiguration causes AVFoundation to fail 
with
AVErrorUnknown (-11800).

Fix this by adding a pending operation queue to RealtimeVideoCaptureSource, so 
we can
serialize all calls to `applyConstraoints` and `takePhoto`.

MockRealtimeVideoSource tracks when a photo is being taken and rejects the 
pending
promise if a call to `takePhoto` or `applyConstraints` happens while a photo 
capture
is pending. This acts as a regression guard in case queue serialization in
RealtimeVideoCaptureSource is removed or broken.

No new test, fast/mediastream/image-capture-take-photo.html was updated for 
these changes.

* LayoutTests/fast/mediastream/image-capture-take-photo-expected.txt:
* LayoutTests/fast/mediastream/image-capture-take-photo.html:
* Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.cpp:
(WebCore::RealtimeVideoCaptureSource::takePhoto):
(WebCore::RealtimeVideoCaptureSource::applyConstraints):
(WebCore::RealtimeVideoCaptureSource::dispatchNextOperation):
(WebCore::RealtimeVideoCaptureSource::didEnd):
* Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.h:
* Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::takePhotoInternal):
(WebCore::MockRealtimeVideoSource::startApplyingConstraints):
* Source/WebCore/platform/mock/MockRealtimeVideoSource.h:

Canonical link: https://commits.webkit.org/312196@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to