From 8dc6b990e1543635e414a58c8c6c52483e961dfc Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Tue, 14 Feb 2012 17:39:33 +1300 Subject: [PATCH] Bug 726891. Move rate/channels/format up to nsAudioStream and add inline getters. r=kinetik --- content/media/nsAudioStream.cpp | 19 +------------------ content/media/nsAudioStream.h | 13 +++++++++++++ 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/content/media/nsAudioStream.cpp b/content/media/nsAudioStream.cpp index d58f2689c5fe..9f4a5808fd93 100644 --- a/content/media/nsAudioStream.cpp +++ b/content/media/nsAudioStream.cpp @@ -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 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 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) { } diff --git a/content/media/nsAudioStream.h b/content/media/nsAudioStream.h index 40e20e68ec88..5eacec015c1a 100644 --- a/content/media/nsAudioStream.h +++ b/content/media/nsAudioStream.h @@ -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 mAudioPlaybackThread; + int mRate; + int mChannels; + SampleFormat mFormat; }; #endif