#ifndef RTC_PACING_HANDLER_H
#define RTC_PACING_HANDLER_H
#if RTC_ENABLE_MEDIA
#include "mediahandler.hpp"
#include "utils.hpp"
#include <atomic>
#include <queue>
namespace rtc {
class RTC_CPP_EXPORT PacingHandler : public MediaHandler {
public:
PacingHandler(double bitsPerSecond, std::chrono::milliseconds sendInterval);
void outgoing(message_vector &messages, const message_callback &send) override;
private:
std::atomic<bool> mHaveScheduled = false;
double mBytesPerSecond;
double mBudget;
std::chrono::milliseconds mSendInterval;
std::chrono::time_point<std::chrono::high_resolution_clock> mLastRun;
std::mutex mMutex;
std::queue<message_ptr> mRtpBuffer;
void schedule(const message_callback &send);
};
}
#endif
#endif