mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-12 11:14:20 +00:00
d83a3d71bc
Merge in RedPhone // FREEBIE
34 lines
639 B
C++
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 |