Bug 930532: Adjust '#if defined(MOZ_CUBEB)' checks to include cubeb-only static functions in AudioStream.cpp, to fix build warnings in non-cubeb builds. r=padenot
authorDaniel Holbert <dholbert@cs.stanford.edu>
Thu, 24 Oct 2013 17:26:19 +0200
changeset 165795 168ec48380971c95dfc73c46f225a400654ad9ab
parent 165794 512ee2e8691ecd788ab848630e2ef6f95783ace0
child 165796 2becacaadf0bb3a9b5b23d5145c8ec39ac2201f3
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs930532
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 930532: Adjust '#if defined(MOZ_CUBEB)' checks to include cubeb-only static functions in AudioStream.cpp, to fix build warnings in non-cubeb builds. r=padenot
content/media/AudioStream.cpp
--- a/content/media/AudioStream.cpp
+++ b/content/media/AudioStream.cpp
@@ -48,17 +48,19 @@ StaticMutex AudioStream::mMutex;
 uint32_t AudioStream::mPreferredSampleRate = 0;
 
 /**
  * When MOZ_DUMP_AUDIO is set in the environment (to anything),
  * we'll drop a series of files in the current working directory named
  * dumped-audio-<nnn>.wav, one per nsBufferedAudioStream created, containing
  * the audio for the stream including any skips due to underruns.
  */
+#if defined(MOZ_CUBEB)
 static int gDumpedAudioCount = 0;
+#endif
 
 static int PrefChanged(const char* aPref, void* aClosure)
 {
   if (strcmp(aPref, PREF_VOLUME_SCALE) == 0) {
     nsAdoptingString value = Preferences::GetString(aPref);
     MutexAutoLock lock(*gAudioPrefsLock);
     if (value.IsEmpty()) {
       gVolumeScale = 1.0;
@@ -73,23 +75,23 @@ static int PrefChanged(const char* aPref
     gCubebLatencyPrefSet = Preferences::HasUserValue(aPref);
     uint32_t value = Preferences::GetUint(aPref, CUBEB_NORMAL_LATENCY_MS);
     MutexAutoLock lock(*gAudioPrefsLock);
     gCubebLatency = std::min<uint32_t>(std::max<uint32_t>(value, 1), 1000);
   }
   return 0;
 }
 
+#if defined(MOZ_CUBEB)
 static double GetVolumeScale()
 {
   MutexAutoLock lock(*gAudioPrefsLock);
   return gVolumeScale;
 }
 
-#if defined(MOZ_CUBEB)
 static cubeb* gCubebContext;
 
 static cubeb* GetCubebContext()
 {
   MutexAutoLock lock(*gAudioPrefsLock);
   if (gCubebContext ||
       cubeb_init(&gCubebContext, "AudioStream") == CUBEB_OK) {
     return gCubebContext;
@@ -461,16 +463,17 @@ int AudioStream::PreferredSampleRate()
     }
 #endif
     mPreferredSampleRate = fallbackSampleRate;
   }
 
   return mPreferredSampleRate;
 }
 
+#if defined(MOZ_CUBEB)
 static void SetUint16LE(uint8_t* aDest, uint16_t aValue)
 {
   aDest[0] = aValue & 0xFF;
   aDest[1] = aValue >> 8;
 }
 
 static void SetUint32LE(uint8_t* aDest, uint32_t aValue)
 {
@@ -530,17 +533,16 @@ WriteDumpFile(FILE* aDumpFile, AudioStre
   uint8_t* output = buf.Elements();
   for (uint32_t i = 0; i < samples; ++i) {
     SetUint16LE(output + i*2, int16_t(input[i]*32767.0f));
   }
   fwrite(output, 2, samples, aDumpFile);
   fflush(aDumpFile);
 }
 
-#if defined(MOZ_CUBEB)
 BufferedAudioStream::BufferedAudioStream()
   : mMonitor("BufferedAudioStream"), mLostFrames(0), mDumpFile(nullptr),
     mVolume(1.0), mBytesPerFrame(0), mState(INITIALIZED)
 {
   AsyncLatencyLogger::Get(true)->AddRef();
 }
 
 BufferedAudioStream::~BufferedAudioStream()