1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Refine SrsGopCache::start_time in time unit.

This commit is contained in:
winlin 2019-04-19 08:04:09 +08:00
parent 1626942d29
commit 73e71d26ea
2 changed files with 7 additions and 7 deletions

View file

@ -698,7 +698,7 @@ bool SrsGopCache::empty()
return gop_cache.empty();
}
int64_t SrsGopCache::start_time()
srs_utime_t SrsGopCache::start_time()
{
if (empty()) {
return 0;
@ -707,7 +707,7 @@ int64_t SrsGopCache::start_time()
SrsSharedPtrMessage* msg = gop_cache[0];
srs_assert(msg);
return msg->timestamp;
return srs_utime_t(msg->timestamp * SRS_UTIME_MILLISECONDS);
}
bool SrsGopCache::pure_audio()
@ -2448,13 +2448,13 @@ srs_error_t SrsSource::create_consumer(SrsConnection* conn, SrsConsumer*& consum
// if atc, update the sequence header to gop cache time.
if (atc && !gop_cache->empty()) {
if (meta->data()) {
meta->data()->timestamp = gop_cache->start_time();
meta->data()->timestamp = srsu2ms(gop_cache->start_time());
}
if (meta->vsh()) {
meta->vsh()->timestamp = gop_cache->start_time();
meta->vsh()->timestamp = srsu2ms(gop_cache->start_time());
}
if (meta->ash()) {
meta->ash()->timestamp = gop_cache->start_time();
meta->ash()->timestamp = srsu2ms(gop_cache->start_time());
}
}

View file

@ -358,10 +358,10 @@ public:
*/
virtual bool empty();
/**
* get the start time of gop cache, in ms.
* get the start time of gop cache, in srs_utime_t.
* @return 0 if no packets.
*/
virtual int64_t start_time();
virtual srs_utime_t start_time();
/**
* whether current stream is pure audio,
* when no video in gop cache, the stream is pure audio right now.