-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pausing MediaRecorder still continues to call ondataavailable at ever…
…y timeslice event https://bugs.webkit.org/show_bug.cgi?id=261964 rdar://115979604 Reviewed by Eric Carlson. Before the patch, we were firing dataavailable events with zero data in case recorder is using timeSlice but is paused. We are now stopping the timer to stop fetching data when pausing. When resuming, we restart the timer with the delay left at pause time. * LayoutTests/http/wpt/mediarecorder/pause-recording-timeSlice-expected.txt: Added. * LayoutTests/http/wpt/mediarecorder/pause-recording-timeSlice.html: Added. * Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::requestData): (WebCore::MediaRecorder::pauseRecording): (WebCore::MediaRecorder::resumeRecording): * Source/WebCore/Modules/mediarecorder/MediaRecorder.h: Canonical link: https://commits.webkit.org/268433@main
- Loading branch information
Showing
4 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
LayoutTests/http/wpt/mediarecorder/pause-recording-timeSlice-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
PASS Pausing and resuming the recording should pause dataavailable event | ||
|
40 changes: 40 additions & 0 deletions
40
LayoutTests/http/wpt/mediarecorder/pause-recording-timeSlice.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
function waitFor(duration) | ||
{ | ||
return new Promise((resolve) => setTimeout(resolve, duration)); | ||
} | ||
|
||
promise_test(async (test) => { | ||
const stream = await navigator.mediaDevices.getUserMedia({ audio: true, video: true }); | ||
|
||
const recorder = new MediaRecorder(stream); | ||
|
||
let counter = 0; | ||
recorder.ondataavailable = (e) => { counter++; } | ||
|
||
const startPromise = new Promise(resolve => recorder.onstart = resolve); | ||
recorder.start(100); | ||
await startPromise; | ||
|
||
setTimeout(() => recorder.pause(), 50); | ||
setTimeout(() => recorder.resume(), 1550); | ||
|
||
await waitFor(500); | ||
const pausedCounter = counter; | ||
|
||
await waitFor(500); | ||
assert_equals(counter, pausedCounter); | ||
|
||
return new Promise(resolve => recorder.ondataavailable = resolve); | ||
}, "Pausing and resuming the recording should pause dataavailable event"); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters