添加流创建时间、在线时间

This commit is contained in:
xiongziliang
2020-10-01 18:57:15 +08:00
parent cd27e5a9f9
commit a1de3bfd30
4 changed files with 20 additions and 2 deletions

View File

@@ -43,6 +43,7 @@ MediaSource::MediaSource(const string &schema, const string &vhost, const string
_schema = schema;
_app = app;
_stream_id = stream_id;
_create_stamp = time(NULL);
}
MediaSource::~MediaSource() {
@@ -70,6 +71,15 @@ int MediaSource::getBytesSpeed(){
return _speed.getSpeed();
}
uint64_t MediaSource::getCreateStamp() const {
return _create_stamp;
}
uint64_t MediaSource::getAliveSecond() const {
//使用Ticker对象获取存活时间的目的是防止修改系统时间导致回退
return _ticker.createdTime() / 1000;
}
vector<Track::Ptr> MediaSource::getTracks(bool ready) const {
auto listener = _listener.lock();
if(!listener){