summaryrefslogtreecommitdiffstats
path: root/dom/media/webrtc/AudioOutputObserver.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/media/webrtc/AudioOutputObserver.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/webrtc/AudioOutputObserver.h')
-rw-r--r--dom/media/webrtc/AudioOutputObserver.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/dom/media/webrtc/AudioOutputObserver.h b/dom/media/webrtc/AudioOutputObserver.h
new file mode 100644
index 000000000..517eaa891
--- /dev/null
+++ b/dom/media/webrtc/AudioOutputObserver.h
@@ -0,0 +1,64 @@
+/* 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 AUDIOOUTPUTOBSERVER_H_
+#define AUDIOOUTPUTOBSERVER_H_
+
+#include "mozilla/StaticPtr.h"
+#include "nsAutoPtr.h"
+#include "AudioMixer.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 MixerCallbackReceiver
+{
+public:
+ AudioOutputObserver();
+
+ NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AudioOutputObserver);
+
+ void MixerCallback(AudioDataValue* aMixedBuffer,
+ AudioSampleFormat aFormat,
+ uint32_t aChannels,
+ uint32_t aFrames,
+ uint32_t aSampleRate) override;
+
+ void Clear();
+ void InsertFarEnd(const AudioDataValue *aBuffer, uint32_t aFrames, bool aOverran,
+ int aFreq, int aChannels, AudioSampleFormat aFormat);
+ uint32_t PlayoutFrequency() { return mPlayoutFreq; }
+ uint32_t PlayoutChannels() { return mPlayoutChannels; }
+
+ FarEndAudioChunk *Pop();
+ uint32_t Size();
+
+private:
+ virtual ~AudioOutputObserver();
+ 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 free(), not delete
+ uint32_t mSamplesSaved;
+};
+
+extern StaticRefPtr<AudioOutputObserver> gFarendObserver;
+
+}
+
+#endif