mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1221587: Update for API changes in cubeb r=padenot
--HG-- extra : commitid : C4GE8epQXOe
This commit is contained in:
parent
5a17e5fbbe
commit
a853e094df
@ -364,7 +364,8 @@ AudioStream::OpenCubeb(cubeb_stream_params &aParams)
|
|||||||
|
|
||||||
{
|
{
|
||||||
cubeb_stream* stream;
|
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) {
|
latency, DataCallback_S, StateCallback_S, this) == CUBEB_OK) {
|
||||||
MonitorAutoLock mon(mMonitor);
|
MonitorAutoLock mon(mMonitor);
|
||||||
MOZ_ASSERT(mState != SHUTDOWN);
|
MOZ_ASSERT(mState != SHUTDOWN);
|
||||||
|
@ -308,7 +308,9 @@ protected:
|
|||||||
private:
|
private:
|
||||||
nsresult OpenCubeb(cubeb_stream_params &aParams);
|
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);
|
return static_cast<AudioStream*>(aThis)->DataCallback(aOutputBuffer, aFrames);
|
||||||
}
|
}
|
||||||
|
@ -575,7 +575,6 @@ AudioCallbackDriver::Init()
|
|||||||
MOZ_ASSERT(!NS_IsMainThread(),
|
MOZ_ASSERT(!NS_IsMainThread(),
|
||||||
"This is blocking and should never run on the main thread.");
|
"This is blocking and should never run on the main thread.");
|
||||||
|
|
||||||
output.devid = mGraphImpl->mOutputDeviceID;
|
|
||||||
mSampleRate = output.rate = CubebUtils::PreferredSampleRate();
|
mSampleRate = output.rate = CubebUtils::PreferredSampleRate();
|
||||||
|
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
@ -606,7 +605,6 @@ AudioCallbackDriver::Init()
|
|||||||
|
|
||||||
input = output;
|
input = output;
|
||||||
input.channels = 1; // change to support optional stereo capture
|
input.channels = 1; // change to support optional stereo capture
|
||||||
input.devid = mGraphImpl->mInputDeviceID;
|
|
||||||
|
|
||||||
cubeb_stream* stream;
|
cubeb_stream* stream;
|
||||||
// XXX Only pass input input if we have an input listener. Always
|
// 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.
|
// XXX Add support for adding/removing an input listener later.
|
||||||
if (cubeb_stream_init(CubebUtils::GetCubebContext(), &stream,
|
if (cubeb_stream_init(CubebUtils::GetCubebContext(), &stream,
|
||||||
"AudioCallbackDriver",
|
"AudioCallbackDriver",
|
||||||
|
mGraphImpl->mInputDeviceID,
|
||||||
mGraphImpl->mInputWanted ? &input : nullptr,
|
mGraphImpl->mInputWanted ? &input : nullptr,
|
||||||
|
mGraphImpl->mOutputDeviceID,
|
||||||
mGraphImpl->mOutputWanted ? &output : nullptr, latency,
|
mGraphImpl->mOutputWanted ? &output : nullptr, latency,
|
||||||
DataCallback_s, StateCallback_s, this) == CUBEB_OK) {
|
DataCallback_s, StateCallback_s, this) == CUBEB_OK) {
|
||||||
mAudioStream.own(stream);
|
mAudioStream.own(stream);
|
||||||
@ -744,11 +744,13 @@ AudioCallbackDriver::WakeUp()
|
|||||||
|
|
||||||
/* static */ long
|
/* static */ long
|
||||||
AudioCallbackDriver::DataCallback_s(cubeb_stream* aStream,
|
AudioCallbackDriver::DataCallback_s(cubeb_stream* aStream,
|
||||||
void* aUser, void* aInputBuffer, void* aOutputBuffer,
|
void* aUser,
|
||||||
|
const void* aInputBuffer,
|
||||||
|
void* aOutputBuffer,
|
||||||
long aFrames)
|
long aFrames)
|
||||||
{
|
{
|
||||||
AudioCallbackDriver* driver = reinterpret_cast<AudioCallbackDriver*>(aUser);
|
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);
|
static_cast<AudioDataValue*>(aOutputBuffer), aFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -816,7 +818,7 @@ AudioCallbackDriver::OSXDeviceSwitchingWorkaround()
|
|||||||
#endif // XP_MACOSX
|
#endif // XP_MACOSX
|
||||||
|
|
||||||
long
|
long
|
||||||
AudioCallbackDriver::DataCallback(AudioDataValue* aInputBuffer,
|
AudioCallbackDriver::DataCallback(const AudioDataValue* aInputBuffer,
|
||||||
AudioDataValue* aOutputBuffer, long aFrames)
|
AudioDataValue* aOutputBuffer, long aFrames)
|
||||||
{
|
{
|
||||||
bool stillProcessing;
|
bool stillProcessing;
|
||||||
|
@ -392,7 +392,9 @@ public:
|
|||||||
|
|
||||||
/* Static wrapper function cubeb calls back. */
|
/* Static wrapper function cubeb calls back. */
|
||||||
static long DataCallback_s(cubeb_stream * aStream,
|
static long DataCallback_s(cubeb_stream * aStream,
|
||||||
void * aUser, void * aInputBuffer, void * aOutputBuffer,
|
void * aUser,
|
||||||
|
const void * aInputBuffer,
|
||||||
|
void * aOutputBuffer,
|
||||||
long aFrames);
|
long aFrames);
|
||||||
static void StateCallback_s(cubeb_stream* aStream, void * aUser,
|
static void StateCallback_s(cubeb_stream* aStream, void * aUser,
|
||||||
cubeb_state aState);
|
cubeb_state aState);
|
||||||
@ -402,7 +404,7 @@ public:
|
|||||||
* audio. If the return value is exactly aFrames, this function will get
|
* 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
|
* called again. If it is less than aFrames, the stream will go in draining
|
||||||
* mode, and this function will not be called again. */
|
* 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
|
/* This function is called by the underlying audio backend, but is only used
|
||||||
* for informational purposes at the moment. */
|
* for informational purposes at the moment. */
|
||||||
void StateCallback(cubeb_state aState);
|
void StateCallback(cubeb_state aState);
|
||||||
|
@ -203,7 +203,7 @@ public:
|
|||||||
* guaranteed to be in any particular size chunks.
|
* guaranteed to be in any particular size chunks.
|
||||||
*/
|
*/
|
||||||
virtual void NotifyInputData(MediaStreamGraph* aGraph,
|
virtual void NotifyInputData(MediaStreamGraph* aGraph,
|
||||||
AudioDataValue* aBuffer, size_t aFrames,
|
const AudioDataValue* aBuffer, size_t aFrames,
|
||||||
uint32_t aChannels) = 0;
|
uint32_t aChannels) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ public:
|
|||||||
uint32_t aChannels) override
|
uint32_t aChannels) override
|
||||||
{}
|
{}
|
||||||
void NotifyInputData(MediaStreamGraph* aGraph,
|
void NotifyInputData(MediaStreamGraph* aGraph,
|
||||||
AudioDataValue* aBuffer, size_t aFrames,
|
const AudioDataValue* aBuffer, size_t aFrames,
|
||||||
uint32_t aChannels) override
|
uint32_t aChannels) override
|
||||||
{}
|
{}
|
||||||
bool IsFake() override {
|
bool IsFake() override {
|
||||||
|
@ -104,7 +104,7 @@ public:
|
|||||||
uint32_t aChannels) override
|
uint32_t aChannels) override
|
||||||
{}
|
{}
|
||||||
void NotifyInputData(MediaStreamGraph* aGraph,
|
void NotifyInputData(MediaStreamGraph* aGraph,
|
||||||
AudioDataValue* aBuffer, size_t aFrames,
|
const AudioDataValue* aBuffer, size_t aFrames,
|
||||||
uint32_t aChannels) override
|
uint32_t aChannels) override
|
||||||
{}
|
{}
|
||||||
void NotifyPull(MediaStreamGraph* aGraph, SourceMediaStream* aSource,
|
void NotifyPull(MediaStreamGraph* aGraph, SourceMediaStream* aSource,
|
||||||
@ -351,7 +351,7 @@ public:
|
|||||||
mAudioSource->NotifyOutputData(aGraph, aBuffer, aFrames, aChannels);
|
mAudioSource->NotifyOutputData(aGraph, aBuffer, aFrames, aChannels);
|
||||||
}
|
}
|
||||||
virtual void NotifyInputData(MediaStreamGraph* aGraph,
|
virtual void NotifyInputData(MediaStreamGraph* aGraph,
|
||||||
AudioDataValue* aBuffer, size_t aFrames,
|
const AudioDataValue* aBuffer, size_t aFrames,
|
||||||
uint32_t aChannels) override
|
uint32_t aChannels) override
|
||||||
{
|
{
|
||||||
mAudioSource->NotifyInputData(aGraph, aBuffer, aFrames, aChannels);
|
mAudioSource->NotifyInputData(aGraph, aBuffer, aFrames, aChannels);
|
||||||
@ -425,7 +425,7 @@ public:
|
|||||||
AudioDataValue* aBuffer, size_t aFrames,
|
AudioDataValue* aBuffer, size_t aFrames,
|
||||||
uint32_t aChannels) override;
|
uint32_t aChannels) override;
|
||||||
void NotifyInputData(MediaStreamGraph* aGraph,
|
void NotifyInputData(MediaStreamGraph* aGraph,
|
||||||
AudioDataValue* aBuffer, size_t aFrames,
|
const AudioDataValue* aBuffer, size_t aFrames,
|
||||||
uint32_t aChannels) override;
|
uint32_t aChannels) override;
|
||||||
|
|
||||||
bool IsFake() override {
|
bool IsFake() override {
|
||||||
|
@ -456,7 +456,7 @@ MediaEngineWebRTCMicrophoneSource::NotifyOutputData(MediaStreamGraph* aGraph,
|
|||||||
// Called back on GraphDriver thread
|
// Called back on GraphDriver thread
|
||||||
void
|
void
|
||||||
MediaEngineWebRTCMicrophoneSource::NotifyInputData(MediaStreamGraph* aGraph,
|
MediaEngineWebRTCMicrophoneSource::NotifyInputData(MediaStreamGraph* aGraph,
|
||||||
AudioDataValue* aBuffer,
|
const AudioDataValue* aBuffer,
|
||||||
size_t aFrames,
|
size_t aFrames,
|
||||||
uint32_t aChannels)
|
uint32_t aChannels)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user