session-android/jni/redphone/AudioPlayer.h
Moxie Marlinspike d83a3d71bc Support for Signal calls.
Merge in RedPhone

// FREEBIE
2015-09-30 14:30:09 -07:00

45 lines
1006 B
C++

#ifndef __AUDIO_PLAYER_H__
#define __AUDIO_PLAYER_H__
#include <SLES/OpenSLES.h>
#include <SLES/OpenSLES_Android.h>
#include <SLES/OpenSLES_AndroidConfiguration.h>
#include "WebRtcJitterBuffer.h"
#include "AudioCodec.h"
#include "JitterBuffer.h"
#define SAMPLE_RATE 8000
#define FRAME_RATE 50
#define FRAME_SIZE SAMPLE_RATE / FRAME_RATE
class AudioPlayer {
private:
// JitterBuffer &jitterBuffer;
WebRtcJitterBuffer &webRtcJitterBuffer;
AudioCodec &audioCodec;
// int sampleRate;
// int bufferFrames;
SLObjectItf bqPlayerObject;
SLPlayItf bqPlayerPlay;
SLObjectItf outputMixObject;
SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue;
short outputBuffer[FRAME_SIZE];
public:
AudioPlayer(WebRtcJitterBuffer &jitterBuffer, AudioCodec &audioCodec);
~AudioPlayer();
int start(SLEngineItf *engineEngine);
void stop();
static void playerCallback(SLAndroidSimpleBufferQueueItf bufferQueue, void *context);
void playerCallback(SLAndroidSimpleBufferQueueItf bufferQueue);
};
#endif