Bug 803782: Reset found flag before enumerating audio devices; r=jesup
authorAnant Narayanan <anant@kix.in>
Wed, 07 Nov 2012 06:51:38 -0800
changeset 112536 d2f77172baf297445d2206498e1b7c87147ec18b
parent 112535 8f02df2ec9980f99107ab5378592c1e31510b7d9
child 112537 03393060a0704a5bfe95e4a45f4641dabd100943
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersjesup
bugs803782
milestone19.0a1
Bug 803782: Reset found flag before enumerating audio devices; r=jesup
dom/media/MediaManager.cpp
dom/media/tests/crashtests/803782.html
dom/media/tests/crashtests/crashtests.list
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -499,16 +499,18 @@ public:
       if (!found) {
         NS_DispatchToMainThread(new ErrorCallbackRunnable(
           mSuccess, mError, NS_LITERAL_STRING("HARDWARE_UNAVAILABLE"), mWindowID
         ));
         return NS_ERROR_FAILURE;
       }
       LOG(("Selected video device"));
     }
+
+    found = false;
     if (mAudio) {
       nsTArray<nsRefPtr<MediaEngineAudioSource> > audioSources;
       mBackend->EnumerateAudioDevices(&audioSources);
 
       count = audioSources.Length();
       if (count <= 0) {
         NS_DispatchToMainThread(new ErrorCallbackRunnable(
           mSuccess, mError, NS_LITERAL_STRING("NO_DEVICES_FOUND"), mWindowID
new file mode 100644
--- /dev/null
+++ b/dom/media/tests/crashtests/803782.html
@@ -0,0 +1,50 @@
+<html>
+<head>
+    <title></title>
+    <script type="text/javascript">
+    function boom() {
+        function err(e) { if (console) { console.log(err); } }
+        var v0 = mozRTCPeerConnection();
+        var v1 = mozRTCPeerConnection();
+        var v2 = mozRTCPeerConnection();
+        navigator.mozGetUserMedia({audio:true},function(v7) {
+            v2.addStream(v7);
+            navigator.mozGetUserMedia({audio:true, video:true},function(v8) {
+                v1.addStream(v7);
+                v1.createOffer(function(offer) {
+                    v1.setLocalDescription(offer,function() {
+                        v0.setRemoteDescription(offer,function() {
+                            v0.createAnswer(function(answer) {
+                                v0.setLocalDescription(answer,function() {
+                                    v1.setRemoteDescription(answer,function() {
+                                    },function() {})
+                                },err)
+                            },function() { v0.close();v1.close();v2.close();})
+                        },err)
+                    },function() {})
+                },function() {})},function() { v0.close();v1.close();v2.close();});
+        },function() {});
+
+        var v0 = mozRTCPeerConnection();
+        var v1 = mozRTCPeerConnection();
+        var v2 = mozRTCPeerConnection();
+        var v3 = mozRTCPeerConnection();
+        navigator.mozGetUserMedia({audio:true},function(v8) {
+            v3.addStream(v8);
+            v3.createOffer(function(offer) {
+                v2.setLocalDescription(offer,function() {
+                    v3.setRemoteDescription(offer,function() {
+                        v2.createAnswer(function(answer) {
+                            v2.setLocalDescription(answer,function() {
+                                v1.setRemoteDescription(answer,function() {
+                                },function() { v0.close();v1.close();v2.close();v3.close();})
+                            },function() {})
+                        },function() { v0.close();v1.close();v2.close();v3.close();})
+                    },function() {})
+                },err)
+            },err)},err);
+    }
+    </script>
+<body onload="setTimeout(boom, 100)">
+</body>
+</html>
\ No newline at end of file
--- a/dom/media/tests/crashtests/crashtests.list
+++ b/dom/media/tests/crashtests/crashtests.list
@@ -1,4 +1,5 @@
 pref(media.peerconnection.enabled,true) load 780790.html
 pref(media.peerconnection.enabled,true) load 791270.html
 pref(media.peerconnection.enabled,true) load 791278.html
 pref(media.peerconnection.enabled,true) load 791330.html
+pref(media.peerconnection.enabled,true) load 803782.html
\ No newline at end of file