Bug 971830 - Utilize getAudioTracks() for naming remote streams. r=whimboo
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Tue, 18 Feb 2014 09:47:54 -0500
changeset 169360 7173c66302c343a51d333b97cb1fc3a59004fba7
parent 169359 3cfe63cb3de2c9ad6edd07e94fcd2024f952f1cc
child 169361 ecd5c56ed519c8698bf83de67a3cdadf0e7cb25c
push id26245
push userryanvm@gmail.com
push dateTue, 18 Feb 2014 20:18:17 +0000
treeherdermozilla-central@9019cc90719c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhimboo
bugs971830
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 971830 - Utilize getAudioTracks() for naming remote streams. r=whimboo
dom/media/tests/mochitest/pc.js
--- a/dom/media/tests/mochitest/pc.js
+++ b/dom/media/tests/mochitest/pc.js
@@ -1096,20 +1096,26 @@ function PeerConnectionWrapper(label, co
 
   /**
    * Callback for native peer connection 'onaddstream' events.
    *
    * @param {Object} event
    *        Event data which includes the stream to be added
    */
   this._pc.onaddstream = function (event) {
-    info(self + ": 'onaddstream' event fired for " + event.stream);
+    info(self + ": 'onaddstream' event fired for " + JSON.stringify(event.stream));
 
-    // TODO: Bug 834835 - Assume type is video until we get get{Audio,Video}Tracks.
-    self.attachMedia(event.stream, 'video', 'remote');
+    var type = '';
+    if (event.stream.getAudioTracks().length > 0) {
+      type = 'audio';
+    }
+    if (event.stream.getVideoTracks().length > 0) {
+      type += 'video';
+    }
+    self.attachMedia(event.stream, type, 'remote');
    };
 
   /**
    * Callback for native peer connection 'ondatachannel' events. If no custom handler
    * has been specified via 'this.ondatachannel', a failure will be raised if an
    * event of this type gets caught.
    *
    * @param {Object} event