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

     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/. */
     5 #ifndef AUDIOOUTPUTOBSERVER_H_
     6 #define AUDIOOUTPUTOBSERVER_H_
     8 #include "mozilla/StaticPtr.h"
    10 namespace webrtc {
    11 class SingleRwFifo;
    12 }
    14 namespace mozilla {
    16 typedef struct FarEndAudioChunk_ {
    17   uint16_t mSamples;
    18   bool mOverrun;
    19   int16_t mData[1]; // variable-length
    20 } FarEndAudioChunk;
    22 // XXX Really a singleton currently
    23 class AudioOutputObserver // : public MSGOutputObserver
    24 {
    25 public:
    26   AudioOutputObserver();
    27   virtual ~AudioOutputObserver();
    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; }
    35   FarEndAudioChunk *Pop();
    36   uint32_t Size();
    38 private:
    39   uint32_t mPlayoutFreq;
    40   uint32_t mPlayoutChannels;
    42   nsAutoPtr<webrtc::SingleRwFifo> mPlayoutFifo;
    43   uint32_t mChunkSize;
    45   // chunking to 10ms support
    46   nsAutoPtr<FarEndAudioChunk> mSaved;
    47   uint32_t mSamplesSaved;
    48 };
    50 // XXX until there's a registration API in MSG
    51 extern StaticAutoPtr<AudioOutputObserver> gFarendObserver;
    53 }
    55 #endif

mercurial