Bug 1397793 - Allow switching processing on/off dynamically. r=pehrsons

MozReview-Commit-ID: G0NJRkKEVeM

--HG--
extra : rebase_source : 0574254dfbfa0965ed4d1c8a07c9f535c390d8a1
extra : source : d12894d7777055463b68b8d9ea7e3d6c0940b4aa
This commit is contained in:
Paul Adenot 2017-11-23 15:53:25 +01:00
Родитель 14fb321adc
Коммит d4aeb652b5
2 изменённых файлов: 6 добавлений и 8 удалений

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

@ -508,12 +508,12 @@ private:
RefPtr<mozilla::AudioInput> mAudioInput;
RefPtr<WebRTCAudioDataListener> mListener;
RefPtr<AudioOutputObserver> mAudioOutputObserver;
// Note: shared across all microphone sources
static int sChannelsOpen;
const UniquePtr<webrtc::AudioProcessing> mAudioProcessing;
const RefPtr<AudioOutputObserver> mAudioOutputObserver;
// accessed from the GraphDriver thread except for deletion
nsAutoPtr<AudioPacketizer<AudioDataValue, float>> mPacketizer;
@ -543,7 +543,7 @@ private:
// mSkipProcessing is true if none of the processing passes are enabled,
// because of prefs or constraints. This allows simply copying the audio into
// the MSG, skipping resampling and the whole webrtc.org code.
bool mSkipProcessing;
std::atomic_bool mSkipProcessing;
// To only update microphone when needed, we keep track of previous settings.
MediaEnginePrefs mLastPrefs;

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

@ -588,7 +588,7 @@ MediaEngineWebRTCMicrophoneSource::Start(SourceMediaStream *aStream,
if (mSampleFrequency == MediaEngine::USE_GRAPH_RATE) {
mSampleFrequency = aStream->GraphRate();
}
aStream->AddAudioTrack(aID, mSampleFrequency, 0, segment, SourceMediaStream::ADDTRACK_QUEUED);
aStream->AddAudioTrack(aID, aStream->GraphRate(), 0, segment, SourceMediaStream::ADDTRACK_QUEUED);
// XXX Make this based on the pref.
aStream->RegisterForAudioMixing();
@ -609,9 +609,7 @@ MediaEngineWebRTCMicrophoneSource::Start(SourceMediaStream *aStream,
// Make sure logger starts before capture
AsyncLatencyLogger::Get(true);
if (mAudioOutputObserver) {
mAudioOutputObserver->Clear();
}
mAudioOutputObserver->Clear();
mAudioInput->StartRecording(aStream, mListener);
@ -675,7 +673,7 @@ MediaEngineWebRTCMicrophoneSource::NotifyOutputData(MediaStreamGraph* aGraph,
TrackRate aRate,
uint32_t aChannels)
{
if (mAudioOutputObserver) {
if (!PassThrough()) {
mAudioOutputObserver->InsertFarEnd(aBuffer, aFrames, false,
aRate, aChannels);
}
@ -714,7 +712,7 @@ MediaEngineWebRTCMicrophoneSource::PacketizeAndProcess(MediaStreamGraph* aGraph,
while (mAudioOutputObserver->Size() > 0) {
// Bug 1414837: This will call `free()`, and we should remove it.
// Pop gives ownership.
UniquePtr<FarEndAudioChunk> buffer(mAudioOutputObserver->Pop()); // only call if size() > 0
nsAutoPtr<FarEndAudioChunk> buffer(mAudioOutputObserver->Pop()); // only call if size() > 0
if (!buffer) {
continue;
}