Bug 812937 - Remove unused audio remoting code. r=cjones
authorMatthew Gregan <kinetik@flim.org>
Mon, 19 Nov 2012 13:54:29 +1300
changeset 113741 d3876eaace9caf4847dd8b26b4f4e9420636e45f
parent 113740 a047867610ac825164dac5ce5bec25cfacd80df7
child 113742 3c6f2b27ad610a0a186b50e3d9d17f09ba4e9391
push id18356
push usermgregan@mozilla.com
push dateTue, 20 Nov 2012 02:38:53 +0000
treeherdermozilla-inbound@d3876eaace9c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs812937
milestone20.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 812937 - Remove unused audio remoting code. r=cjones
content/media/AudioStream.cpp
content/media/AudioStream.h
dom/ipc/AudioChild.cpp
dom/ipc/AudioChild.h
dom/ipc/AudioParent.cpp
dom/ipc/AudioParent.h
dom/ipc/ContentChild.cpp
dom/ipc/ContentChild.h
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/ipc/Makefile.in
dom/ipc/PAudio.ipdl
dom/ipc/PContent.ipdl
dom/ipc/ipdl.mk
--- a/content/media/AudioStream.cpp
+++ b/content/media/AudioStream.cpp
@@ -1,29 +1,23 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/dom/ContentChild.h"
-#include "mozilla/dom/PAudioChild.h"
-#include "mozilla/dom/AudioChild.h"
-#include "nsXULAppAPI.h"
-using namespace mozilla::dom;
-
 #include <stdio.h>
 #include <math.h>
 #include "prlog.h"
 #include "prmem.h"
 #include "prdtoa.h"
 #include "nsAutoPtr.h"
 #include "AudioStream.h"
 #include "nsAlgorithm.h"
 #include "VideoUtils.h"
+#include "mozilla/Monitor.h"
 #include "mozilla/Mutex.h"
 extern "C" {
 #include "sydneyaudio/sydney_audio.h"
 }
 #include "nsThreadUtils.h"
 #include "mozilla/Preferences.h"
 
 #if defined(MOZ_CUBEB)
@@ -40,22 +34,16 @@ public:
 #endif
 
 namespace mozilla {
 
 #if defined(XP_MACOSX)
 #define SA_PER_STREAM_VOLUME 1
 #endif
 
-// Android's audio backend is not available in content processes, so
-// audio must be remoted to the parent chrome process.
-#if defined(MOZ_WIDGET_ANDROID)
-#define REMOTE_AUDIO 1
-#endif
-
 #ifdef PR_LOGGING
 PRLogModuleInfo* gAudioStreamLog = nullptr;
 #endif
 
 static const uint32_t FAKE_BUFFER_SIZE = 176400;
 
 // Number of milliseconds per second.
 static const int64_t MS_PER_S = 1000;
@@ -64,17 +52,17 @@ class nsNativeAudioStream : public Audio
 {
  public:
   NS_DECL_ISUPPORTS
 
   ~nsNativeAudioStream();
   nsNativeAudioStream();
 
   nsresult Init(int32_t aNumChannels, int32_t aRate,
-                const AudioChannelType aAudioChannelType);
+                const dom::AudioChannelType aAudioChannelType);
   void Shutdown();
   nsresult Write(const AudioDataValue* aBuf, uint32_t aFrames);
   uint32_t Available();
   void SetVolume(double aVolume);
   void Drain();
   void Pause();
   void Resume();
   int64_t GetPosition();
@@ -90,208 +78,16 @@ class nsNativeAudioStream : public Audio
   // True if this audio stream is paused.
   bool mPaused;
 
   // True if this stream has encountered an error.
   bool mInError;
 
 };
 
-#if defined(REMOTE_AUDIO)
-class nsRemotedAudioStream : public AudioStream
-{
- public:
-  NS_DECL_ISUPPORTS
-
-  nsRemotedAudioStream();
-  ~nsRemotedAudioStream();
-
-  nsresult Init(int32_t aNumChannels, int32_t aRate,
-                const AudioChannelType aAudioChannelType);
-  void Shutdown();
-  nsresult Write(const AudioDataValue* aBuf, uint32_t aFrames);
-  uint32_t Available();
-  void SetVolume(double aVolume);
-  void Drain();
-  void Pause();
-  void Resume();
-  int64_t GetPosition();
-  int64_t GetPositionInFrames();
-  bool IsPaused();
-  int32_t GetMinWriteSize();
-
-private:
-  nsRefPtr<AudioChild> mAudioChild;
-
-  int32_t mBytesPerFrame;
-
-  // True if this audio stream is paused.
-  bool mPaused;
-
-  friend class AudioInitEvent;
-};
-
-class AudioInitEvent : public nsRunnable
-{
- public:
-  AudioInitEvent(nsRemotedAudioStream* owner)
-  {
-    mOwner = owner;
-  }
-
-  NS_IMETHOD Run()
-  {
-    ContentChild * cpc = ContentChild::GetSingleton();
-    NS_ASSERTION(cpc, "Content Protocol is NULL!");
-    mOwner->mAudioChild =  static_cast<AudioChild*>(cpc->SendPAudioConstructor(mOwner->mChannels,
-                                                                               mOwner->mRate));
-    return NS_OK;
-  }
-
-  nsRefPtr<nsRemotedAudioStream> mOwner;
-};
-
-class AudioWriteEvent : public nsRunnable
-{
- public:
-  AudioWriteEvent(AudioChild* aChild,
-                  const AudioDataValue* aBuf,
-                  uint32_t aNumberOfFrames,
-                  uint32_t aBytesPerFrame)
-  {
-    mAudioChild = aChild;
-    mBytesPerFrame = aBytesPerFrame;
-    mBuffer.Assign(reinterpret_cast<const char*>(aBuf),
-                   aNumberOfFrames * aBytesPerFrame);
-  }
-
-  NS_IMETHOD Run()
-  {
-    if (!mAudioChild->IsIPCOpen())
-      return NS_OK;
-
-    mAudioChild->SendWrite(mBuffer, mBuffer.Length() / mBytesPerFrame);
-    return NS_OK;
-  }
-
-  nsRefPtr<AudioChild> mAudioChild;
-  nsCString mBuffer;
-  uint32_t mBytesPerFrame;
-};
-
-class AudioSetVolumeEvent : public nsRunnable
-{
- public:
-  AudioSetVolumeEvent(AudioChild* aChild, double aVolume)
-  {
-    mAudioChild = aChild;
-    mVolume = aVolume;
-  }
-
-  NS_IMETHOD Run()
-  {
-    if (!mAudioChild->IsIPCOpen())
-      return NS_OK;
-
-    mAudioChild->SendSetVolume(mVolume);
-    return NS_OK;
-  }
-
-  nsRefPtr<AudioChild> mAudioChild;
-  double mVolume;
-};
-
-
-class AudioMinWriteSizeEvent : public nsRunnable
-{
- public:
-  AudioMinWriteSizeEvent(AudioChild* aChild)
-  {
-    mAudioChild = aChild;
-  }
-
-  NS_IMETHOD Run()
-  {
-    if (!mAudioChild->IsIPCOpen())
-      return NS_OK;
-
-    mAudioChild->SendMinWriteSize();
-    return NS_OK;
-  }
-
-  nsRefPtr<AudioChild> mAudioChild;
-};
-
-class AudioDrainEvent : public nsRunnable
-{
- public:
-  AudioDrainEvent(AudioChild* aChild)
-  {
-    mAudioChild = aChild;
-  }
-
-  NS_IMETHOD Run()
-  {
-    if (!mAudioChild->IsIPCOpen())
-      return NS_OK;
-
-    mAudioChild->SendDrain();
-    return NS_OK;
-  }
-
-  nsRefPtr<AudioChild> mAudioChild;
-};
-
-
-class AudioPauseEvent : public nsRunnable
-{
- public:
-  AudioPauseEvent(AudioChild* aChild, bool pause)
-  {
-    mAudioChild = aChild;
-    mPause = pause;
-  }
-
-  NS_IMETHOD Run()
-  {
-    if (!mAudioChild->IsIPCOpen())
-      return NS_OK;
-
-    if (mPause)
-      mAudioChild->SendPause();
-    else
-      mAudioChild->SendResume();
-
-    return NS_OK;
-  }
-
-  nsRefPtr<AudioChild> mAudioChild;
-  bool mPause;
-};
-
-
-class AudioShutdownEvent : public nsRunnable
-{
- public:
-  AudioShutdownEvent(AudioChild* aChild)
-  {
-    mAudioChild = aChild;
-  }
-
-  NS_IMETHOD Run()
-  {
-    if (mAudioChild->IsIPCOpen())
-      mAudioChild->SendShutdown();
-    return NS_OK;
-  }
-
-  nsRefPtr<AudioChild> mAudioChild;
-};
-#endif
-
 #define PREF_VOLUME_SCALE "media.volume_scale"
 #define PREF_USE_CUBEB "media.use_cubeb"
 #define PREF_CUBEB_LATENCY "media.cubeb_latency_ms"
 
 static Mutex* gAudioPrefsLock = nullptr;
 static double gVolumeScale;
 static bool gUseCubeb;
 static uint32_t gCubebLatency;
@@ -354,30 +150,30 @@ static cubeb* GetCubebContext()
 
 static uint32_t GetCubebLatency()
 {
   MutexAutoLock lock(*gAudioPrefsLock);
   return gCubebLatency;
 }
 #endif
 
-static sa_stream_type_t ConvertChannelToSAType(AudioChannelType aType)
+static sa_stream_type_t ConvertChannelToSAType(dom::AudioChannelType aType)
 {
   switch(aType) {
-    case AUDIO_CHANNEL_NORMAL:
+    case dom::AUDIO_CHANNEL_NORMAL:
       return SA_STREAM_TYPE_SYSTEM;
-    case AUDIO_CHANNEL_CONTENT:
+    case dom::AUDIO_CHANNEL_CONTENT:
       return SA_STREAM_TYPE_MUSIC;
-    case AUDIO_CHANNEL_NOTIFICATION:
+    case dom::AUDIO_CHANNEL_NOTIFICATION:
       return SA_STREAM_TYPE_NOTIFICATION;
-    case AUDIO_CHANNEL_ALARM:
+    case dom::AUDIO_CHANNEL_ALARM:
       return SA_STREAM_TYPE_ALARM;
-    case AUDIO_CHANNEL_TELEPHONY:
+    case dom::AUDIO_CHANNEL_TELEPHONY:
       return SA_STREAM_TYPE_VOICE_CALL;
-    case AUDIO_CHANNEL_PUBLICNOTIFICATION:
+    case dom::AUDIO_CHANNEL_PUBLICNOTIFICATION:
       return SA_STREAM_TYPE_ENFORCED_AUDIBLE;
     default:
       NS_ERROR("The value of AudioChannelType is invalid");
       return SA_STREAM_TYPE_MAX;
   }
 }
 
 void AudioStream::InitLibrary()
@@ -453,17 +249,17 @@ nsNativeAudioStream::nsNativeAudioStream
 nsNativeAudioStream::~nsNativeAudioStream()
 {
   Shutdown();
 }
 
 NS_IMPL_THREADSAFE_ISUPPORTS0(nsNativeAudioStream)
 
 nsresult nsNativeAudioStream::Init(int32_t aNumChannels, int32_t aRate,
-                                   const AudioChannelType aAudioChannelType)
+                                   const dom::AudioChannelType aAudioChannelType)
 {
   mRate = aRate;
   mChannels = aNumChannels;
 
   if (sa_stream_create_pcm(reinterpret_cast<sa_stream_t**>(&mAudioHandle),
                            NULL,
                            SA_MODE_WRONLY,
                            SA_PCM_FORMAT_S16_NE,
@@ -628,153 +424,16 @@ int32_t nsNativeAudioStream::GetMinWrite
   if (r == SA_ERROR_NOT_SUPPORTED)
     return 1;
   else if (r != SA_SUCCESS || size > INT32_MAX)
     return -1;
 
   return static_cast<int32_t>(size / mChannels / sizeof(short));
 }
 
-#if defined(REMOTE_AUDIO)
-nsRemotedAudioStream::nsRemotedAudioStream()
- : mAudioChild(nullptr),
-   mBytesPerFrame(0),
-   mPaused(false)
-{}
-
-nsRemotedAudioStream::~nsRemotedAudioStream()
-{
-  Shutdown();
-}
-
-NS_IMPL_THREADSAFE_ISUPPORTS0(nsRemotedAudioStream)
-
-nsresult
-nsRemotedAudioStream::Init(int32_t aNumChannels,
-                           int32_t aRate, AudioChannelType aAudioChannelType)
-{
-  mRate = aRate;
-  mChannels = aNumChannels;
-  mBytesPerFrame = sizeof(AudioDataValue) * mChannels;
-
-  nsCOMPtr<nsIRunnable> event = new AudioInitEvent(this);
-  NS_DispatchToMainThread(event, NS_DISPATCH_SYNC);
-  return NS_OK;
-}
-
-void
-nsRemotedAudioStream::Shutdown()
-{
-  if (!mAudioChild)
-    return;
-  nsCOMPtr<nsIRunnable> event = new AudioShutdownEvent(mAudioChild);
-  NS_DispatchToMainThread(event);
-  mAudioChild = nullptr;
-}
-
-nsresult
-nsRemotedAudioStream::Write(const AudioDataValue* aBuf, uint32_t aFrames)
-{
-  if (!mAudioChild)
-    return NS_ERROR_FAILURE;
-  nsCOMPtr<nsIRunnable> event = new AudioWriteEvent(mAudioChild,
-                                                    aBuf,
-                                                    aFrames,
-                                                    mBytesPerFrame);
-  NS_DispatchToMainThread(event);
-  mAudioChild->WaitForWrite();
-  return NS_OK;
-}
-
-uint32_t
-nsRemotedAudioStream::Available()
-{
-  return FAKE_BUFFER_SIZE;
-}
-
-int32_t nsRemotedAudioStream::GetMinWriteSize()
-{
-  if (!mAudioChild)
-    return -1;
-  nsCOMPtr<nsIRunnable> event = new AudioMinWriteSizeEvent(mAudioChild);
-  NS_DispatchToMainThread(event);
-  return mAudioChild->WaitForMinWriteSize();
-}
-
-void
-nsRemotedAudioStream::SetVolume(double aVolume)
-{
-  if (!mAudioChild)
-    return;
-  nsCOMPtr<nsIRunnable> event = new AudioSetVolumeEvent(mAudioChild, aVolume);
-  NS_DispatchToMainThread(event);
-}
-
-void
-nsRemotedAudioStream::Drain()
-{
-  if (!mAudioChild)
-    return;
-  nsCOMPtr<nsIRunnable> event = new AudioDrainEvent(mAudioChild);
-  NS_DispatchToMainThread(event);
-  mAudioChild->WaitForDrain();
-}
-
-void
-nsRemotedAudioStream::Pause()
-{
-  mPaused = true;
-  if (!mAudioChild)
-    return;
-  nsCOMPtr<nsIRunnable> event = new AudioPauseEvent(mAudioChild, true);
-  NS_DispatchToMainThread(event);
-}
-
-void
-nsRemotedAudioStream::Resume()
-{
-  mPaused = false;
-  if (!mAudioChild)
-    return;
-  nsCOMPtr<nsIRunnable> event = new AudioPauseEvent(mAudioChild, false);
-  NS_DispatchToMainThread(event);
-}
-
-int64_t nsRemotedAudioStream::GetPosition()
-{
-  int64_t position = GetPositionInFrames();
-  if (position >= 0) {
-    return ((USECS_PER_S * position) / mRate);
-  }
-  return 0;
-}
-
-int64_t
-nsRemotedAudioStream::GetPositionInFrames()
-{
-  if(!mAudioChild)
-    return 0;
-
-  int64_t position = mAudioChild->GetLastKnownPosition();
-  if (position == -1)
-    return 0;
-
-  int64_t time = mAudioChild->GetLastKnownPositionTimestamp();
-  int64_t dt = PR_IntervalToMilliseconds(PR_IntervalNow() - time);
-
-  return position + (mRate * dt / MS_PER_S);
-}
-
-bool
-nsRemotedAudioStream::IsPaused()
-{
-  return mPaused;
-}
-#endif
-
 #if defined(MOZ_CUBEB)
 class nsCircularByteBuffer
 {
 public:
   nsCircularByteBuffer()
     : mBuffer(nullptr), mCapacity(0), mStart(0), mCount(0)
   {}
 
@@ -840,17 +499,17 @@ class nsBufferedAudioStream : public Aud
 {
  public:
   NS_DECL_ISUPPORTS
 
   nsBufferedAudioStream();
   ~nsBufferedAudioStream();
 
   nsresult Init(int32_t aNumChannels, int32_t aRate,
-                const AudioChannelType aAudioChannelType);
+                const dom::AudioChannelType aAudioChannelType);
   void Shutdown();
   nsresult Write(const AudioDataValue* aBuf, uint32_t aFrames);
   uint32_t Available();
   void SetVolume(double aVolume);
   void Drain();
   void Pause();
   void Resume();
   int64_t GetPosition();
@@ -914,21 +573,16 @@ private:
   };
 
   StreamState mState;
 };
 #endif
 
 AudioStream* AudioStream::AllocateStream()
 {
-#if defined(REMOTE_AUDIO)
-  if (XRE_GetProcessType() == GeckoProcessType_Content) {
-    return new nsRemotedAudioStream();
-  }
-#endif
 #if defined(MOZ_CUBEB)
   if (GetUseCubeb()) {
     return new nsBufferedAudioStream();
   }
 #endif
   return new nsNativeAudioStream();
 }
 
@@ -943,17 +597,17 @@ nsBufferedAudioStream::~nsBufferedAudioS
 {
   Shutdown();
 }
 
 NS_IMPL_THREADSAFE_ISUPPORTS0(nsBufferedAudioStream)
 
 nsresult
 nsBufferedAudioStream::Init(int32_t aNumChannels, int32_t aRate,
-                            const AudioChannelType aAudioChannelType)
+                            const dom::AudioChannelType aAudioChannelType)
 {
   cubeb* cubebContext = GetCubebContext();
 
   if (!cubebContext || aNumChannels < 0 || aRate < 0) {
     return NS_ERROR_FAILURE;
   }
 
   mRate = aRate;
--- a/content/media/AudioStream.h
+++ b/content/media/AudioStream.h
@@ -47,17 +47,17 @@ public:
   static AudioStream* AllocateStream();
 
   // Initialize the audio stream. aNumChannels is the number of audio
   // channels (1 for mono, 2 for stereo, etc) and aRate is the sample rate
   // (22050Hz, 44100Hz, etc).
   // Unsafe to call with a monitor held due to synchronous event execution
   // on the main thread, which may attempt to acquire any held monitor.
   virtual nsresult Init(int32_t aNumChannels, int32_t aRate,
-                        const mozilla::dom::AudioChannelType aAudioStreamType) = 0;
+                        const dom::AudioChannelType aAudioStreamType) = 0;
 
   // Closes the stream. All future use of the stream is an error.
   // Unsafe to call with a monitor held due to synchronous event execution
   // on the main thread, which may attempt to acquire any held monitor.
   virtual void Shutdown() = 0;
 
   // Write audio data to the audio hardware.  aBuf is an array of AudioDataValues
   // AudioDataValue of length aFrames*mChannels.  If aFrames is larger
deleted file mode 100644
--- a/dom/ipc/AudioChild.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set sw=2 ts=2 et tw=80 : */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/dom/AudioChild.h"
-
-namespace mozilla {
-namespace dom {
-NS_IMPL_THREADSAFE_ADDREF(AudioChild);
-NS_IMPL_THREADSAFE_RELEASE(AudioChild);
-
-AudioChild::AudioChild()
-  : mLastPosition(-1),
-    mLastPositionTimestamp(0),
-    mWriteCounter(0),
-    mMinWriteSize(-2),// Initial value, -2, error on -1
-    mAudioReentrantMonitor("AudioChild.mReentrantMonitor"),
-    mIPCOpen(true),
-    mDrained(false)
-{
-  MOZ_COUNT_CTOR(AudioChild);
-}
-
-AudioChild::~AudioChild()
-{
-  MOZ_COUNT_DTOR(AudioChild);
-}
-
-void
-AudioChild::ActorDestroy(ActorDestroyReason aWhy)
-{
-  mIPCOpen = false;
-}
-
-bool
-AudioChild::RecvPositionInFramesUpdate(const int64_t& position,
-                                       const int64_t& time)
-{
-  mLastPosition = position;
-  mLastPositionTimestamp = time;
-  return true;
-}
-
-bool
-AudioChild::RecvDrainDone()
-{
-  ReentrantMonitorAutoEnter mon(mAudioReentrantMonitor);
-  mDrained = true;
-  mAudioReentrantMonitor.NotifyAll();
-  return true;
-}
-
-int32_t
-AudioChild::WaitForMinWriteSize()
-{
-  ReentrantMonitorAutoEnter mon(mAudioReentrantMonitor);
-  // -2 : initial value
-  while (mMinWriteSize == -2 && mIPCOpen) {
-    mAudioReentrantMonitor.Wait();
-  }
-  return mMinWriteSize;
-}
-
-bool
-AudioChild::RecvMinWriteSizeDone(const int32_t& minFrames)
-{
-  ReentrantMonitorAutoEnter mon(mAudioReentrantMonitor);
-  mMinWriteSize = minFrames;
-  mAudioReentrantMonitor.NotifyAll();
-  return true;
-}
-
-void
-AudioChild::WaitForDrain()
-{
-  ReentrantMonitorAutoEnter mon(mAudioReentrantMonitor);
-  while (!mDrained && mIPCOpen) {
-    mAudioReentrantMonitor.Wait();
-  }
-}
-
-bool
-AudioChild::RecvWriteDone()
-{
-  ReentrantMonitorAutoEnter mon(mAudioReentrantMonitor);
-  mWriteCounter += 1;
-  mAudioReentrantMonitor.NotifyAll();
-  return true;
-}
-
-void
-AudioChild::WaitForWrite()
-{
-  ReentrantMonitorAutoEnter mon(mAudioReentrantMonitor);
-  uint64_t writeCounter = mWriteCounter;
-  while (mWriteCounter == writeCounter && mIPCOpen) {
-    mAudioReentrantMonitor.Wait();
-  }
-}
-
-int64_t
-AudioChild::GetLastKnownPosition()
-{
-  return mLastPosition;
-}
-
-int64_t
-AudioChild::GetLastKnownPositionTimestamp()
-{
-  return mLastPositionTimestamp;
-}
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/ipc/AudioChild.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim: set sw=4 ts=8 et tw=80 : */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_dom_AudioChild_h
-#define mozilla_dom_AudioChild_h
-
-#include "mozilla/dom/PAudioChild.h"
-#include "mozilla/ReentrantMonitor.h"
-
-namespace mozilla {
-namespace dom {
-
-class AudioChild : public PAudioChild
-{
- public:
-    NS_IMETHOD_(nsrefcnt) AddRef();
-    NS_IMETHOD_(nsrefcnt) Release();
-
-    AudioChild();
-    virtual ~AudioChild();
-    virtual bool RecvPositionInFramesUpdate(const int64_t&, const int64_t&);
-    virtual bool RecvDrainDone();
-    virtual int32_t WaitForMinWriteSize();
-    virtual bool RecvMinWriteSizeDone(const int32_t& frameCount);
-    virtual void WaitForDrain();
-    virtual bool RecvWriteDone();
-    virtual void WaitForWrite();
-    virtual void ActorDestroy(ActorDestroyReason);
-
-    int64_t GetLastKnownPosition();
-    int64_t GetLastKnownPositionTimestamp();
-
-    bool IsIPCOpen() { return mIPCOpen; };
- private:
-    nsAutoRefCnt mRefCnt;
-    NS_DECL_OWNINGTHREAD
-    int64_t mLastPosition;
-    int64_t mLastPositionTimestamp;
-    uint64_t mWriteCounter;
-    int32_t mMinWriteSize;
-    mozilla::ReentrantMonitor mAudioReentrantMonitor;
-    bool mIPCOpen;
-    bool mDrained;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif
deleted file mode 100644
--- a/dom/ipc/AudioParent.cpp
+++ /dev/null
@@ -1,341 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set sw=2 ts=8 et tw=80 : */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/dom/AudioParent.h"
-#include "mozilla/unused.h"
-#include "nsThreadUtils.h"
-#include "AudioChannelCommon.h"
-
-// C++ file contents
-namespace mozilla {
-namespace dom {
-
-class AudioWriteDoneEvent : public nsRunnable
-{
- public:
-  AudioWriteDoneEvent(AudioParent* owner)
-  {
-    mOwner = owner;
-  }
-
-  NS_IMETHOD Run()
-  {
-    mOwner->SendWriteDone();
-    return NS_OK;
-  }
-
- private:
-    nsRefPtr<AudioParent> mOwner;
-};
-
-class AudioWriteEvent : public nsRunnable
-{
- public:
-  AudioWriteEvent(AudioParent* parent, AudioStream* owner, nsCString data, uint32_t frames)
-  {
-    mParent = parent;
-    mOwner = owner;
-    mData  = data;
-    mFrames = frames;
-  }
-
-  NS_IMETHOD Run()
-  {
-    mOwner->Write(reinterpret_cast<const AudioDataValue*>(mData.get()), mFrames);
-    nsCOMPtr<nsIRunnable> event = new AudioWriteDoneEvent(mParent);
-    NS_DispatchToMainThread(event);
-    return NS_OK;
-  }
-
- private:
-    nsRefPtr<AudioParent> mParent;
-    nsRefPtr<AudioStream> mOwner;
-    nsCString mData;
-    uint32_t  mFrames;
-};
-
-class AudioPauseEvent : public nsRunnable
-{
- public:
-  AudioPauseEvent(AudioStream* owner, bool aPause)
-  {
-    mOwner = owner;
-    mPause = aPause;
-  }
-
-  NS_IMETHOD Run()
-  {
-    if (mPause)
-        mOwner->Pause();
-    else
-        mOwner->Resume();
-    return NS_OK;
-  }
-
- private:
-    nsRefPtr<AudioStream> mOwner;
-    bool mPause;
-};
-
-class AudioStreamShutdownEvent : public nsRunnable
-{
- public:
-  AudioStreamShutdownEvent(AudioStream* owner)
-  {
-    mOwner = owner;
-  }
-
-  NS_IMETHOD Run()
-  {
-    mOwner->Shutdown();
-    return NS_OK;
-  }
-
- private:
-    nsRefPtr<AudioStream> mOwner;
-};
-
-
-class AudioMinWriteSizeDone : public nsRunnable
-{
- public:
-  AudioMinWriteSizeDone(AudioParent* owner, int32_t minFrames)
-  {
-    mOwner = owner;
-    mMinFrames = minFrames;
-  }
-
-  NS_IMETHOD Run()
-  {
-    mOwner->SendMinWriteSizeDone(mMinFrames);
-    return NS_OK;
-  }
-
- private:
-    nsRefPtr<AudioParent> mOwner;
-    int32_t mMinFrames;
-};
-
-class AudioMinWriteSizeEvent : public nsRunnable
-{
- public:
-  AudioMinWriteSizeEvent(AudioParent* parent, AudioStream* owner)
-  {
-    mParent = parent;
-    mOwner = owner;
-  }
-
-  NS_IMETHOD Run()
-  {
-    int32_t minFrames = mOwner->GetMinWriteSize();
-    nsCOMPtr<nsIRunnable> event = new AudioMinWriteSizeDone(mParent, minFrames);
-    NS_DispatchToMainThread(event);
-    return NS_OK;
-  }
-
- private:
-    nsRefPtr<AudioStream> mOwner;
-    nsRefPtr<AudioParent> mParent;
-};
-
-class AudioDrainDoneEvent : public nsRunnable
-{
- public:
-  AudioDrainDoneEvent(AudioParent* owner)
-  {
-    mOwner = owner;
-  }
-
-  NS_IMETHOD Run()
-  {
-    mOwner->SendDrainDone();
-    return NS_OK;
-  }
-
- private:
-    nsRefPtr<AudioParent> mOwner;
-};
-
-class AudioDrainEvent : public nsRunnable
-{
- public:
-  AudioDrainEvent(AudioParent* parent, AudioStream* owner)
-  {
-    mParent = parent;
-    mOwner = owner;
-  }
-
-  NS_IMETHOD Run()
-  {
-    mOwner->Drain();
-    nsCOMPtr<nsIRunnable> event = new AudioDrainDoneEvent(mParent);
-    NS_DispatchToMainThread(event);
-    return NS_OK;
-  }
-
- private:
-    nsRefPtr<AudioStream> mOwner;
-    nsRefPtr<AudioParent> mParent;
-};
-
-NS_IMPL_THREADSAFE_ISUPPORTS1(AudioParent, nsITimerCallback)
-
-nsresult
-AudioParent::Notify(nsITimer* timer)
-{
-  if (!mIPCOpen) {
-    timer->Cancel();
-    return NS_ERROR_FAILURE;
-  }
-
-  NS_ASSERTION(mStream, "AudioStream not initialized.");
-  int64_t position = mStream->GetPositionInFrames();
-  unused << SendPositionInFramesUpdate(position, PR_IntervalNow());
-  return NS_OK;
-}
-
-bool
-AudioParent::RecvWrite(const nsCString& data, const uint32_t& frames)
-{
-  if (!mStream)
-    return false;
-  nsCOMPtr<nsIRunnable> event = new AudioWriteEvent(this, mStream, data, frames);
-  nsCOMPtr<nsIThread> thread = mStream->GetThread();
-  thread->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
-  return true;
-}
-
-bool
-AudioParent::RecvSetVolume(const float& aVolume)
-{
-  if (!mStream)
-      return false;
-  mStream->SetVolume(aVolume);
-  return true;
-}
-
-bool
-AudioParent::RecvMinWriteSize()
-{
-  if (!mStream)
-    return false;
-  nsCOMPtr<nsIRunnable> event = new AudioMinWriteSizeEvent(this, mStream);
-  nsCOMPtr<nsIThread> thread = mStream->GetThread();
-  thread->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
-  return true;
-}
-
-bool
-AudioParent::RecvDrain()
-{
-  if (!mStream)
-    return false;
-  nsCOMPtr<nsIRunnable> event = new AudioDrainEvent(this, mStream);
-  nsCOMPtr<nsIThread> thread = mStream->GetThread();
-  thread->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
-  return true;
-}
-
-bool
-AudioParent::RecvPause()
-{
-  if (!mStream)
-    return false;
-  nsCOMPtr<nsIRunnable> event = new AudioPauseEvent(mStream, true);
-  nsCOMPtr<nsIThread> thread = mStream->GetThread();
-  thread->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
-  return true;
-}
-
-bool
-AudioParent::RecvResume()
-{
-  if (!mStream)
-    return false;
-  nsCOMPtr<nsIRunnable> event = new AudioPauseEvent(mStream, false);
-  nsCOMPtr<nsIThread> thread = mStream->GetThread();
-  thread->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
-  return true;
-}
-
-bool
-AudioParent::RecvShutdown()
-{
-  Shutdown();
-  unused << PAudioParent::Send__delete__(this);
-  return true;
-}
-
-bool
-AudioParent::SendMinWriteSizeDone(int32_t minFrames)
-{
-  if (mIPCOpen)
-    return PAudioParent::SendMinWriteSizeDone(minFrames);
-  return true;
-}
-
-bool
-AudioParent::SendDrainDone()
-{
-  if (mIPCOpen)
-    return PAudioParent::SendDrainDone();
-  return true;
-}
-
-bool
-AudioParent::SendWriteDone()
-{
-  if (mIPCOpen)
-    return PAudioParent::SendWriteDone();
-  return true;
-}
-
-AudioParent::AudioParent(int32_t aNumChannels, int32_t aRate)
-  : mIPCOpen(true)
-{
-  mStream = AudioStream::AllocateStream();
-  NS_ASSERTION(mStream, "AudioStream allocation failed.");
-
-  if (NS_FAILED(mStream->Init(aNumChannels, aRate, AUDIO_CHANNEL_NORMAL))) {
-      NS_WARNING("AudioStream initialization failed.");
-      mStream = nullptr;
-      return;
-  }
-
-  mTimer = do_CreateInstance("@mozilla.org/timer;1");
-  mTimer->InitWithCallback(this, 1000, nsITimer::TYPE_REPEATING_SLACK);
-}
-
-AudioParent::~AudioParent()
-{
-}
-
-void
-AudioParent::ActorDestroy(ActorDestroyReason aWhy)
-{
-  mIPCOpen = false;
-
-  Shutdown();
-}
-
-void
-AudioParent::Shutdown()
-{
-  if (mTimer) {
-    mTimer->Cancel();
-    mTimer = nullptr;
-  }
-
-  if (mStream) {
-      nsCOMPtr<nsIRunnable> event = new AudioStreamShutdownEvent(mStream);
-      nsCOMPtr<nsIThread> thread = mStream->GetThread();
-      thread->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
-      mStream = nullptr;
-  }
-}
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/ipc/AudioParent.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim: set sw=4 ts=8 et tw=80 : */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_dom_AudioParent_h
-#define mozilla_dom_AudioParent_h
-
-#include "mozilla/dom/PAudioParent.h"
-#include "AudioStream.h"
-#include "nsITimer.h"
-
-namespace mozilla {
-namespace dom {
-class AudioParent : public PAudioParent, public nsITimerCallback
-{
- public:
-
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSITIMERCALLBACK
-
-    virtual bool
-    RecvWrite(const nsCString& data, const uint32_t& count);
-
-    virtual bool
-    RecvSetVolume(const float& aVolume);
-
-    virtual bool
-    RecvMinWriteSize();
-
-    virtual bool
-    RecvDrain();
-
-    virtual bool
-    RecvPause();
-
-    virtual bool
-    RecvResume();
-
-    virtual bool
-    RecvShutdown();
-
-    virtual bool
-    SendMinWriteSizeDone(int32_t minFrames);
-
-    virtual bool
-    SendDrainDone();
-
-    virtual bool
-    SendWriteDone();
-
-    AudioParent(int32_t aNumChannels, int32_t aRate);
-    virtual ~AudioParent();
-    virtual void ActorDestroy(ActorDestroyReason);
-
-    nsRefPtr<AudioStream> mStream;
-    nsCOMPtr<nsITimer> mTimer;
-
-private:
-    void Shutdown();
-
-    bool mIPCOpen;
-};
-} // namespace dom
-} // namespace mozilla
-
-#endif
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -10,38 +10,32 @@
 
 #ifdef MOZ_WIDGET_QT
 #include "nsQAppInstance.h"
 #endif
 
 #include "ContentChild.h"
 #include "CrashReporterChild.h"
 #include "TabChild.h"
-#if defined(MOZ_SYDNEYAUDIO)
-#include "AudioChild.h"
-#endif
 
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/ExternalHelperAppChild.h"
 #include "mozilla/dom/PCrashReporterChild.h"
 #include "mozilla/dom/StorageChild.h"
 #include "mozilla/Hal.h"
 #include "mozilla/hal_sandbox/PHalChild.h"
 #include "mozilla/ipc/TestShellChild.h"
 #include "mozilla/ipc/XPCShellEnvironment.h"
 #include "mozilla/jsipc/PContextWrapperChild.h"
 #include "mozilla/layers/CompositorChild.h"
 #include "mozilla/layers/ImageBridgeChild.h"
 #include "mozilla/layers/PCompositorChild.h"
 #include "mozilla/net/NeckoChild.h"
 #include "mozilla/Preferences.h"
 
-#if defined(MOZ_SYDNEYAUDIO)
-#include "AudioStream.h"
-#endif
 #include "nsIMemoryReporter.h"
 #include "nsIMemoryInfoDumper.h"
 #include "nsIObserverService.h"
 #include "nsTObserverArray.h"
 #include "nsIObserver.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsServiceManagerUtils.h"
 #include "nsXULAppAPI.h"
@@ -657,39 +651,16 @@ ContentChild::DeallocPTestShell(PTestShe
 
 bool
 ContentChild::RecvPTestShellConstructor(PTestShellChild* actor)
 {
     actor->SendPContextWrapperConstructor()->SendPObjectWrapperConstructor(true);
     return true;
 }
 
-PAudioChild*
-ContentChild::AllocPAudio(const int32_t& numChannels,
-                          const int32_t& rate)
-{
-#if defined(MOZ_SYDNEYAUDIO)
-    AudioChild *child = new AudioChild();
-    NS_ADDREF(child);
-    return child;
-#else
-    return nullptr;
-#endif
-}
-
-bool
-ContentChild::DeallocPAudio(PAudioChild* doomed)
-{
-#if defined(MOZ_SYDNEYAUDIO)
-    AudioChild *child = static_cast<AudioChild*>(doomed);
-    NS_RELEASE(child);
-#endif
-    return true;
-}
-
 PDeviceStorageRequestChild*
 ContentChild::AllocPDeviceStorageRequest(const DeviceStorageParams& aParams)
 {
     return new DeviceStorageRequestChild();
 }
 
 bool
 ContentChild::DeallocPDeviceStorageRequest(PDeviceStorageRequestChild* aDeviceStorage)
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -118,20 +118,16 @@ public:
     virtual bool
     RecvDumpGCAndCCLogsToFile(const nsString& aIdentifier,
                               const bool& aDumpChildProcesses);
 
     virtual PTestShellChild* AllocPTestShell();
     virtual bool DeallocPTestShell(PTestShellChild*);
     virtual bool RecvPTestShellConstructor(PTestShellChild*);
 
-    virtual PAudioChild* AllocPAudio(const int32_t&,
-                                     const int32_t&);
-    virtual bool DeallocPAudio(PAudioChild*);
-
     virtual PNeckoChild* AllocPNecko();
     virtual bool DeallocPNecko(PNeckoChild*);
 
     virtual PExternalHelperAppChild *AllocPExternalHelperApp(
             const OptionalURIParams& uri,
             const nsCString& aMimeContentType,
             const nsCString& aContentDisposition,
             const bool& aForceSave,
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -87,20 +87,16 @@
 # include "nsExceptionHandler.h"
 # include "nsICrashReporter.h"
 #endif
 
 #ifdef MOZ_PERMISSIONS
 # include "nsPermissionManager.h"
 #endif
 
-#ifdef MOZ_SYDNEYAUDIO
-# include "AudioParent.h"
-#endif
-
 #ifdef MOZ_WIDGET_ANDROID
 # include "AndroidBridge.h"
 #endif
 
 #ifdef MOZ_WIDGET_GONK
 #include "nsIVolume.h"
 #include "nsIVolumeService.h"
 #endif
@@ -1437,39 +1433,16 @@ ContentParent::AllocPTestShell()
 
 bool
 ContentParent::DeallocPTestShell(PTestShellParent* shell)
 {
   delete shell;
   return true;
 }
  
-PAudioParent*
-ContentParent::AllocPAudio(const int32_t& numChannels,
-                           const int32_t& rate)
-{
-#if defined(MOZ_SYDNEYAUDIO)
-    AudioParent *parent = new AudioParent(numChannels, rate);
-    NS_ADDREF(parent);
-    return parent;
-#else
-    return nullptr;
-#endif
-}
-
-bool
-ContentParent::DeallocPAudio(PAudioParent* doomed)
-{
-#if defined(MOZ_SYDNEYAUDIO)
-    AudioParent *parent = static_cast<AudioParent*>(doomed);
-    NS_RELEASE(parent);
-#endif
-    return true;
-}
-
 PNeckoParent* 
 ContentParent::AllocPNecko()
 {
     return new NeckoParent();
 }
 
 bool 
 ContentParent::DeallocPNecko(PNeckoParent* necko)
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -212,20 +212,16 @@ private:
     RecvPIndexedDBConstructor(PIndexedDBParent* aActor);
 
     virtual PMemoryReportRequestParent* AllocPMemoryReportRequest();
     virtual bool DeallocPMemoryReportRequest(PMemoryReportRequestParent* actor);
 
     virtual PTestShellParent* AllocPTestShell();
     virtual bool DeallocPTestShell(PTestShellParent* shell);
 
-    virtual PAudioParent* AllocPAudio(const int32_t&,
-                                     const int32_t&);
-    virtual bool DeallocPAudio(PAudioParent*);
-
     virtual PNeckoParent* AllocPNecko();
     virtual bool DeallocPNecko(PNeckoParent* necko);
 
     virtual PExternalHelperAppParent* AllocPExternalHelperApp(
             const OptionalURIParams& aUri,
             const nsCString& aMimeContentType,
             const nsCString& aContentDisposition,
             const bool& aForceSave,
--- a/dom/ipc/Makefile.in
+++ b/dom/ipc/Makefile.in
@@ -64,27 +64,16 @@ CPPSRCS = \
   ProcessPriorityManager.cpp \
   StructuredCloneUtils.cpp \
   TabParent.cpp \
   TabChild.cpp \
   TabContext.cpp \
   TabMessageUtils.cpp \
   $(NULL)
 
-ifdef MOZ_SYDNEYAUDIO
-EXPORTS_mozilla/dom += \
-  AudioChild.h \
-  AudioParent.h \
-  $(NULL)
-CPPSRCS += \
-  AudioChild.cpp \
-  AudioParent.cpp \
-  $(NULL)
-endif
-
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES += \
 	-I$(srcdir)/../../content/base/src \
 	-I$(srcdir)/../../content/events/src \
 	-I$(srcdir)/../../docshell/base \
deleted file mode 100644
--- a/dom/ipc/PAudio.ipdl
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim: set sw=4 ts=8 et tw=80 : */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-include protocol PContent;
-
-namespace mozilla {
-namespace dom {
-
-protocol PAudio
-{
-  manager PContent;
-
-parent:
-
-  Write(nsCString data, uint32_t frames);
-
-  SetVolume(float aVolume);
-
-  MinWriteSize();
-  Drain();
-
-  Pause();
-  Resume();
-  Shutdown();
-
- child:
-
-  __delete__();
-
-  PositionInFramesUpdate(int64_t position, int64_t time);
-  MinWriteSizeDone(int32_t frameCount);
-  DrainDone();
-  WriteDone();
-};
-
-} // namespace dom
-} // namespace mozilla
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -1,15 +1,14 @@
 /* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */
 /* vim: set sw=4 ts=8 et tw=80 ft=cpp : */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-include protocol PAudio;
 include protocol PBlob;
 include protocol PBluetooth;
 include protocol PBrowser;
 include protocol PCompositor;
 include protocol PCrashReporter;
 include protocol PExternalHelperApp;
 include protocol PDeviceStorageRequest;
 include protocol PHal;
@@ -208,17 +207,16 @@ struct PrefSetting {
   MaybePrefValue userValue;
 };
 
 rpc protocol PContent
 {
     parent opens PCompositor;
     parent opens PImageBridge;
 
-    manages PAudio;
     manages PBlob;
     manages PBluetooth;
     manages PBrowser;
     manages PCrashReporter;
     manages PDeviceStorageRequest;
     manages PExternalHelperApp;
     manages PHal;
     manages PIndexedDB;
@@ -330,18 +328,16 @@ parent:
      * !isForBrowser|, we're probably loading <xul:browser remote>.
      */
     sync GetProcessAttributes()
         returns (uint64_t id, bool startBackground,
                  bool isForApp, bool isForBrowser);
     sync GetXPCOMProcessAttributes()
         returns (bool isOffline);
 
-    PAudio(int32_t aNumChannels, int32_t aRate);
-
     PDeviceStorageRequest(DeviceStorageParams params);
 
     sync PCrashReporter(NativeThreadId tid, uint32_t processType);
 
     PHal();
 
     PIndexedDB();
 
--- a/dom/ipc/ipdl.mk
+++ b/dom/ipc/ipdl.mk
@@ -1,15 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 IPDLSRCS = \
   DOMTypes.ipdlh \
-  PAudio.ipdl \
   PBlob.ipdl \
   PBlobStream.ipdl \
   PBrowser.ipdl \
   PContent.ipdl \
   PContentDialog.ipdl \
   PCrashReporter.ipdl \
   PDocumentRenderer.ipdl \
   PContentPermissionRequest.ipdl \