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