Bug 1502313 - Remove concurrent audio input device limit. r=padenot

The limit only applied within a child process.

However, within a child process we already share cubeb stream when requesting
the same device multiple times, and disallow capturing from more than one device
at a time.

This limit no longer has any effect.

Differential Revision: https://phabricator.services.mozilla.com/D10339

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Pehrson 2018-10-31 14:22:23 +00:00
Родитель 27239988a9
Коммит 16f6336ae3
5 изменённых файлов: 3 добавлений и 48 удалений

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

@ -38,8 +38,6 @@
#define PREF_CUBEB_OUTPUT_DEVICE "media.cubeb.output_device"
#define PREF_CUBEB_LATENCY_PLAYBACK "media.cubeb_latency_playback_ms"
#define PREF_CUBEB_LATENCY_MSG "media.cubeb_latency_msg_frames"
// This only works when audio remoting is active, and pulseaudio is the backend.
#define PREF_CUBEB_MAX_INPUT_STREAMS "media.cubeb_max_input_streams"
// Allows to get something non-default for the preferred sample-rate, to allow
// troubleshooting in the field and testing.
#define PREF_CUBEB_FORCE_SAMPLE_RATE "media.cubeb.force_sample_rate"
@ -131,9 +129,6 @@ cubeb* sCubebContext;
double sVolumeScale = 1.0;
uint32_t sCubebPlaybackLatencyInMilliseconds = 100;
uint32_t sCubebMSGLatencyInFrames = 512;
// Maximum number of audio input streams that can be open at once. This pref is
// only used when remoting is on, and we're using PulseAudio as a backend.
uint32_t sCubebMaxInputStreams = 1;
// If sCubebForcedSampleRate is zero, PreferredSampleRate will return the
// preferred sample-rate for the audio backend in use. Otherwise, it will be
// used as the preferred sample-rate.
@ -238,9 +233,6 @@ void PrefChanged(const char* aPref, void* aClosure)
// We don't want to limit the upper limit too much, so that people can
// experiment.
sCubebMSGLatencyInFrames = std::min<uint32_t>(std::max<uint32_t>(value, 128), 1e6);
} else if (strcmp(aPref, PREF_CUBEB_MAX_INPUT_STREAMS) == 0) {
StaticMutexAutoLock lock(sMutex);
sCubebMaxInputStreams = Preferences::GetUint(aPref);
} else if (strcmp(aPref, PREF_CUBEB_FORCE_SAMPLE_RATE) == 0) {
StaticMutexAutoLock lock(sMutex);
sCubebForcedSampleRate = Preferences::GetUint(aPref);
@ -571,19 +563,12 @@ uint32_t GetCubebMSGLatencyInFrames(cubeb_stream_params * params)
#endif
}
uint32_t GetMaxInputStreams()
{
StaticMutexAutoLock lock(sMutex);
return sCubebMaxInputStreams;
}
static const char* gInitCallbackPrefs[] = {
PREF_VOLUME_SCALE, PREF_CUBEB_OUTPUT_DEVICE,
PREF_CUBEB_LATENCY_PLAYBACK, PREF_CUBEB_LATENCY_MSG,
PREF_CUBEB_BACKEND, PREF_CUBEB_FORCE_NULL_CONTEXT,
PREF_CUBEB_SANDBOX, PREF_AUDIOIPC_POOL_SIZE,
PREF_CUBEB_MAX_INPUT_STREAMS, PREF_AUDIOIPC_STACK_SIZE,
nullptr,
PREF_AUDIOIPC_STACK_SIZE, nullptr,
};
static const char* gCallbackPrefs[] = {
PREF_CUBEB_FORCE_SAMPLE_RATE,

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

@ -50,7 +50,6 @@ void GetDeviceCollection(nsTArray<RefPtr<AudioDeviceInfo>>& aDeviceInfos,
Side aSide);
cubeb_stream_prefs GetDefaultStreamPrefs();
char* GetForcedOutputDevice();
uint32_t GetMaxInputStreams();
#ifdef MOZ_WIDGET_ANDROID
uint32_t AndroidGetAudioOutputSampleRate();

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

@ -422,8 +422,7 @@ function setupEnvironment() {
['media.getusermedia.screensharing.enabled', true],
['media.getusermedia.window.focus_source.enabled', false],
['media.recorder.audio_node.enabled', true],
['media.webaudio.audiocontextoptions-samplerate.enabled', true],
['media.cubeb_max_input_streams', 10000]
['media.webaudio.audiocontextoptions-samplerate.enabled', true]
]
};

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

@ -32,10 +32,6 @@ using namespace webrtc;
#define MAX_CHANNELS 2
#define MAX_SAMPLING_FREQ 48000 // Hz - multiple of 100
#ifdef MOZ_PULSEAUDIO
static uint32_t sInputStreamsOpen = 0;
#endif
namespace mozilla {
#ifdef LOG
@ -656,23 +652,7 @@ MediaEngineWebRTCMicrophoneSource::Start(const RefPtr<const AllocationHandle>&)
return NS_ERROR_FAILURE;
}
// On Linux with PulseAudio, we still only allow a certain number of audio
// input stream in each content process, because of issues related to audio
// remoting and PulseAudio.
#ifdef MOZ_PULSEAUDIO
// When remoting, cubeb reports it's using the "remote" backend instead of the
// backend on the other side of the IPC.
const char* backend = cubeb_get_backend_id(CubebUtils::GetCubebContext());
if (strstr(backend, "remote") &&
sInputStreamsOpen == CubebUtils::GetMaxInputStreams()) {
LOG(("%p Already capturing audio in this process, aborting", this));
return NS_ERROR_FAILURE;
}
sInputStreamsOpen++;
#endif
AssertIsOnOwningThread();
mInputProcessing = new AudioInputProcessing(
mDeviceMaxChannelCount, mStream, mTrackID, mPrincipal);
@ -711,10 +691,7 @@ MediaEngineWebRTCMicrophoneSource::Stop(const RefPtr<const AllocationHandle>&)
return NS_OK;
}
#ifdef MOZ_PULSEAUDIO
MOZ_ASSERT(sInputStreamsOpen > 0);
sInputStreamsOpen--;
#endif
RefPtr<MediaEngineWebRTCMicrophoneSource> that = this;
RefPtr<MediaStreamGraphImpl> gripGraph = mStream->GraphImpl();
NS_DispatchToMainThread(media::NewRunnableFrom(

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

@ -635,11 +635,6 @@ pref("media.audioipc.stack_size", 262144);
pref("media.cubeb.sandbox", false);
#endif
#ifdef XP_LINUX
// Bug 1481152
pref("media.cubeb_max_input_streams", 1);
#endif
#ifdef MOZ_AV1
pref("media.av1.enabled", false);
#endif