author Mike Hommey <>
Thu, 26 Jun 2014 15:26:16 +0900
changeset 211787 29bbf1aba13a4ebf800dd26810697cf4d25abc4b
parent 206591 dbb05142c66657d6b6928ef24caa2755f5073725
child 217351 8f1296b0c7e4cef98f4e2fe3479085999d89163a
permissions -rw-r--r--
Bug 1030598 - Fix make export race condition after bug 1028563. r=gps

/* 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 */


#include "mozilla/StaticPtr.h"

namespace webrtc {
class SingleRwFifo;

namespace mozilla {

typedef struct FarEndAudioChunk_ {
  uint16_t mSamples;
  bool mOverrun;
  int16_t mData[1]; // variable-length
} FarEndAudioChunk;

// XXX Really a singleton currently
class AudioOutputObserver // : public MSGOutputObserver
  virtual ~AudioOutputObserver();

  void Clear();
  void InsertFarEnd(const AudioDataValue *aBuffer, uint32_t aSamples, bool aOverran,
                    int aFreq, int aChannels, AudioSampleFormat aFormat);
  uint32_t PlayoutFrequency() { return mPlayoutFreq; }
  uint32_t PlayoutChannels() { return mPlayoutChannels; }

  FarEndAudioChunk *Pop();
  uint32_t Size();

  uint32_t mPlayoutFreq;
  uint32_t mPlayoutChannels;

  nsAutoPtr<webrtc::SingleRwFifo> mPlayoutFifo;
  uint32_t mChunkSize;

  // chunking to 10ms support
  FarEndAudioChunk *mSaved; // can't be nsAutoPtr since we need to use moz_free()
  uint32_t mSamplesSaved;

// XXX until there's a registration API in MSG
extern StaticAutoPtr<AudioOutputObserver> gFarendObserver;