Bug 1221587: Block attempts to open two mics at once until supported in full-duplex r=jib

--HG--
extra : commitid : IJIrw15vmjA
This commit is contained in:
Randell Jesup 2016-01-21 11:51:36 -05:00
Родитель f41ad034e5
Коммит 52bdab9d2f
2 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -45,6 +45,7 @@ GetUserMediaLog()
namespace mozilla {
cubeb_device_collection* AudioInputCubeb::mDevices = nullptr;
bool AudioInputCubeb::mAnyInUse = false;
MediaEngineWebRTC::MediaEngineWebRTC(MediaEnginePrefs &aPrefs)
: mMutex("mozilla::MediaEngineWebRTC"),

Просмотреть файл

@ -159,7 +159,7 @@ class AudioInputCubeb final : public AudioInput
{
public:
explicit AudioInputCubeb(webrtc::VoiceEngine* aVoiceEngine) :
AudioInput(aVoiceEngine), mSelectedDevice(0)
AudioInput(aVoiceEngine), mSelectedDevice(0), mInUse(false)
{
// Force calculation of the indexes. We could keep them global
// too... cleanup would be annoying
@ -242,11 +242,15 @@ public:
ptrVoERender->SetExternalRecordingStatus(true);
}
aGraph->OpenAudioInput(mDevices->device[mSelectedDevice]->devid, aListener);
mInUse = true;
mAnyInUse = true;
}
void StopRecording(MediaStreamGraph *aGraph, AudioDataListener *aListener)
{
aGraph->CloseAudioInput(aListener);
mInUse = false;
mAnyInUse = false;
}
int SetRecordingDevice(int aIndex)
@ -260,12 +264,16 @@ public:
}
protected:
~AudioInputCubeb() {}
~AudioInputCubeb() {
MOZ_RELEASE_ASSERT(!mInUse);
}
private:
nsTArray<int> mDeviceIndexes;
int mSelectedDevice;
static cubeb_device_collection *mDevices;
bool mInUse; // for assertions about listener lifetime
static bool mAnyInUse;
};
class AudioInputWebRTC final : public AudioInput