Bug 726891. Move rate/channels/format up to nsAudioStream and add inline getters. r=kinetik

This commit is contained in:
Robert O'Callahan 2012-02-14 17:39:33 +13:00
parent b2ec9bd05d
commit 8dc6b990e1
2 changed files with 14 additions and 18 deletions

View File

@ -117,10 +117,6 @@ class nsNativeAudioStream : public nsAudioStream
double mVolume;
void* mAudioHandle;
int mRate;
int mChannels;
SampleFormat mFormat;
// True if this audio stream is paused.
bool mPaused;
@ -155,10 +151,6 @@ class nsRemotedAudioStream : public nsAudioStream
private:
nsRefPtr<AudioChild> mAudioChild;
SampleFormat mFormat;
int mRate;
int mChannels;
PRInt32 mBytesPerFrame;
// True if this audio stream is paused.
@ -430,9 +422,6 @@ nsAudioStream::~nsAudioStream()
nsNativeAudioStream::nsNativeAudioStream() :
mVolume(1.0),
mAudioHandle(0),
mRate(0),
mChannels(0),
mFormat(FORMAT_S16_LE),
mPaused(false),
mInError(false)
{
@ -654,9 +643,6 @@ PRInt32 nsNativeAudioStream::GetMinWriteSize()
#if defined(REMOTE_AUDIO)
nsRemotedAudioStream::nsRemotedAudioStream()
: mAudioChild(nsnull),
mFormat(FORMAT_S16_LE),
mRate(0),
mChannels(0),
mBytesPerFrame(0),
mPaused(false)
{}
@ -876,9 +862,6 @@ private:
// nsAutoRef's destructor.
nsAutoRef<cubeb_stream> mCubebStream;
PRInt32 mRate;
PRInt32 mChannels;
SampleFormat mFormat;
PRUint32 mBytesPerFrame;
enum StreamState {
@ -917,7 +900,7 @@ nsAudioStream* nsAudioStream::AllocateStream()
#if defined(MOZ_CUBEB)
nsBufferedAudioStream::nsBufferedAudioStream()
: mMonitor("nsBufferedAudioStream"), mLostFrames(0), mVolume(1.0), mRate(0), mChannels(0),
: mMonitor("nsBufferedAudioStream"), mLostFrames(0), mVolume(1.0),
mBytesPerFrame(0), mState(INITIALIZED)
{
}

View File

@ -54,6 +54,12 @@ public:
FORMAT_FLOAT32
};
nsAudioStream()
: mRate(0),
mChannels(0),
mFormat(FORMAT_S16_LE)
{}
virtual ~nsAudioStream();
// Initialize Audio Library. Some Audio backends require initializing the
@ -122,8 +128,15 @@ public:
// Unsafe to call with the decoder monitor held.
virtual PRInt32 GetMinWriteSize() = 0;
int GetRate() { return mRate; }
int GetChannels() { return mChannels; }
SampleFormat GetFormat() { return mFormat; }
protected:
nsCOMPtr<nsIThread> mAudioPlaybackThread;
int mRate;
int mChannels;
SampleFormat mFormat;
};
#endif