Bug 1447982 - Rename mLastPrefs to mNetPrefs and update comment for clarity. r?padenot
MozReview-Commit-ID: CJPSDG5OHBs
--- a/dom/media/webrtc/MediaEngineWebRTC.h
+++ b/dom/media/webrtc/MediaEngineWebRTC.h
@@ -599,19 +599,21 @@ private:
uint64_t mLastLogFrames;
// 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.
// This is read and written to only on the MSG thread.
bool mSkipProcessing;
- // To only update microphone when needed, we keep track of previous settings.
+ // To only update microphone when needed, we keep track of the prefs
+ // representing the currently applied settings for this source. This is the
+ // net result of the prefs across all allocations.
// Owning thread only.
- MediaEnginePrefs mLastPrefs;
+ MediaEnginePrefs mNetPrefs;
// Stores the mixed audio output for the reverse-stream of the AEC.
AlignedFloatBuffer mOutputBuffer;
AlignedFloatBuffer mInputBuffer;
AlignedFloatBuffer mDeinterleavedBuffer;
AlignedFloatBuffer mInputDownmixBuffer;
};
--- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
@@ -245,17 +245,17 @@ MediaEngineWebRTCMicrophoneSource::Recon
LOG(("Mic source %p Reconfigure() failed unexpectedly. rv=%s",
this, name.Data()));
Stop(aHandle);
return NS_ERROR_UNEXPECTED;
}
size_t i = mAllocations.IndexOf(aHandle, 0, AllocationHandleComparator());
MOZ_DIAGNOSTIC_ASSERT(i != mAllocations.NoIndex);
- ApplySettings(mLastPrefs, mAllocations[i].mStream->GraphImpl());
+ ApplySettings(mNetPrefs, mAllocations[i].mStream->GraphImpl());
return NS_OK;
}
bool operator == (const MediaEnginePrefs& a, const MediaEnginePrefs& b)
{
return !memcmp(&a, &b, sizeof(MediaEnginePrefs));
};
@@ -466,34 +466,34 @@ MediaEngineWebRTCMicrophoneSource::Updat
mAudioInput->GetChannelCount(channelCount);
MOZ_ASSERT(channelCount > 0);
prefs.mChannels = channelCount;
}
break;
case kStarted:
case kStopped:
- if (prefs.mChannels != mLastPrefs.mChannels) {
+ if (prefs.mChannels != mNetPrefs.mChannels) {
// If the channel count changed, tell the MSG to open a new driver with
// the correct channel count.
MOZ_ASSERT(!mAllocations.IsEmpty());
RefPtr<SourceMediaStream> stream;
for (const Allocation& allocation : mAllocations) {
if (allocation.mStream && allocation.mStream->GraphImpl()) {
stream = allocation.mStream;
break;
}
}
MOZ_ASSERT(stream);
mAudioInput->SetUserChannelCount(prefs.mChannels);
// Get validated number of channel
uint32_t channelCount = 0;
mAudioInput->GetChannelCount(channelCount);
- MOZ_ASSERT(channelCount > 0 && mLastPrefs.mChannels > 0);
+ MOZ_ASSERT(channelCount > 0 && mNetPrefs.mChannels > 0);
if (!stream->OpenNewAudioCallbackDriver(mListener)) {
MOZ_LOG(GetMediaManagerLog(), LogLevel::Error, ("Could not open a new AudioCallbackDriver for input"));
return NS_ERROR_FAILURE;
}
}
break;
default:
@@ -514,17 +514,17 @@ MediaEngineWebRTCMicrophoneSource::Updat
UpdateNSSettingsIfNeeded(prefs.mNoiseOn, static_cast<NsModes>(prefs.mNoise));
UpdateAECSettingsIfNeeded(prefs.mAecOn, static_cast<EcModes>(prefs.mAec));
webrtc::Config config;
config.Set<webrtc::ExtendedFilter>(new webrtc::ExtendedFilter(mExtendedFilter));
config.Set<webrtc::DelayAgnostic>(new webrtc::DelayAgnostic(mDelayAgnostic));
mAudioProcessing->SetExtraOptions(config);
}
- mLastPrefs = prefs;
+ mNetPrefs = prefs;
return NS_OK;
}
#undef HANDLE_APM_ERROR
void
MediaEngineWebRTCMicrophoneSource::ApplySettings(const MediaEnginePrefs& aPrefs,
RefPtr<MediaStreamGraphImpl> aGraph)