content/media/webrtc/AudioOutputObserver.h

Fri, 16 Jan 2015 04:50:19 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 04:50:19 +0100
branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
permissions
-rw-r--r--

Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #ifndef AUDIOOUTPUTOBSERVER_H_
michael@0 6 #define AUDIOOUTPUTOBSERVER_H_
michael@0 7
michael@0 8 #include "mozilla/StaticPtr.h"
michael@0 9
michael@0 10 namespace webrtc {
michael@0 11 class SingleRwFifo;
michael@0 12 }
michael@0 13
michael@0 14 namespace mozilla {
michael@0 15
michael@0 16 typedef struct FarEndAudioChunk_ {
michael@0 17 uint16_t mSamples;
michael@0 18 bool mOverrun;
michael@0 19 int16_t mData[1]; // variable-length
michael@0 20 } FarEndAudioChunk;
michael@0 21
michael@0 22 // XXX Really a singleton currently
michael@0 23 class AudioOutputObserver // : public MSGOutputObserver
michael@0 24 {
michael@0 25 public:
michael@0 26 AudioOutputObserver();
michael@0 27 virtual ~AudioOutputObserver();
michael@0 28
michael@0 29 void Clear();
michael@0 30 void InsertFarEnd(const AudioDataValue *aBuffer, uint32_t aSamples, bool aOverran,
michael@0 31 int aFreq, int aChannels, AudioSampleFormat aFormat);
michael@0 32 uint32_t PlayoutFrequency() { return mPlayoutFreq; }
michael@0 33 uint32_t PlayoutChannels() { return mPlayoutChannels; }
michael@0 34
michael@0 35 FarEndAudioChunk *Pop();
michael@0 36 uint32_t Size();
michael@0 37
michael@0 38 private:
michael@0 39 uint32_t mPlayoutFreq;
michael@0 40 uint32_t mPlayoutChannels;
michael@0 41
michael@0 42 nsAutoPtr<webrtc::SingleRwFifo> mPlayoutFifo;
michael@0 43 uint32_t mChunkSize;
michael@0 44
michael@0 45 // chunking to 10ms support
michael@0 46 nsAutoPtr<FarEndAudioChunk> mSaved;
michael@0 47 uint32_t mSamplesSaved;
michael@0 48 };
michael@0 49
michael@0 50 // XXX until there's a registration API in MSG
michael@0 51 extern StaticAutoPtr<AudioOutputObserver> gFarendObserver;
michael@0 52
michael@0 53 }
michael@0 54
michael@0 55 #endif

mercurial