From 73e71d26ea713d4faae6d18be9bc1d49f475f121 Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 19 Apr 2019 08:04:09 +0800 Subject: [PATCH] Refine SrsGopCache::start_time in time unit. --- trunk/src/app/srs_app_source.cpp | 10 +++++----- trunk/src/app/srs_app_source.hpp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index def57ae5f..1560a8794 100755 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -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()); } } diff --git a/trunk/src/app/srs_app_source.hpp b/trunk/src/app/srs_app_source.hpp index 0103c98b6..a4c50d96d 100644 --- a/trunk/src/app/srs_app_source.hpp +++ b/trunk/src/app/srs_app_source.hpp @@ -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.