content/media/webrtc/AudioOutputObserver.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/webrtc/AudioOutputObserver.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef AUDIOOUTPUTOBSERVER_H_
     1.9 +#define AUDIOOUTPUTOBSERVER_H_
    1.10 +
    1.11 +#include "mozilla/StaticPtr.h"
    1.12 +
    1.13 +namespace webrtc {
    1.14 +class SingleRwFifo;
    1.15 +}
    1.16 +
    1.17 +namespace mozilla {
    1.18 +
    1.19 +typedef struct FarEndAudioChunk_ {
    1.20 +  uint16_t mSamples;
    1.21 +  bool mOverrun;
    1.22 +  int16_t mData[1]; // variable-length
    1.23 +} FarEndAudioChunk;
    1.24 +
    1.25 +// XXX Really a singleton currently
    1.26 +class AudioOutputObserver // : public MSGOutputObserver
    1.27 +{
    1.28 +public:
    1.29 +  AudioOutputObserver();
    1.30 +  virtual ~AudioOutputObserver();
    1.31 +
    1.32 +  void Clear();
    1.33 +  void InsertFarEnd(const AudioDataValue *aBuffer, uint32_t aSamples, bool aOverran,
    1.34 +                    int aFreq, int aChannels, AudioSampleFormat aFormat);
    1.35 +  uint32_t PlayoutFrequency() { return mPlayoutFreq; }
    1.36 +  uint32_t PlayoutChannels() { return mPlayoutChannels; }
    1.37 +
    1.38 +  FarEndAudioChunk *Pop();
    1.39 +  uint32_t Size();
    1.40 +
    1.41 +private:
    1.42 +  uint32_t mPlayoutFreq;
    1.43 +  uint32_t mPlayoutChannels;
    1.44 +
    1.45 +  nsAutoPtr<webrtc::SingleRwFifo> mPlayoutFifo;
    1.46 +  uint32_t mChunkSize;
    1.47 +
    1.48 +  // chunking to 10ms support
    1.49 +  nsAutoPtr<FarEndAudioChunk> mSaved;
    1.50 +  uint32_t mSamplesSaved;
    1.51 +};
    1.52 +
    1.53 +// XXX until there's a registration API in MSG
    1.54 +extern StaticAutoPtr<AudioOutputObserver> gFarendObserver;
    1.55 +
    1.56 +}
    1.57 +
    1.58 +#endif

mercurial