Bug 1219711 - Let fake stream take precedence in testing. r=jib

TL;DR requesting a fake stream always gives you a fake stream. No magic.

The gUMConstraint `fake: true` should take precedence and if set always
use MediaEngineDefault.
If it is set the state of `faketracks` is passed
on to MediaEngineDefault.
If it is not set, but (any of) audio/video loopback devices are set, the
device enumeration will filter out only those.
This commit is contained in:
Andreas Pehrson 2015-11-09 23:17:42 +08:00
parent c9661d9a29
commit 6c7833bebf
2 changed files with 14 additions and 17 deletions

View File

@ -1415,25 +1415,22 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId,
RefPtr<PledgeSourceSet> p = new PledgeSourceSet();
uint32_t id = mOutstandingPledges.Append(*p);
// Check if the preference for using audio/video loopback devices is
// enabled. This is currently used for automated media tests only.
//
// If present (and we're doing non-exotic cameras and microphones) use them
// instead of our built-in fake devices, except if fake tracks are requested
// (a feature of the built-in ones only).
nsAdoptingCString audioLoopDev, videoLoopDev;
if (!aFakeTracks) {
if (aVideoType == dom::MediaSourceEnum::Camera) {
audioLoopDev = Preferences::GetCString("media.audio_loopback_dev");
if (!aFake) {
// Fake stream not requested. The entire device stack is available.
// Loop in loopback devices if they are set, and their respective type is
// requested. This is currently used for automated media tests only.
if (aVideoType == MediaSourceEnum::Camera) {
videoLoopDev = Preferences::GetCString("media.video_loopback_dev");
if (aFake && !audioLoopDev.IsEmpty() && !videoLoopDev.IsEmpty()) {
aFake = false;
}
} else {
aFake = false;
}
if (aAudioType == MediaSourceEnum::Microphone) {
audioLoopDev = Preferences::GetCString("media.audio_loopback_dev");
}
}
if (!aFake) {
// Fake tracks only make sense when we have a fake stream.
aFakeTracks = false;
}
MediaManager::PostTask(FROM_HERE, NewTaskFrom([id, aWindowId, audioLoopDev,

View File

@ -59,7 +59,7 @@
var playback = new LocalMediaStreamPlayback(testVideo, stream);
return playback.playMediaWithDeprecatedStreamStop(false);
})
.then(() => getUserMedia({video: videoConstraints[0]}))
.then(() => getUserMedia({video: videoConstraints[0], fake: false}))
.then(stream => {
var playback = new LocalMediaStreamPlayback(testVideo, stream);
playback.startMedia(false);