mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 10:40:05 +08:00
时间戳处理新增接口支持获取相对时间戳
This commit is contained in:
parent
e08bb73604
commit
dfd37ff350
@ -20,6 +20,15 @@ using namespace toolkit;
|
|||||||
|
|
||||||
namespace mediakit {
|
namespace mediakit {
|
||||||
|
|
||||||
|
int64_t DeltaStamp::relativeStamp(int64_t stamp) {
|
||||||
|
_relative_stamp += deltaStamp(stamp);
|
||||||
|
return _relative_stamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t DeltaStamp::relativeStamp(){
|
||||||
|
return _relative_stamp;
|
||||||
|
}
|
||||||
|
|
||||||
int64_t DeltaStamp::deltaStamp(int64_t stamp) {
|
int64_t DeltaStamp::deltaStamp(int64_t stamp) {
|
||||||
if(!_last_stamp){
|
if(!_last_stamp){
|
||||||
//第一次计算时间戳增量,时间戳增量为0
|
//第一次计算时间戳增量,时间戳增量为0
|
||||||
|
@ -28,9 +28,12 @@ public:
|
|||||||
* @return 时间戳增量
|
* @return 时间戳增量
|
||||||
*/
|
*/
|
||||||
int64_t deltaStamp(int64_t stamp);
|
int64_t deltaStamp(int64_t stamp);
|
||||||
|
int64_t relativeStamp(int64_t stamp);
|
||||||
|
int64_t relativeStamp();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int64_t _last_stamp = 0;
|
int64_t _last_stamp = 0;
|
||||||
|
int64_t _relative_stamp = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
//该类解决时间戳回环、回退问题
|
//该类解决时间戳回环、回退问题
|
||||||
|
Loading…
Reference in New Issue
Block a user