#ifndef BITRATE_ESTIMATER_H #define BITRATE_ESTIMATER_H #include #include #include #define BITRATE_ARRAY_SIZE 500 #define BITRATE_ESTIMATE_INTERVAL 5 #define PTS_DISCONTINUE_INTERVAL 1000000 typedef struct BR_ESTIMATER_NODE { int64_t nFramePts; int nFrameLen; }BitrateEstimateNode; typedef struct BitrateEstimater { pthread_mutex_t mutex; int nBitrate; int nWritePos; int nValidNodeCnt; int nWritePosLastEstimate; BitrateEstimateNode nodes[BITRATE_ARRAY_SIZE]; }BitrateEstimater; BitrateEstimater* BitrateEstimaterCreate(void); void BitrateEstimaterDestroy(BitrateEstimater* be); void BitrateEstimaterUpdate(BitrateEstimater* be, int64_t nPts, int nFrameLen); int BitrateEstimaterGetBitrate(BitrateEstimater* be); void BitrateEstimaterReset(BitrateEstimater* be); #endif