michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef AUDIOOUTPUTOBSERVER_H_ michael@0: #define AUDIOOUTPUTOBSERVER_H_ michael@0: michael@0: #include "mozilla/StaticPtr.h" michael@0: michael@0: namespace webrtc { michael@0: class SingleRwFifo; michael@0: } michael@0: michael@0: namespace mozilla { michael@0: michael@0: typedef struct FarEndAudioChunk_ { michael@0: uint16_t mSamples; michael@0: bool mOverrun; michael@0: int16_t mData[1]; // variable-length michael@0: } FarEndAudioChunk; michael@0: michael@0: // XXX Really a singleton currently michael@0: class AudioOutputObserver // : public MSGOutputObserver michael@0: { michael@0: public: michael@0: AudioOutputObserver(); michael@0: virtual ~AudioOutputObserver(); michael@0: michael@0: void Clear(); michael@0: void InsertFarEnd(const AudioDataValue *aBuffer, uint32_t aSamples, bool aOverran, michael@0: int aFreq, int aChannels, AudioSampleFormat aFormat); michael@0: uint32_t PlayoutFrequency() { return mPlayoutFreq; } michael@0: uint32_t PlayoutChannels() { return mPlayoutChannels; } michael@0: michael@0: FarEndAudioChunk *Pop(); michael@0: uint32_t Size(); michael@0: michael@0: private: michael@0: uint32_t mPlayoutFreq; michael@0: uint32_t mPlayoutChannels; michael@0: michael@0: nsAutoPtr mPlayoutFifo; michael@0: uint32_t mChunkSize; michael@0: michael@0: // chunking to 10ms support michael@0: nsAutoPtr mSaved; michael@0: uint32_t mSamplesSaved; michael@0: }; michael@0: michael@0: // XXX until there's a registration API in MSG michael@0: extern StaticAutoPtr gFarendObserver; michael@0: michael@0: } michael@0: michael@0: #endif