зеркало из https://github.com/mozilla/gecko-dev.git
Bug 971528 - Allow stereo capture in AudioCallbackDriver. r=padenot
* * * [mq]: graph-driver-comments MozReview-Commit-ID: JnU3opk8X5K * * * [mq]: tmp MozReview-Commit-ID: 73CtZw4CRG --HG-- extra : rebase_source : bca0932ccffc6348260039fc7ec829245a9b2236
This commit is contained in:
Родитель
0484ed8286
Коммит
e79da75180
|
@ -662,10 +662,19 @@ AudioCallbackDriver::Init()
|
||||||
latency_frames = std::max((uint32_t) 512, latency_frames);
|
latency_frames = std::max((uint32_t) 512, latency_frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
input = output;
|
input = output;
|
||||||
input.channels = mInputChannels; // change to support optional stereo capture
|
input.channels = mInputChannels;
|
||||||
input.layout = CUBEB_LAYOUT_MONO;
|
input.layout = CUBEB_LAYOUT_UNDEFINED;
|
||||||
|
|
||||||
|
#ifdef MOZ_WEBRTC
|
||||||
|
if (mGraphImpl->mInputWanted) {
|
||||||
|
StaticMutexAutoLock lock(AudioInputCubeb::Mutex());
|
||||||
|
uint32_t maxInputChannels = 0;
|
||||||
|
if (AudioInputCubeb::GetDeviceMaxChannels(mGraphImpl->mInputDeviceID, maxInputChannels) == 0) {
|
||||||
|
input.channels = mInputChannels = maxInputChannels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
cubeb_stream* stream = nullptr;
|
cubeb_stream* stream = nullptr;
|
||||||
CubebUtils::AudioDeviceID input_id = nullptr, output_id = nullptr;
|
CubebUtils::AudioDeviceID input_id = nullptr, output_id = nullptr;
|
||||||
|
|
|
@ -212,6 +212,7 @@ public:
|
||||||
aIndex = mDefaultDevice;
|
aIndex = mDefaultDevice;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MOZ_ASSERT(mDeviceIndexes);
|
||||||
if (aIndex < 0 || aIndex >= (int) mDeviceIndexes->Length()) {
|
if (aIndex < 0 || aIndex >= (int) mDeviceIndexes->Length()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -267,6 +268,20 @@ public:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int GetDeviceMaxChannels(int aDeviceIndex, uint32_t& aChannels)
|
||||||
|
{
|
||||||
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
|
aChannels = 1;
|
||||||
|
#else
|
||||||
|
int32_t devindex = DeviceIndex(aDeviceIndex);
|
||||||
|
if (!mDevices || devindex < 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
aChannels = mDevices->device[devindex]->max_channels;
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void StartRecording(SourceMediaStream *aStream, AudioDataListener *aListener)
|
void StartRecording(SourceMediaStream *aStream, AudioDataListener *aListener)
|
||||||
{
|
{
|
||||||
#ifdef MOZ_WIDGET_ANDROID
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
|
|
Загрузка…
Ссылка в новой задаче