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
parent 5a17e5fbbe
commit a853e094df
8 changed files with 22 additions and 15 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -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;
};

View File

@ -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 {

View File

@ -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 {

View File

@ -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)
{