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:
Alex Chronopoulos 2017-04-27 10:24:25 +03:00
Родитель 0484ed8286
Коммит e79da75180
2 изменённых файлов: 27 добавлений и 3 удалений

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

@ -662,10 +662,19 @@ AudioCallbackDriver::Init()
latency_frames = std::max((uint32_t) 512, latency_frames);
}
input = output;
input.channels = mInputChannels; // change to support optional stereo capture
input.layout = CUBEB_LAYOUT_MONO;
input.channels = mInputChannels;
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;
CubebUtils::AudioDeviceID input_id = nullptr, output_id = nullptr;

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

@ -212,6 +212,7 @@ public:
aIndex = mDefaultDevice;
}
}
MOZ_ASSERT(mDeviceIndexes);
if (aIndex < 0 || aIndex >= (int) mDeviceIndexes->Length()) {
return -1;
}
@ -267,6 +268,20 @@ public:
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)
{
#ifdef MOZ_WIDGET_ANDROID