Bug 910875 - Add missing ifdefs to make audio_device work on BSDs. r=jesup
authorJan Beich <jbeich@tormail.org>
Fri, 30 Aug 2013 22:13:55 +0200
changeset 158034 d4141cb0d9cf522a88d36d3694ca348f6f544048
parent 158033 41a8984656364023f983a61504c4b05801659523
child 158035 a4252161972b4c126fb842baa3f8f7ef26ea6f64
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs910875
milestone26.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 910875 - Add missing ifdefs to make audio_device work on BSDs. r=jesup
media/webrtc/trunk/webrtc/modules/audio_device/audio_device_impl.cc
media/webrtc/trunk/webrtc/modules/audio_device/test/audio_device_test_api.cc
--- a/media/webrtc/trunk/webrtc/modules/audio_device/audio_device_impl.cc
+++ b/media/webrtc/trunk/webrtc/modules/audio_device/audio_device_impl.cc
@@ -11,17 +11,19 @@
 #include "audio_device_impl.h"
 #include "audio_device_config.h"
 #include "common_audio/signal_processing/include/signal_processing_library.h"
 #include "system_wrappers/interface/ref_count.h"
 
 #include <assert.h>
 #include <string.h>
 
-#if defined(_WIN32)
+#if defined(WEBRTC_DUMMY_AUDIO_BUILD)
+// do not include platform specific headers
+#elif defined(_WIN32)
     #include "audio_device_utility_win.h"
     #include "audio_device_wave_win.h"
  #if defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD)
     #include "audio_device_core_win.h"
  #endif
 #elif defined(WEBRTC_ANDROID_OPENSLES)
     #include <stdlib.h>
     #include <dlfcn.h>
@@ -32,28 +34,28 @@
     #include <stdlib.h>
     #include <dlfcn.h>
     #include "audio_device_utility_linux.h"
     #include "audio_device_opensles.h"
 #elif defined(WEBRTC_ANDROID)
     #include <stdlib.h>
     #include "audio_device_utility_android.h"
     #include "audio_device_jni_android.h"
-#elif defined(WEBRTC_LINUX)
+#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
     #include "audio_device_utility_linux.h"
- #if defined(LINUX_ALSA)
-    #include "audio_device_alsa_linux.h"
- #endif
 #elif defined(WEBRTC_IOS)
     #include "audio_device_utility_ios.h"
     #include "audio_device_ios.h"
 #elif defined(WEBRTC_MAC)
     #include "audio_device_utility_mac.h"
     #include "audio_device_mac.h"
 #endif
+#if defined(LINUX_ALSA)
+    #include "audio_device_alsa_linux.h"
+#endif
 #if defined(LINUX_PULSE)
     #include "audio_device_pulse_linux.h"
 #endif
 #include "audio_device_dummy.h"
 #include "audio_device_utility_dummy.h"
 #include "critical_section_wrapper.h"
 #include "trace.h"
 
@@ -161,17 +163,17 @@ int32_t AudioDeviceModuleImpl::CheckPlat
     PlatformType platform(kPlatformNotSupported);
 
 #if defined(_WIN32)
     platform = kPlatformWin32;
     WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "current platform is WIN32");
 #elif defined(WEBRTC_ANDROID)
     platform = kPlatformAndroid;
     WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "current platform is ANDROID");
-#elif defined(WEBRTC_LINUX)
+#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
     platform = kPlatformLinux;
     WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "current platform is LINUX");
 #elif defined(WEBRTC_IOS)
     platform = kPlatformIOS;
     WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "current platform is IOS");
 #elif defined(WEBRTC_MAC)
     platform = kPlatformMac;
     WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "current platform is MAC");
@@ -304,17 +306,17 @@ int32_t AudioDeviceModuleImpl::CreatePla
         {
             // Create the Android implementation of the Device Utility.
             ptrAudioDeviceUtility = new AudioDeviceUtilityAndroid(Id());
         }
     }
 
     // Create the *Linux* implementation of the Audio Device
     //
-#elif defined(WEBRTC_LINUX)
+#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
     if ((audioLayer == kLinuxPulseAudio) || (audioLayer == kPlatformDefaultAudio))
     {
 #if defined(LINUX_PULSE)
         WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "attempting to use the Linux PulseAudio APIs...");
 
         if (AudioDeviceLinuxPulse::PulseAudioIsSupported())
         {
             // create *Linux PulseAudio* implementation
@@ -350,17 +352,17 @@ int32_t AudioDeviceModuleImpl::CreatePla
     if (ptrAudioDevice != NULL)
     {
         // Create the Linux implementation of the Device Utility.
         // This class is independent of the selected audio layer
         // for Linux.
         //
         ptrAudioDeviceUtility = new AudioDeviceUtilityLinux(Id());
     }
-#endif  // #if defined(WEBRTC_LINUX)
+#endif  // #if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
 
     // Create the *iPhone* implementation of the Audio Device
     //
 #if defined(WEBRTC_IOS)
     if (audioLayer == kPlatformDefaultAudio)
     {
         // Create *iPhone Audio* implementation
         ptrAudioDevice = new AudioDeviceIPhone(Id());
--- a/media/webrtc/trunk/webrtc/modules/audio_device/test/audio_device_test_api.cc
+++ b/media/webrtc/trunk/webrtc/modules/audio_device/test/audio_device_test_api.cc
@@ -192,17 +192,17 @@ class AudioDeviceAPITest: public testing
                 kId, AudioDeviceModule::kWindowsCoreAudio)) == NULL);
     EXPECT_TRUE((audio_device_ = AudioDeviceModuleImpl::Create(
                 kId, AudioDeviceModule::kLinuxAlsaAudio)) == NULL);
     EXPECT_TRUE((audio_device_ = AudioDeviceModuleImpl::Create(
                 kId, AudioDeviceModule::kLinuxPulseAudio)) == NULL);
     // Create default implementation instance
     EXPECT_TRUE((audio_device_ = AudioDeviceModuleImpl::Create(
                 kId, AudioDeviceModule::kPlatformDefaultAudio)) != NULL);
-#elif defined(WEBRTC_LINUX)
+#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
     EXPECT_TRUE((audio_device_ = AudioDeviceModuleImpl::Create(
                 kId, AudioDeviceModule::kWindowsWaveAudio)) == NULL);
     EXPECT_TRUE((audio_device_ = AudioDeviceModuleImpl::Create(
                 kId, AudioDeviceModule::kWindowsCoreAudio)) == NULL);
     // create default implementation instance
     EXPECT_TRUE((audio_device_ = AudioDeviceModuleImpl::Create(
                 kId, AudioDeviceModule::kPlatformDefaultAudio)) != NULL);
     audio_device_->AddRef();
@@ -1685,17 +1685,17 @@ TEST_F(AudioDeviceAPITest, CPULoad) {
   EXPECT_EQ(0, load);
 #else
   EXPECT_EQ(-1, audio_device_->CPULoad(&load));
 #endif
 }
 
 // TODO(kjellander): Fix flakiness causing failures on Windows.
 // TODO(phoglund):  Fix flakiness causing failures on Linux.
-#if !defined(_WIN32) && !defined(WEBRTC_LINUX)
+#if !defined(_WIN32) && !defined(WEBRTC_LINUX) && !defined(WEBRTC_BSD)
 TEST_F(AudioDeviceAPITest, StartAndStopRawOutputFileRecording) {
   // NOTE: this API is better tested in a functional test
   CheckInitialPlayoutStates();
 
   // fail tests
   EXPECT_EQ(-1, audio_device_->StartRawOutputFileRecording(NULL));
 
   // bulk tests
@@ -1754,17 +1754,17 @@ TEST_F(AudioDeviceAPITest, StartAndStopR
       GetFilename("raw_input_not_recording.pcm")));
   EXPECT_EQ(0, audio_device_->StopRawInputFileRecording());
 
   // results after this test:
   //
   // - size of raw_input_not_recording.pcm shall be 0
   // - size of raw_input_not_recording.pcm shall be > 0
 }
-#endif  // !WIN32 && !WEBRTC_LINUX
+#endif  // !WIN32 && !WEBRTC_LINUX && !defined(WEBRTC_BSD)
 
 TEST_F(AudioDeviceAPITest, RecordingSampleRate) {
   uint32_t sampleRate(0);
 
   // bulk tests
   EXPECT_EQ(0, audio_device_->RecordingSampleRate(&sampleRate));
 #if defined(_WIN32) && !defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD)
   EXPECT_EQ(48000, sampleRate);