mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
45 lines
1006 B
C
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
|