Refine SrsGopCache::start_time in time unit.

pull/1651/head
winlin 6 years ago
parent 1626942d29
commit 73e71d26ea

@ -698,7 +698,7 @@ bool SrsGopCache::empty()
return gop_cache.empty(); return gop_cache.empty();
} }
int64_t SrsGopCache::start_time() srs_utime_t SrsGopCache::start_time()
{ {
if (empty()) { if (empty()) {
return 0; return 0;
@ -707,7 +707,7 @@ int64_t SrsGopCache::start_time()
SrsSharedPtrMessage* msg = gop_cache[0]; SrsSharedPtrMessage* msg = gop_cache[0];
srs_assert(msg); srs_assert(msg);
return msg->timestamp; return srs_utime_t(msg->timestamp * SRS_UTIME_MILLISECONDS);
} }
bool SrsGopCache::pure_audio() 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, update the sequence header to gop cache time.
if (atc && !gop_cache->empty()) { if (atc && !gop_cache->empty()) {
if (meta->data()) { if (meta->data()) {
meta->data()->timestamp = gop_cache->start_time(); meta->data()->timestamp = srsu2ms(gop_cache->start_time());
} }
if (meta->vsh()) { if (meta->vsh()) {
meta->vsh()->timestamp = gop_cache->start_time(); meta->vsh()->timestamp = srsu2ms(gop_cache->start_time());
} }
if (meta->ash()) { if (meta->ash()) {
meta->ash()->timestamp = gop_cache->start_time(); meta->ash()->timestamp = srsu2ms(gop_cache->start_time());
} }
} }

@ -358,10 +358,10 @@ public:
*/ */
virtual bool empty(); 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. * @return 0 if no packets.
*/ */
virtual int64_t start_time(); virtual srs_utime_t start_time();
/** /**
* whether current stream is pure audio, * whether current stream is pure audio,
* when no video in gop cache, the stream is pure audio right now. * when no video in gop cache, the stream is pure audio right now.

Loading…
Cancel
Save