Bug 1221587: Update for API changes in cubeb r=padenot

--HG--
extra : commitid : C4GE8epQXOe
This commit is contained in:
Randell Jesup 2016-01-21 11:51:36 -05:00
Родитель 5a17e5fbbe
Коммит a853e094df
8 изменённых файлов: 22 добавлений и 15 удалений

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

@ -364,7 +364,8 @@ AudioStream::OpenCubeb(cubeb_stream_params &aParams)
{
cubeb_stream* stream;
if (cubeb_stream_init(cubebContext, &stream, "AudioStream", nullptr, &aParams,
if (cubeb_stream_init(cubebContext, &stream, "AudioStream",
nullptr, nullptr, nullptr, &aParams,
latency, DataCallback_S, StateCallback_S, this) == CUBEB_OK) {
MonitorAutoLock mon(mMonitor);
MOZ_ASSERT(mState != SHUTDOWN);

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

@ -308,7 +308,9 @@ protected:
private:
nsresult OpenCubeb(cubeb_stream_params &aParams);
static long DataCallback_S(cubeb_stream*, void* aThis, void* /* aInputBuffer */, void* aOutputBuffer, long aFrames)
static long DataCallback_S(cubeb_stream*, void* aThis,
const void* /* aInputBuffer */, void* aOutputBuffer,
long aFrames)
{
return static_cast<AudioStream*>(aThis)->DataCallback(aOutputBuffer, aFrames);
}

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

@ -575,7 +575,6 @@ AudioCallbackDriver::Init()
MOZ_ASSERT(!NS_IsMainThread(),
"This is blocking and should never run on the main thread.");
output.devid = mGraphImpl->mOutputDeviceID;
mSampleRate = output.rate = CubebUtils::PreferredSampleRate();
#if defined(__ANDROID__)
@ -606,7 +605,6 @@ AudioCallbackDriver::Init()
input = output;
input.channels = 1; // change to support optional stereo capture
input.devid = mGraphImpl->mInputDeviceID;
cubeb_stream* stream;
// XXX Only pass input input if we have an input listener. Always
@ -614,7 +612,9 @@ AudioCallbackDriver::Init()
// XXX Add support for adding/removing an input listener later.
if (cubeb_stream_init(CubebUtils::GetCubebContext(), &stream,
"AudioCallbackDriver",
mGraphImpl->mInputDeviceID,
mGraphImpl->mInputWanted ? &input : nullptr,
mGraphImpl->mOutputDeviceID,
mGraphImpl->mOutputWanted ? &output : nullptr, latency,
DataCallback_s, StateCallback_s, this) == CUBEB_OK) {
mAudioStream.own(stream);
@ -744,11 +744,13 @@ AudioCallbackDriver::WakeUp()
/* static */ long
AudioCallbackDriver::DataCallback_s(cubeb_stream* aStream,
void* aUser, void* aInputBuffer, void* aOutputBuffer,
void* aUser,
const void* aInputBuffer,
void* aOutputBuffer,
long aFrames)
{
AudioCallbackDriver* driver = reinterpret_cast<AudioCallbackDriver*>(aUser);
return driver->DataCallback(static_cast<AudioDataValue*>(aInputBuffer),
return driver->DataCallback(static_cast<const AudioDataValue*>(aInputBuffer),
static_cast<AudioDataValue*>(aOutputBuffer), aFrames);
}
@ -816,7 +818,7 @@ AudioCallbackDriver::OSXDeviceSwitchingWorkaround()
#endif // XP_MACOSX
long
AudioCallbackDriver::DataCallback(AudioDataValue* aInputBuffer,
AudioCallbackDriver::DataCallback(const AudioDataValue* aInputBuffer,
AudioDataValue* aOutputBuffer, long aFrames)
{
bool stillProcessing;

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

@ -392,7 +392,9 @@ public:
/* Static wrapper function cubeb calls back. */
static long DataCallback_s(cubeb_stream * aStream,
void * aUser, void * aInputBuffer, void * aOutputBuffer,
void * aUser,
const void * aInputBuffer,
void * aOutputBuffer,
long aFrames);
static void StateCallback_s(cubeb_stream* aStream, void * aUser,
cubeb_state aState);
@ -402,7 +404,7 @@ public:
* audio. If the return value is exactly aFrames, this function will get
* called again. If it is less than aFrames, the stream will go in draining
* mode, and this function will not be called again. */
long DataCallback(AudioDataValue* aInputBuffer, AudioDataValue* aOutputBuffer, long aFrames);
long DataCallback(const AudioDataValue* aInputBuffer, AudioDataValue* aOutputBuffer, long aFrames);
/* This function is called by the underlying audio backend, but is only used
* for informational purposes at the moment. */
void StateCallback(cubeb_state aState);

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

@ -203,7 +203,7 @@ public:
* guaranteed to be in any particular size chunks.
*/
virtual void NotifyInputData(MediaStreamGraph* aGraph,
AudioDataValue* aBuffer, size_t aFrames,
const AudioDataValue* aBuffer, size_t aFrames,
uint32_t aChannels) = 0;
};

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

@ -149,7 +149,7 @@ public:
uint32_t aChannels) override
{}
void NotifyInputData(MediaStreamGraph* aGraph,
AudioDataValue* aBuffer, size_t aFrames,
const AudioDataValue* aBuffer, size_t aFrames,
uint32_t aChannels) override
{}
bool IsFake() override {

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

@ -104,7 +104,7 @@ public:
uint32_t aChannels) override
{}
void NotifyInputData(MediaStreamGraph* aGraph,
AudioDataValue* aBuffer, size_t aFrames,
const AudioDataValue* aBuffer, size_t aFrames,
uint32_t aChannels) override
{}
void NotifyPull(MediaStreamGraph* aGraph, SourceMediaStream* aSource,
@ -351,7 +351,7 @@ public:
mAudioSource->NotifyOutputData(aGraph, aBuffer, aFrames, aChannels);
}
virtual void NotifyInputData(MediaStreamGraph* aGraph,
AudioDataValue* aBuffer, size_t aFrames,
const AudioDataValue* aBuffer, size_t aFrames,
uint32_t aChannels) override
{
mAudioSource->NotifyInputData(aGraph, aBuffer, aFrames, aChannels);
@ -425,7 +425,7 @@ public:
AudioDataValue* aBuffer, size_t aFrames,
uint32_t aChannels) override;
void NotifyInputData(MediaStreamGraph* aGraph,
AudioDataValue* aBuffer, size_t aFrames,
const AudioDataValue* aBuffer, size_t aFrames,
uint32_t aChannels) override;
bool IsFake() override {

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

@ -456,7 +456,7 @@ MediaEngineWebRTCMicrophoneSource::NotifyOutputData(MediaStreamGraph* aGraph,
// Called back on GraphDriver thread
void
MediaEngineWebRTCMicrophoneSource::NotifyInputData(MediaStreamGraph* aGraph,
AudioDataValue* aBuffer,
const AudioDataValue* aBuffer,
size_t aFrames,
uint32_t aChannels)
{