mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-25 12:11:36 +08:00
添加流创建时间、在线时间
This commit is contained in:
parent
cd27e5a9f9
commit
a1de3bfd30
@ -1 +1 @@
|
|||||||
Subproject commit f564c7ed27f141a3b5f08d239970b24d700a1244
|
Subproject commit 735f194e18d5fb576c0da03024226a6f38537e5a
|
@ -395,7 +395,9 @@ void installWebApi() {
|
|||||||
item["vhost"] = media->getVhost();
|
item["vhost"] = media->getVhost();
|
||||||
item["app"] = media->getApp();
|
item["app"] = media->getApp();
|
||||||
item["stream"] = media->getId();
|
item["stream"] = media->getId();
|
||||||
item["bytes_speed"] = media->getBytesSpeed();
|
item["createStamp"] = (Json::UInt64) media->getCreateStamp();
|
||||||
|
item["aliveSecond"] = (Json::UInt64) media->getAliveSecond();
|
||||||
|
item["bytesSpeed"] = media->getBytesSpeed();
|
||||||
item["readerCount"] = media->readerCount();
|
item["readerCount"] = media->readerCount();
|
||||||
item["totalReaderCount"] = media->totalReaderCount();
|
item["totalReaderCount"] = media->totalReaderCount();
|
||||||
item["originType"] = (int) media->getOriginType();
|
item["originType"] = (int) media->getOriginType();
|
||||||
|
@ -43,6 +43,7 @@ MediaSource::MediaSource(const string &schema, const string &vhost, const string
|
|||||||
_schema = schema;
|
_schema = schema;
|
||||||
_app = app;
|
_app = app;
|
||||||
_stream_id = stream_id;
|
_stream_id = stream_id;
|
||||||
|
_create_stamp = time(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaSource::~MediaSource() {
|
MediaSource::~MediaSource() {
|
||||||
@ -70,6 +71,15 @@ int MediaSource::getBytesSpeed(){
|
|||||||
return _speed.getSpeed();
|
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 {
|
vector<Track::Ptr> MediaSource::getTracks(bool ready) const {
|
||||||
auto listener = _listener.lock();
|
auto listener = _listener.lock();
|
||||||
if(!listener){
|
if(!listener){
|
||||||
|
@ -218,6 +218,10 @@ public:
|
|||||||
|
|
||||||
// 获取数据速率,单位bytes/s
|
// 获取数据速率,单位bytes/s
|
||||||
int getBytesSpeed();
|
int getBytesSpeed();
|
||||||
|
// 获取流创建GMT unix时间戳,单位秒
|
||||||
|
uint64_t getCreateStamp() const;
|
||||||
|
// 获取流上线时间,单位秒
|
||||||
|
uint64_t getAliveSecond() const;
|
||||||
|
|
||||||
////////////////MediaSourceEvent相关接口实现////////////////
|
////////////////MediaSourceEvent相关接口实现////////////////
|
||||||
|
|
||||||
@ -282,6 +286,8 @@ protected:
|
|||||||
BytesSpeed _speed;
|
BytesSpeed _speed;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
time_t _create_stamp;
|
||||||
|
Ticker _ticker;
|
||||||
string _schema;
|
string _schema;
|
||||||
string _vhost;
|
string _vhost;
|
||||||
string _app;
|
string _app;
|
||||||
|
Loading…
Reference in New Issue
Block a user