Bug 1271585: Remove AudioGUM thread from MediaEngine getUserMedia input r=padenot

MozReview-Commit-ID: EhaMVSq54IK
This commit is contained in:
Randell Jesup 2016-05-12 15:34:11 -04:00
Родитель f7316b6c57
Коммит 505d7dd5ea
3 изменённых файлов: 3 добавлений и 18 удалений

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

@ -127,9 +127,6 @@ MediaEngineWebRTC::MediaEngineWebRTC(MediaEnginePrefs &aPrefs)
#endif
// XXX
gFarendObserver = new AudioOutputObserver();
NS_NewNamedThread("AudioGUM", getter_AddRefs(mThread));
MOZ_ASSERT(mThread);
}
void
@ -410,7 +407,7 @@ MediaEngineWebRTC::EnumerateAudioDevices(dom::MediaSourceEnum aMediaSource,
// XXX Small window where the device list/index could change!
audioinput = new mozilla::AudioInputCubeb(mVoiceEngine, i);
}
aSource = new MediaEngineWebRTCMicrophoneSource(mThread, mVoiceEngine, audioinput,
aSource = new MediaEngineWebRTCMicrophoneSource(mVoiceEngine, audioinput,
i, deviceName, uniqueId);
mAudioSources.Put(uuid, aSource); // Hashtable takes ownership.
aASources->AppendElement(aSource);
@ -451,11 +448,6 @@ MediaEngineWebRTC::Shutdown()
mozilla::camera::Shutdown();
AudioInputCubeb::CleanupGlobalData();
if (mThread) {
mThread->Shutdown();
mThread = nullptr;
}
}
}

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

@ -416,8 +416,7 @@ class MediaEngineWebRTCMicrophoneSource : public MediaEngineAudioSource,
private MediaConstraintsHelper
{
public:
MediaEngineWebRTCMicrophoneSource(nsIThread* aThread,
webrtc::VoiceEngine* aVoiceEnginePtr,
MediaEngineWebRTCMicrophoneSource(webrtc::VoiceEngine* aVoiceEnginePtr,
mozilla::AudioInput* aAudioInput,
int aIndex,
const char* name,
@ -426,7 +425,6 @@ public:
, mVoiceEngine(aVoiceEnginePtr)
, mAudioInput(aAudioInput)
, mMonitor("WebRTCMic.Monitor")
, mThread(aThread)
, mCapIndex(aIndex)
, mChannel(-1)
, mNrAllocations(0)
@ -535,7 +533,6 @@ private:
Monitor mMonitor;
nsTArray<RefPtr<SourceMediaStream>> mSources;
nsTArray<PrincipalHandle> mPrincipalHandles; // Maps to mSources.
nsCOMPtr<nsIThread> mThread;
int mCapIndex;
int mChannel;
int mNrAllocations; // When this becomes 0, we shut down HW

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

@ -730,11 +730,7 @@ MediaEngineWebRTCMicrophoneSource::Process(int channel,
// This is safe from any thread, and is safe if the track is Finished
// or Destroyed.
// Note: due to evil magic, the nsAutoPtr<AudioSegment>'s ownership transfers to
// the Runnable (AutoPtr<> = AutoPtr<>)
RUN_ON_THREAD(mThread, WrapRunnable(mSources[i], &SourceMediaStream::AppendToTrack,
mTrackID, segment, (AudioSegment *) nullptr),
NS_DISPATCH_NORMAL);
mSources[i]->AppendToTrack(mTrackID, segment);
}
}