Title: [255290] branches/safari-610.1.1-branch/Source/WebCore
- Revision
- 255290
- Author
- [email protected]
- Date
- 2020-01-28 13:49:22 -0800 (Tue, 28 Jan 2020)
Log Message
Cherry-pick r254823. rdar://problem/58692880
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):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254823 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-610.1.1-branch/Source/WebCore/ChangeLog (255289 => 255290)
--- branches/safari-610.1.1-branch/Source/WebCore/ChangeLog 2020-01-28 21:49:19 UTC (rev 255289)
+++ branches/safari-610.1.1-branch/Source/WebCore/ChangeLog 2020-01-28 21:49:22 UTC (rev 255290)
@@ -1,5 +1,58 @@
2020-01-28 Russell Epstein <[email protected]>
+ Cherry-pick r254823. rdar://problem/58692880
+
+ 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):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254823 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 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-28 Russell Epstein <[email protected]>
+
Cherry-pick r254814. rdar://problem/58654047
Video sound sometimes keeps playing in page cache
Modified: branches/safari-610.1.1-branch/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h (255289 => 255290)
--- branches/safari-610.1.1-branch/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h 2020-01-28 21:49:19 UTC (rev 255289)
+++ branches/safari-610.1.1-branch/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h 2020-01-28 21:49:22 UTC (rev 255290)
@@ -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: branches/safari-610.1.1-branch/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm (255289 => 255290)
--- branches/safari-610.1.1-branch/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm 2020-01-28 21:49:19 UTC (rev 255289)
+++ branches/safari-610.1.1-branch/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm 2020-01-28 21:49:22 UTC (rev 255290)
@@ -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