Title: [254823] trunk/Source/WebCore
- Revision
- 254823
- Author
- [email protected]
- Date
- 2020-01-20 07:07:40 -0800 (Mon, 20 Jan 2020)
Log Message
REGRESSION: ( r254256 ) [ Mojave wk2 ] http/wpt/mediarecorder/MediaRecorder-AV-audio-video-dataavailable-gpuprocess.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=206437
<rdar://problem/58692880>
Reviewed by Eric Carlson.
Hypothesis from flakiness is that, in GPUProcess, the call to stopRecording is not synchronously followed by a call to fetchData.
If too much time happened between the two calls, stopRecording will trigger setting m_isStopped and m_hasStartedWriting to false.
Any further call to fetchData will then fail.
To circumvent this issue, we add a flag m_isStopping.
If we are stopping, the completionHandler to fetchData call is delayed until stopRecording is fully finished.
When stopping will be finished, the completionHandler will send back the data.
This also allows to read the file in a background thread.
No new tests, this should unflake the flaky test.
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
(WebCore::MediaRecorderPrivateWriter::stopRecording):
(WebCore::MediaRecorderPrivateWriter::fetchData):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (254822 => 254823)
--- trunk/Source/WebCore/ChangeLog 2020-01-20 14:46:32 UTC (rev 254822)
+++ trunk/Source/WebCore/ChangeLog 2020-01-20 15:07:40 UTC (rev 254823)
@@ -1,3 +1,27 @@
+2020-01-20 youenn fablet <[email protected]>
+
+ REGRESSION: ( r254256 ) [ Mojave wk2 ] http/wpt/mediarecorder/MediaRecorder-AV-audio-video-dataavailable-gpuprocess.html is a flaky failure
+ https://bugs.webkit.org/show_bug.cgi?id=206437
+ <rdar://problem/58692880>
+
+ Reviewed by Eric Carlson.
+
+ Hypothesis from flakiness is that, in GPUProcess, the call to stopRecording is not synchronously followed by a call to fetchData.
+ If too much time happened between the two calls, stopRecording will trigger setting m_isStopped and m_hasStartedWriting to false.
+ Any further call to fetchData will then fail.
+
+ To circumvent this issue, we add a flag m_isStopping.
+ If we are stopping, the completionHandler to fetchData call is delayed until stopRecording is fully finished.
+ When stopping will be finished, the completionHandler will send back the data.
+ This also allows to read the file in a background thread.
+
+ No new tests, this should unflake the flaky test.
+
+ * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
+ * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
+ (WebCore::MediaRecorderPrivateWriter::stopRecording):
+ (WebCore::MediaRecorderPrivateWriter::fetchData):
+
2020-01-20 Rob Buis <[email protected]>
Implement "create a potential-CORS request"
Modified: trunk/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h (254822 => 254823)
--- trunk/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h 2020-01-20 14:46:32 UTC (rev 254822)
+++ trunk/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h 2020-01-20 15:07:40 UTC (rev 254823)
@@ -27,6 +27,7 @@
#if ENABLE(MEDIA_STREAM)
#include "SharedBuffer.h"
+#include <wtf/CompletionHandler.h>
#include <wtf/Deque.h>
#include <wtf/Lock.h>
#include <wtf/RetainPtr.h>
@@ -84,6 +85,10 @@
dispatch_queue_t m_videoPullQueue;
Deque<RetainPtr<CMSampleBufferRef>> m_videoBufferPool;
Deque<RetainPtr<CMSampleBufferRef>> m_audioBufferPool;
+
+ bool m_isStopping { false };
+ RefPtr<SharedBuffer> m_data;
+ CompletionHandler<void(RefPtr<SharedBuffer>&&)> m_fetchDataCompletionHandler;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm (254822 => 254823)
--- trunk/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm 2020-01-20 14:46:32 UTC (rev 254822)
+++ trunk/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm 2020-01-20 15:07:40 UTC (rev 254823)
@@ -151,6 +151,10 @@
}
if (m_writer)
m_writer.clear();
+
+ m_data = nullptr;
+ if (auto completionHandler = WTFMove(m_fetchDataCompletionHandler))
+ completionHandler(nullptr);
}
bool MediaRecorderPrivateWriter::setVideoInput(int width, int height)
@@ -355,16 +359,24 @@
if (m_audioInput)
m_finishWritingAudioSemaphore.wait();
+ m_isStopping = true;
[m_writer finishWritingWithCompletionHandler:[this, weakPtr = makeWeakPtr(*this)]() mutable {
- m_finishWritingSemaphore.signal();
- callOnMainThread([this, weakPtr = WTFMove(weakPtr)] {
+ callOnMainThread([this, weakPtr = WTFMove(weakPtr), buffer = SharedBuffer::createWithContentsOfFile(m_path)]() mutable {
if (!weakPtr)
return;
+
+ m_isStopping = false;
+ if (m_fetchDataCompletionHandler)
+ m_fetchDataCompletionHandler(WTFMove(buffer));
+ else
+ m_data = WTFMove(buffer);
+
m_isStopped = false;
m_hasStartedWriting = false;
m_isFirstAudioSample = true;
clear();
});
+ m_finishWritingSemaphore.signal();
}];
m_finishWritingSemaphore.wait();
}
@@ -371,11 +383,13 @@
void MediaRecorderPrivateWriter::fetchData(CompletionHandler<void(RefPtr<SharedBuffer>&&)>&& completionHandler)
{
- if ((m_path.isEmpty() && !m_isStopped) || !m_hasStartedWriting)
- return completionHandler(nullptr);
+ if (m_isStopping) {
+ m_fetchDataCompletionHandler = WTFMove(completionHandler);
+ return;
+ }
- // FIXME: We should read in a background thread.
- completionHandler(SharedBuffer::createWithContentsOfFile(m_path));
+ auto buffer = WTFMove(m_data);
+ completionHandler(WTFMove(buffer));
}
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes