Bug 1250934: Don't reopen input AudioCallbackDrivers on a second use r=padenot

MozReview-Commit-ID: 6Ky8UMyOHJG
This commit is contained in:
Randell Jesup 2016-03-08 12:11:08 -05:00
parent 6cbe994f89
commit 39c683f5b6

View File

@ -980,19 +980,25 @@ MediaStreamGraphImpl::OpenAudioInputImpl(CubebUtils::AudioDeviceID aID,
count++;
mInputDeviceUsers.Put(aListener, count); // creates a new entry in the hash if needed
// aID is a cubeb_devid, and we assume that opaque ptr is valid until
// we close cubeb.
mInputDeviceID = aID;
if (count == 1) { // first open for this listener
// aID is a cubeb_devid, and we assume that opaque ptr is valid until
// we close cubeb.
mInputDeviceID = aID;
mAudioInputs.AppendElement(aListener); // always monitor speaker data
}
// Switch Drivers since we're adding input (to input-only or full-duplex)
MonitorAutoLock mon(mMonitor);
if (mLifecycleState == LIFECYCLE_RUNNING) {
AudioCallbackDriver* driver = new AudioCallbackDriver(this);
driver->SetInputListener(aListener);
CurrentDriver()->SwitchAtNextIteration(driver);
// Switch Drivers since we're adding input (to input-only or full-duplex)
MonitorAutoLock mon(mMonitor);
if (mLifecycleState == LIFECYCLE_RUNNING) {
AudioCallbackDriver* driver = new AudioCallbackDriver(this);
STREAM_LOG(LogLevel::Debug, ("OpenAudioInput: starting new AudioCallbackDriver(input) %p", driver));
LIFECYCLE_LOG("OpenAudioInput: starting new AudioCallbackDriver(input) %p", driver);
driver->SetInputListener(aListener);
CurrentDriver()->SwitchAtNextIteration(driver);
} else {
STREAM_LOG(LogLevel::Error, ("OpenAudioInput in shutdown!"));
LIFECYCLE_LOG("OpenAudioInput in shutdown!");
NS_ASSERTION(false, "Can't open cubeb inputs in shutdown");
}
}
}