Diff
Modified: trunk/LayoutTests/ChangeLog (260273 => 260274)
--- trunk/LayoutTests/ChangeLog 2020-04-17 19:31:08 UTC (rev 260273)
+++ trunk/LayoutTests/ChangeLog 2020-04-17 19:32:41 UTC (rev 260274)
@@ -1,3 +1,17 @@
+2020-04-17 Ryan Haddad <ryanhad...@apple.com>
+
+ Unreviewed, reverting r260245.
+
+ The tests added with this change are frequently failing on
+ macOS bots.
+
+ Reverted changeset:
+
+ "Safari doesn't apply frameRate limit when request stream from
+ Camera"
+ https://bugs.webkit.org/show_bug.cgi?id=210186
+ https://trac.webkit.org/changeset/260245
+
2020-04-16 Ryan Haddad <ryanhad...@apple.com>
REGRESSION (r259463): [ Mojave Debug ] http/tests/IndexedDB/collect-IDB-objects.https.html is flaky failing and timing out
Deleted: trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-clone-decreasing-expected.txt (260273 => 260274)
--- trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-clone-decreasing-expected.txt 2020-04-17 19:31:08 UTC (rev 260273)
+++ trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-clone-decreasing-expected.txt 2020-04-17 19:32:41 UTC (rev 260274)
@@ -1,4 +0,0 @@
-
-
-PASS clone and applyConstraints to decrease frame rate
-
Deleted: trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-clone-decreasing.html (260273 => 260274)
--- trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-clone-decreasing.html 2020-04-17 19:31:08 UTC (rev 260273)
+++ trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-clone-decreasing.html 2020-04-17 19:32:41 UTC (rev 260274)
@@ -1,32 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8">
- <title>Adapt camera track framerate</title>
- <script src=""
- <script src=""
- <script src =""
-</head>
-<body>
- <video autoplay id="video"></video>
- <script>
-promise_test(async (t) => {
- const stream1 = await navigator.mediaDevices.getUserMedia({ video: { width: 720, frameRate : 30 } });
- const stream2 = stream1.clone();
-
- await stream2.getVideoTracks()[0].applyConstraints({ width : 160, frameRate : 5 });
-
- // We adapt frame rate after 1 second of samples.
- await new Promise(resolve => setTimeout(resolve, 1000));
-
- let frameRate = await computeFrameRate(stream1, video);
- assert_greater_than(frameRate, 10, "stream1 frame rate above 10");
- assert_less_than(frameRate, 60, "stream1 frame rate below 60");
-
- frameRate = await computeFrameRate(stream2, video);
- assert_greater_than(frameRate, 1, "stream2 frame rate above 1");
- assert_less_than(frameRate, 20, "stream2 frame rate below 20");
-}, "clone and applyConstraints to decrease frame rate");
- </script>
-</body>
-</html>
Deleted: trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-clone-increasing-expected.txt (260273 => 260274)
--- trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-clone-increasing-expected.txt 2020-04-17 19:31:08 UTC (rev 260273)
+++ trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-clone-increasing-expected.txt 2020-04-17 19:32:41 UTC (rev 260274)
@@ -1,4 +0,0 @@
-
-
-PASS clone and applyConstraints to increase frame rate
-
Deleted: trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-clone-increasing.html (260273 => 260274)
--- trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-clone-increasing.html 2020-04-17 19:31:08 UTC (rev 260273)
+++ trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-clone-increasing.html 2020-04-17 19:32:41 UTC (rev 260274)
@@ -1,32 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8">
- <title>Adapt camera track framerate</title>
- <script src=""
- <script src=""
- <script src =""
-</head>
-<body>
- <video autoplay id="video"></video>
- <script>
-promise_test(async (t) => {
- const stream1 = await navigator.mediaDevices.getUserMedia({ video: { width: 160, frameRate : 5 } });
- const stream2 = stream1.clone();
-
- await stream2.getVideoTracks()[0].applyConstraints({ width : 720, frameRate : 30 });
-
- // We adapt frame rate after 1 second of samples.
- await new Promise(resolve => setTimeout(resolve, 1000));
-
- let frameRate = await computeFrameRate(stream1, video);
- assert_greater_than(frameRate, 1, "stream1 frame rate above 1");
- assert_less_than(frameRate, 20, "stream1 frame rate below 20");
-
- frameRate = await computeFrameRate(stream2, video);
- assert_greater_than(frameRate, 10, "stream2 frame rate above 10");
- assert_less_than(frameRate, 60, "stream2 frame rate below 60");
-}, "clone and applyConstraints to increase frame rate");
- </script>
-</body>
-</html>
Deleted: trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-decreasing-expected.txt (260273 => 260274)
--- trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-decreasing-expected.txt 2020-04-17 19:31:08 UTC (rev 260273)
+++ trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-decreasing-expected.txt 2020-04-17 19:32:41 UTC (rev 260274)
@@ -1,4 +0,0 @@
-
-
-PASS getUserMedia with decreasing frame rates
-
Deleted: trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-decreasing.html (260273 => 260274)
--- trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-decreasing.html 2020-04-17 19:31:08 UTC (rev 260273)
+++ trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-decreasing.html 2020-04-17 19:32:41 UTC (rev 260274)
@@ -1,32 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8">
- <title>Adapt camera track framerate</title>
- <script src=""
- <script src=""
- <script src =""
-</head>
-<body>
- <video autoplay id="video"></video>
- <script>
-promise_test(async (t) => {
- const stream1 = await navigator.mediaDevices.getUserMedia({ video: { width: 720, frameRate : 30 } });
- const stream2 = await navigator.mediaDevices.getUserMedia({ video: { width: 160, frameRate : 5 } });
-
- // We adapt frame rate after 1 second of samples.
- await new Promise(resolve => setTimeout(resolve, 1000));
-
- if (!stream1.getVideoTracks()[0].muted) {
- const frameRate = await computeFrameRate(stream1, video);
- assert_greater_than(frameRate, 10, "stream1 frame rate above 10");
- assert_less_than(frameRate, 60, "stream1 frame rate below 60");
- }
-
- const frameRate = await computeFrameRate(stream2, video);
- assert_greater_than(frameRate, 1, "stream2 frame rate above 1");
- assert_less_than(frameRate, 20, "stream2 frame rate below 20");
-}, "getUserMedia with decreasing frame rates");
- </script>
-</body>
-</html>
Deleted: trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-increasing-expected.txt (260273 => 260274)
--- trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-increasing-expected.txt 2020-04-17 19:31:08 UTC (rev 260273)
+++ trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-increasing-expected.txt 2020-04-17 19:32:41 UTC (rev 260274)
@@ -1,4 +0,0 @@
-
-
-PASS getUserMedia with increasing frame rates
-
Deleted: trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-increasing.html (260273 => 260274)
--- trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-increasing.html 2020-04-17 19:31:08 UTC (rev 260273)
+++ trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-frameRate-increasing.html 2020-04-17 19:32:41 UTC (rev 260274)
@@ -1,32 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8">
- <title>Adapt camera track framerate</title>
- <script src=""
- <script src=""
- <script src =""
-</head>
-<body>
- <video autoplay id="video"></video>
- <script>
-promise_test(async (t) => {
- const stream1 = await navigator.mediaDevices.getUserMedia({ video: { width: 160, frameRate : 5 } });
- const stream2 = await navigator.mediaDevices.getUserMedia({ video: { width: 720, frameRate : 30 } });
-
- // We adapt frame rate after 1 second of samples.
- await new Promise(resolve => setTimeout(resolve, 1000));
-
- if (!stream1.getVideoTracks()[0].muted) {
- const frameRate = await computeFrameRate(stream1, video);
- assert_greater_than(frameRate, 1, "stream1 frame rate above 1");
- assert_less_than(frameRate, 20, "stream1 frame rate below 20");
- }
-
- const frameRate = await computeFrameRate(stream2, video);
- assert_greater_than(frameRate, 10, "stream2 frame rate above 10");
- assert_less_than(frameRate, 60, "stream2 frame rate below 60");
-}, "getUserMedia with increasing frame rates");
- </script>
-</body>
-</html>
Modified: trunk/LayoutTests/webrtc/routines.js (260273 => 260274)
--- trunk/LayoutTests/webrtc/routines.js 2020-04-17 19:31:08 UTC (rev 260273)
+++ trunk/LayoutTests/webrtc/routines.js 2020-04-17 19:32:41 UTC (rev 260274)
@@ -225,45 +225,3 @@
});
return stats;
}
-
-function getReceivedTrackStats(connection)
-{
- return connection.getStats().then((report) => {
- var stats;
- report.forEach((statItem) => {
- if (statItem.type === "track") {
- stats = statItem;
- }
- });
- return stats;
- });
-}
-
-async function computeFrameRate(stream, video)
-{
- if (window.internals) {
- internals.observeMediaStreamTrack(stream.getVideoTracks()[0]);
- await new Promise(resolve => setTimeout(resolve, 1000));
- return internals.trackVideoSampleCount;
- }
-
- let connection;
- video.srcObject = await new Promise((resolve, reject) => {
- createConnections((firstConnection) => {
- firstConnection.addTrack(stream.getVideoTracks()[0], stream);
- }, (secondConnection) => {
- connection = secondConnection;
- secondConnection._ontrack_ = (trackEvent) => {
- resolve(trackEvent.streams[0]);
- };
- });
- setTimeout(() => reject("Test timed out"), 5000);
- });
-
- await video.play();
-
- const stats1 = await getReceivedTrackStats(connection);
- await new Promise(resolve => setTimeout(resolve, 1000));
- const stats2 = await getReceivedTrackStats(connection);
- return (stats2.framesReceived - stats1.framesReceived) * 1000 / (stats2.timestamp - stats1.timestamp);
-}
Modified: trunk/Source/WebCore/ChangeLog (260273 => 260274)
--- trunk/Source/WebCore/ChangeLog 2020-04-17 19:31:08 UTC (rev 260273)
+++ trunk/Source/WebCore/ChangeLog 2020-04-17 19:32:41 UTC (rev 260274)
@@ -1,3 +1,17 @@
+2020-04-17 Ryan Haddad <ryanhad...@apple.com>
+
+ Unreviewed, reverting r260245.
+
+ The tests added with this change are frequently failing on
+ macOS bots.
+
+ Reverted changeset:
+
+ "Safari doesn't apply frameRate limit when request stream from
+ Camera"
+ https://bugs.webkit.org/show_bug.cgi?id=210186
+ https://trac.webkit.org/changeset/260245
+
2020-04-17 Per Arne Vollan <pvol...@apple.com>
Unreviewed build fix.
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.cpp (260273 => 260274)
--- trunk/Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.cpp 2020-04-17 19:31:08 UTC (rev 260273)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.cpp 2020-04-17 19:32:41 UTC (rev 260274)
@@ -34,6 +34,10 @@
#include "RemoteVideoSample.h"
#include <wtf/JSONValues.h>
+#if PLATFORM(COCOA)
+#include "ImageTransferSessionVT.h"
+#endif
+
namespace WebCore {
RealtimeVideoCaptureSource::RealtimeVideoCaptureSource(String&& name, String&& id, String&& hashSalt)
@@ -372,7 +376,7 @@
setFrameRate(match->requestedFrameRate);
}
-void RealtimeVideoCaptureSource::dispatchMediaSampleToObservers(MediaSample& sample)
+RefPtr<MediaSample> RealtimeVideoCaptureSource::adaptVideoSample(MediaSample& sample)
{
MediaTime sampleTime = sample.presentationTime();
@@ -386,9 +390,35 @@
if (interval > 1)
m_observedFrameRate = (m_observedFrameTimeStamps.size() / interval);
- videoSampleAvailable(sample);
+ auto mediaSample = makeRefPtr(&sample);
+
+#if PLATFORM(COCOA)
+ auto size = this->size();
+ if (!size.isEmpty() && size != expandedIntSize(sample.presentationSize())) {
+
+ if (!m_imageTransferSession || m_imageTransferSession->pixelFormat() != sample.videoPixelFormat())
+ m_imageTransferSession = ImageTransferSessionVT::create(sample.videoPixelFormat());
+
+ ASSERT(m_imageTransferSession);
+ if (m_imageTransferSession) {
+ mediaSample = m_imageTransferSession->convertMediaSample(sample, size);
+ if (!mediaSample) {
+ ASSERT_NOT_REACHED();
+ return nullptr;
+ }
+ }
+ }
+#endif
+
+ return mediaSample.releaseNonNull();
}
+void RealtimeVideoCaptureSource::dispatchMediaSampleToObservers(MediaSample& sample)
+{
+ if (auto mediaSample = adaptVideoSample(sample))
+ videoSampleAvailable(*mediaSample);
+}
+
void RealtimeVideoCaptureSource::clientUpdatedSizeAndFrameRate(Optional<int> width, Optional<int> height, Optional<double> frameRate)
{
// FIXME: We only change settings if capture resolution is below requested one. We should get the best preset for all clients.
@@ -397,10 +427,9 @@
width = { };
if (height && *height < static_cast<int>(settings.height()))
height = { };
- if (frameRate && *frameRate < static_cast<double>(settings.frameRate()))
- frameRate = { };
- if (!width && !height && !frameRate)
+ // FIXME: handle frameRate potential increase.
+ if (!width && !height)
return;
auto match = bestSupportedSizeAndFrameRate(width, height, frameRate);
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.h (260273 => 260274)
--- trunk/Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.h 2020-04-17 19:31:08 UTC (rev 260273)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.h 2020-04-17 19:32:41 UTC (rev 260274)
@@ -48,8 +48,6 @@
virtual void generatePresets() = 0;
virtual MediaSample::VideoRotation sampleRotation() const { return MediaSample::VideoRotation::None; }
- double observedFrameRate() const { return m_observedFrameRate; }
-
protected:
RealtimeVideoCaptureSource(String&& name, String&& id, String&& hashSalt);
@@ -71,8 +69,11 @@
void setDefaultSize(const IntSize& size) { m_defaultSize = size; }
+ double observedFrameRate() const { return m_observedFrameRate; }
+
void dispatchMediaSampleToObservers(MediaSample&);
const Vector<IntSize>& standardVideoSizes();
+ RefPtr<MediaSample> adaptVideoSample(MediaSample&);
private:
struct CaptureSizeAndFrameRate {
@@ -92,6 +93,9 @@
Deque<double> m_observedFrameTimeStamps;
double m_observedFrameRate { 0 };
IntSize m_defaultSize;
+#if PLATFORM(COCOA)
+ std::unique_ptr<ImageTransferSessionVT> m_imageTransferSession;
+#endif
};
struct SizeAndFrameRate {
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp (260273 => 260274)
--- trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp 2020-04-17 19:31:08 UTC (rev 260273)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp 2020-04-17 19:32:41 UTC (rev 260274)
@@ -28,20 +28,15 @@
#if ENABLE(MEDIA_STREAM)
-#if PLATFORM(COCOA)
-#include "ImageTransferSessionVT.h"
-#endif
-
namespace WebCore {
RealtimeVideoSource::RealtimeVideoSource(Ref<RealtimeVideoCaptureSource>&& source)
- : RealtimeMediaSource(Type::Video, String { source->name() }, String { source->persistentID() }, String { source->deviceIDHashSalt() })
+ : RealtimeVideoCaptureSource(String { source->name() }, String { source->persistentID() }, String { source->deviceIDHashSalt() })
, m_source(WTFMove(source))
{
m_source->addObserver(*this);
m_currentSettings = m_source->settings();
setSize(m_source->size());
- setFrameRate(m_source->frameRate());
}
RealtimeVideoSource::~RealtimeVideoSource()
@@ -147,46 +142,13 @@
});
}
-#if PLATFORM(COCOA)
-RefPtr<MediaSample> RealtimeVideoSource::adaptVideoSample(MediaSample& sample)
-{
- if (!m_imageTransferSession || m_imageTransferSession->pixelFormat() != sample.videoPixelFormat())
- m_imageTransferSession = ImageTransferSessionVT::create(sample.videoPixelFormat());
-
- ASSERT(m_imageTransferSession);
- if (!m_imageTransferSession)
- return nullptr;
-
- auto mediaSample = m_imageTransferSession->convertMediaSample(sample, size());
- ASSERT(mediaSample);
-
- return mediaSample;
-}
-#endif
-
void RealtimeVideoSource::videoSampleAvailable(MediaSample& sample)
{
if (!isProducingData())
return;
- if (m_frameDecimation > 1 && ++m_frameDecimationCounter % m_frameDecimation)
- return;
-
- m_frameDecimation = static_cast<size_t>(m_source->observedFrameRate() / frameRate());
- if (!m_frameDecimation)
- m_frameDecimation = 1;
-
-#if PLATFORM(COCOA)
- auto size = this->size();
- if (!size.isEmpty() && size != expandedIntSize(sample.presentationSize())) {
- if (auto mediaSample = adaptVideoSample(sample)) {
- RealtimeMediaSource::videoSampleAvailable(*mediaSample);
- return;
- }
- }
-#endif
-
- RealtimeMediaSource::videoSampleAvailable(sample);
+ if (auto mediaSample = adaptVideoSample(sample))
+ RealtimeMediaSource::videoSampleAvailable(*mediaSample);
}
Ref<RealtimeMediaSource> RealtimeVideoSource::clone()
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.h (260273 => 260274)
--- trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.h 2020-04-17 19:31:08 UTC (rev 260273)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.h 2020-04-17 19:32:41 UTC (rev 260274)
@@ -31,9 +31,8 @@
namespace WebCore {
-class ImageTransferSessionVT;
-
-class RealtimeVideoSource final : public RealtimeMediaSource, public RealtimeMediaSource::Observer {
+// FIXME: Make RealtimeVideoSource derive from RealtimeMediaSource directly.
+class RealtimeVideoSource final : public RealtimeVideoCaptureSource, public RealtimeMediaSource::Observer {
public:
static Ref<RealtimeVideoSource> create(Ref<RealtimeVideoCaptureSource>&& source) { return adoptRef(*new RealtimeVideoSource(WTFMove(source))); }
@@ -52,6 +51,7 @@
const RealtimeMediaSourceCapabilities& capabilities() final { return m_source->capabilities(); }
const RealtimeMediaSourceSettings& settings() final { return m_currentSettings; }
+ void generatePresets() final { m_source->generatePresets(); }
bool isCaptureSource() const final { return m_source->isCaptureSource(); }
CaptureDevice::DeviceType deviceType() const final { return m_source->deviceType(); }
void monitorOrientation(OrientationNotifier& notifier) final { m_source->monitorOrientation(notifier); }
@@ -64,10 +64,6 @@
bool preventSourceFromStopping() final;
void videoSampleAvailable(MediaSample&) final;
-#if PLATFORM(COCOA)
- RefPtr<MediaSample> adaptVideoSample(MediaSample&);
-#endif
-
#if !RELEASE_LOG_DISABLED
void setLogger(const Logger&, const void*) final;
#endif
@@ -74,11 +70,6 @@
Ref<RealtimeVideoCaptureSource> m_source;
RealtimeMediaSourceSettings m_currentSettings;
-#if PLATFORM(COCOA)
- std::unique_ptr<ImageTransferSessionVT> m_imageTransferSession;
-#endif
- size_t m_frameDecimation { 1 };
- size_t m_frameDecimationCounter { 0 };
#if !RELEASE_LOG_DISABLED
uint64_t m_cloneCounter { 0 };
#endif
Modified: trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp (260273 => 260274)
--- trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp 2020-04-17 19:31:08 UTC (rev 260273)
+++ trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp 2020-04-17 19:32:41 UTC (rev 260274)
@@ -187,13 +187,11 @@
return m_currentSettings.value();
}
-void MockRealtimeVideoSource::setFrameRateWithPreset(double frameRate, RefPtr<VideoPreset> preset)
+void MockRealtimeVideoSource::setFrameRateWithPreset(double, RefPtr<VideoPreset> preset)
{
m_preset = WTFMove(preset);
if (m_preset)
setIntrinsicSize(m_preset->size);
- if (isProducingData())
- m_emitFrameTimer.startRepeating(1_s / frameRate);
}
IntSize MockRealtimeVideoSource::captureSize() const
Modified: trunk/Source/WebCore/testing/Internals.cpp (260273 => 260274)
--- trunk/Source/WebCore/testing/Internals.cpp 2020-04-17 19:31:08 UTC (rev 260273)
+++ trunk/Source/WebCore/testing/Internals.cpp 2020-04-17 19:32:41 UTC (rev 260274)
@@ -5002,14 +5002,6 @@
void Internals::observeMediaStreamTrack(MediaStreamTrack& track)
{
- if (m_trackSource) {
- m_trackSource->removeObserver(*this);
- m_trackSource->removeAudioSampleObserver(*this);
-
- m_trackAudioSampleCount = 0;
- m_trackVideoSampleCount = 0;
- }
-
m_trackSource = &track.source();
m_trackSource->addObserver(*this);
m_trackSource->addAudioSampleObserver(*this);