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

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

34 lines
639 B
C++

#ifndef __JITTER_BUFFER_H__
#define __JITTER_BUFFER_H__
#include <iostream>
#include <queue>
#include <iomanip>
#include <pthread.h>
#include "EncodedAudioData.h"
class CompareSequence {
public:
bool operator()(EncodedAudioData *lh, EncodedAudioData *rh)
{
return lh->getSequence() > rh->getSequence();
}
};
class JitterBuffer {
private:
pthread_mutex_t lock;
std::priority_queue<EncodedAudioData*, std::vector<EncodedAudioData*>, CompareSequence> pendingAudio;
public:
JitterBuffer();
void addAudio(int64_t sequence, char* encodedAudio, int encodedAudioLen);
EncodedAudioData* getAudio();
};
#endif