- Revision
- 291643
- Author
- [email protected]
- Date
- 2022-03-22 10:55:14 -0700 (Tue, 22 Mar 2022)
Log Message
Cherry-pick r290820. rdar://problem/88301613
AVVideoCaptureSource should reuse CaptureDevice label
https://bugs.webkit.org/show_bug.cgi?id=237363
<rdar://88301613>
Reviewed by Eric Carlson.
We are getting AV device name through AVCaptureDevice.localizedName, first in UIProcess, then in GPUProcess.
To make sure we always use the ones from UIProcess (which are the ones exposed through mediaDevices.enumerateDevices),
We make sure to use CaptureDevice.label when creating an AVVideoCaptureSource.
Manually tested.
* platform/mediastream/mac/AVVideoCaptureSource.h:
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::create):
(WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
* platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290820 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (291642 => 291643)
--- branches/safari-613-branch/Source/WebCore/ChangeLog 2022-03-22 17:55:10 UTC (rev 291642)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog 2022-03-22 17:55:14 UTC (rev 291643)
@@ -1,5 +1,50 @@
2022-03-21 Alan Coon <[email protected]>
+ Cherry-pick r290820. rdar://problem/88301613
+
+ AVVideoCaptureSource should reuse CaptureDevice label
+ https://bugs.webkit.org/show_bug.cgi?id=237363
+ <rdar://88301613>
+
+ Reviewed by Eric Carlson.
+
+ We are getting AV device name through AVCaptureDevice.localizedName, first in UIProcess, then in GPUProcess.
+ To make sure we always use the ones from UIProcess (which are the ones exposed through mediaDevices.enumerateDevices),
+ We make sure to use CaptureDevice.label when creating an AVVideoCaptureSource.
+
+ Manually tested.
+
+ * platform/mediastream/mac/AVVideoCaptureSource.h:
+ * platform/mediastream/mac/AVVideoCaptureSource.mm:
+ (WebCore::AVVideoCaptureSource::create):
+ (WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
+ * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290820 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2022-03-04 Youenn Fablet <[email protected]>
+
+ AVVideoCaptureSource should reuse CaptureDevice label
+ https://bugs.webkit.org/show_bug.cgi?id=237363
+ <rdar://88301613>
+
+ Reviewed by Eric Carlson.
+
+ We are getting AV device name through AVCaptureDevice.localizedName, first in UIProcess, then in GPUProcess.
+ To make sure we always use the ones from UIProcess (which are the ones exposed through mediaDevices.enumerateDevices),
+ We make sure to use CaptureDevice.label when creating an AVVideoCaptureSource.
+
+ Manually tested.
+
+ * platform/mediastream/mac/AVVideoCaptureSource.h:
+ * platform/mediastream/mac/AVVideoCaptureSource.mm:
+ (WebCore::AVVideoCaptureSource::create):
+ (WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
+ * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
+
+2022-03-21 Alan Coon <[email protected]>
+
Cherry-pick r290676. rdar://problem/83831093
[Cocoa] HLS stream currentTime sometimes jumps backwards
Modified: branches/safari-613-branch/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h (291642 => 291643)
--- branches/safari-613-branch/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h 2022-03-22 17:55:10 UTC (rev 291642)
+++ branches/safari-613-branch/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h 2022-03-22 17:55:14 UTC (rev 291643)
@@ -54,7 +54,7 @@
class AVVideoCaptureSource : public RealtimeVideoCaptureSource, private OrientationNotifier::Observer {
public:
- static CaptureSourceOrError create(String&& id, String&& hashSalt, const MediaConstraints*);
+ static CaptureSourceOrError create(const CaptureDevice&, String&& hashSalt, const MediaConstraints*);
WEBCORE_EXPORT static VideoCaptureFactory& factory();
@@ -70,7 +70,7 @@
void captureDeviceSuspendedDidChange();
private:
- AVVideoCaptureSource(AVCaptureDevice*, String&& id, String&& hashSalt);
+ AVVideoCaptureSource(AVCaptureDevice*, const CaptureDevice&, String&& hashSalt);
virtual ~AVVideoCaptureSource();
void clearSession();
Modified: branches/safari-613-branch/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm (291642 => 291643)
--- branches/safari-613-branch/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm 2022-03-22 17:55:10 UTC (rev 291642)
+++ branches/safari-613-branch/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm 2022-03-22 17:55:14 UTC (rev 291643)
@@ -108,13 +108,13 @@
RetainPtr<AVCaptureDeviceFormat> format;
};
-CaptureSourceOrError AVVideoCaptureSource::create(String&& id, String&& hashSalt, const MediaConstraints* constraints)
+CaptureSourceOrError AVVideoCaptureSource::create(const CaptureDevice& device, String&& hashSalt, const MediaConstraints* constraints)
{
- AVCaptureDevice *device = [PAL::getAVCaptureDeviceClass() deviceWithUniqueID:id];
- if (!device)
+ auto *avDevice = [PAL::getAVCaptureDeviceClass() deviceWithUniqueID:device.persistentId()];
+ if (!avDevice)
return { "No AVVideoCaptureSource device"_s };
- auto source = adoptRef(*new AVVideoCaptureSource(device, WTFMove(id), WTFMove(hashSalt)));
+ auto source = adoptRef(*new AVVideoCaptureSource(avDevice, device, WTFMove(hashSalt)));
if (constraints) {
auto result = source->applyConstraints(*constraints);
if (result)
@@ -124,10 +124,10 @@
return CaptureSourceOrError(RealtimeVideoSource::create(WTFMove(source)));
}
-AVVideoCaptureSource::AVVideoCaptureSource(AVCaptureDevice* device, String&& id, String&& hashSalt)
- : RealtimeVideoCaptureSource(device.localizedName, WTFMove(id), WTFMove(hashSalt))
+AVVideoCaptureSource::AVVideoCaptureSource(AVCaptureDevice* avDevice, const CaptureDevice& device, String&& hashSalt)
+ : RealtimeVideoCaptureSource(String(device.label()), String(device.persistentId()), WTFMove(hashSalt))
, m_objcObserver(adoptNS([[WebCoreAVVideoCaptureSourceObserver alloc] initWithCallback:this]))
- , m_device(device)
+ , m_device(avDevice)
, m_verifyCapturingTimer(*this, &AVVideoCaptureSource::verifyIsCapturing)
{
[m_device addObserver:m_objcObserver.get() forKeyPath:@"suspended" options:NSKeyValueObservingOptionNew context:(void *)nil];
Modified: branches/safari-613-branch/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp (291642 => 291643)
--- branches/safari-613-branch/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp 2022-03-22 17:55:10 UTC (rev 291642)
+++ branches/safari-613-branch/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp 2022-03-22 17:55:14 UTC (rev 291643)
@@ -48,7 +48,7 @@
CaptureSourceOrError createVideoCaptureSource(const CaptureDevice& device, String&& hashSalt, const MediaConstraints* constraints) final
{
ASSERT(device.type() == CaptureDevice::DeviceType::Camera);
- return AVVideoCaptureSource::create(String { device.persistentId() }, WTFMove(hashSalt), constraints);
+ return AVVideoCaptureSource::create(device, WTFMove(hashSalt), constraints);
}
private: