Title: [253317] branches/safari-608-branch/Tools/TestWebKitAPI

Diff

Modified: branches/safari-608-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (253316 => 253317)


--- branches/safari-608-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2019-12-10 02:10:00 UTC (rev 253316)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2019-12-10 02:39:30 UTC (rev 253317)
@@ -38,6 +38,7 @@
 		07492B3B1DF8B14C00633DE1 /* EnumerateMediaDevices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07492B3A1DF8AE2D00633DE1 /* EnumerateMediaDevices.cpp */; };
 		07492B3C1DF8B86600633DE1 /* enumerateMediaDevices.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 07492B391DF8ADA400633DE1 /* enumerateMediaDevices.html */; };
 		074994421EA5034B000DA44E /* getUserMedia.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 4A410F4D19AF7BEF002EBAB5 /* getUserMedia.html */; };
+		41661C662355E85E00D33C27 /* getUserMedia-webaudio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 41661C652355D98B00D33C27 /* getUserMedia-webaudio.html */; };
 		074994421EA5034B000DA44F /* ondevicechange.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 4A410F4D19AF7BEF002EBAB6 /* ondevicechange.html */; };
 		074994421EA5034B000DA45E /* getUserMediaAudioVideoCapture.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 4A410F4D19AF7BEF002EBAC5 /* getUserMediaAudioVideoCapture.html */; };
 		076E507F1F4513D6006E9F5A /* Logging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 076E507E1F45031E006E9F5A /* Logging.cpp */; };
@@ -1720,6 +1721,7 @@
 		46E816F71E79E29100375ADC /* RestoreStateAfterTermination.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RestoreStateAfterTermination.mm; sourceTree = "<group>"; };
 		4A410F4B19AF7BD6002EBAB5 /* UserMedia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMedia.cpp; sourceTree = "<group>"; };
 		4A410F4D19AF7BEF002EBAB5 /* getUserMedia.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = getUserMedia.html; sourceTree = "<group>"; };
+		41661C652355D98B00D33C27 /* getUserMedia-webaudio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = getUserMedia-webaudio.html; sourceTree = "<group>"; };
 		4A410F4D19AF7BEF002EBAB6 /* ondevicechange.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = ondevicechange.html; sourceTree = "<group>"; };
 		4A410F4D19AF7BEF002EBAC5 /* getUserMediaAudioVideoCapture.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = getUserMediaAudioVideoCapture.html; sourceTree = "<group>"; };
 		4BB4160116815B2600824238 /* JSWrapperForNodeInWebFrame.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JSWrapperForNodeInWebFrame.mm; sourceTree = "<group>"; };

Added: branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKit/getUserMedia-webaudio.html (0 => 253317)


--- branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKit/getUserMedia-webaudio.html	                        (rev 0)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKit/getUserMedia-webaudio.html	2019-12-10 02:39:30 UTC (rev 253317)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script>
+async function capture()
+{
+    try {
+        const stream = await navigator.mediaDevices.getUserMedia({ audio: true, video: false });
+        internals.setMockAudioTrackChannelNumber(stream.getAudioTracks()[0], 2);
+
+        var audioContext = new webkitAudioContext();
+        var analyzer = audioContext.createAnalyser();
+        analyzer.fftSize = 256;
+        let source = audioContext.createMediaStreamSource(stream);
+        source.connect(analyzer);
+        analyzer.connect(audioContext.destination);
+
+        for (let cptr = 0; cptr < 1000; cptr++) {
+          internals.setMockAudioTrackChannelNumber(stream.getAudioTracks()[0], (cptr % 2) ? 1 : 2);
+          await new Promise(resolve => setTimeout(resolve, 20));
+        }
+
+        source.disconnect(analyzer);
+        analyzer.disconnect(audioContext.destination);
+
+        window.webkit.messageHandlers.gum.postMessage("PASS");
+    } catch (e) {
+        window.webkit.messageHandlers.gum.postMessage("FAIL: " + e);
+    }
+}
+        </script>
+    <head>
+
+    <body _onload_="capture()">
+    </body>
+</html>

Modified: branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKit/getUserMedia.html (253316 => 253317)


--- branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKit/getUserMedia.html	2019-12-10 02:10:00 UTC (rev 253316)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKit/getUserMedia.html	2019-12-10 02:39:30 UTC (rev 253317)
@@ -50,6 +50,38 @@
                 navigator.mediaDevices.getUserMedia({audio: true});
                 navigator.mediaDevices.getUserMedia({audio: true, video: true});
             }
+
+            function captureAudio()
+            {
+                navigator.mediaDevices.getUserMedia({audio: true}).then(s => stream = s);
+            }
+
+            function captureAudioAndVideo()
+            {
+                navigator.mediaDevices.getUserMedia({audio: true, video: true}).then(s => stream = s);
+            }
+
+            function notifyEndedEvent()
+            {
+                if (!stream || !stream.getVideoTracks().length) {
+                    window.webkit.messageHandlers.gum.postMessage("No stream or video track");
+                    return;
+                }
+                
+                let waitForEndedEvent = true;
+                stream.getVideoTracks()[0]._onended_ = () => {
+                    if (!waitForEndedEvent)
+                        return;
+                    waitForEndedEvent = false;
+                    window.webkit.messageHandlers.gum.postMessage("PASS");
+                }
+                setTimeout(() => {
+                    if (!waitForEndedEvent)
+                       return;
+                    waitForEndedEvent = false;
+                    window.webkit.messageHandlers.gum.postMessage("Did not receive an ended event after 5 seconds");
+                }, 5000);
+            }
         </script>
     <head>
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to