winlin

refine hls info, show the deviation in seconds and pieces.

@@ -272,6 +272,13 @@ double SrsHlsMuxer::deviation() @@ -272,6 +272,13 @@ double SrsHlsMuxer::deviation()
272 return hls_fragment_deviation; 272 return hls_fragment_deviation;
273 } 273 }
274 274
  275 +int SrsHlsMuxer::absolute_deviation()
  276 +{
  277 + // accept the floor ts for the first piece.
  278 + int64_t floor_ts = (int64_t)(srs_get_system_time_ms() / (1000 * hls_fragment));
  279 + return (int)(accept_floor_ts - (floor_ts - 1));
  280 +}
  281 +
275 int SrsHlsMuxer::initialize(ISrsHlsHandler* h) 282 int SrsHlsMuxer::initialize(ISrsHlsHandler* h)
276 { 283 {
277 int ret = ERROR_SUCCESS; 284 int ret = ERROR_SUCCESS;
@@ -1203,9 +1210,9 @@ void SrsHls::hls_show_mux_log() @@ -1203,9 +1210,9 @@ void SrsHls::hls_show_mux_log()
1203 // the run time is not equals to stream time, 1210 // the run time is not equals to stream time,
1204 // @see: https://github.com/winlinvip/simple-rtmp-server/issues/81#issuecomment-48100994 1211 // @see: https://github.com/winlinvip/simple-rtmp-server/issues/81#issuecomment-48100994
1205 // it's ok. 1212 // it's ok.
1206 - srs_trace("-> "SRS_CONSTS_LOG_HLS" time=%"PRId64", stream dts=%"PRId64"(%"PRId64"ms), sequence_no=%d, ts=%s, duration=%.2f, deviation=%.2f", 1213 + srs_trace("-> "SRS_CONSTS_LOG_HLS" time=%"PRId64", stream dts=%"PRId64"(%"PRId64"ms), sno=%d, ts=%s, dur=%.2f, dva=%.2fs/%dp",
1207 pprint->age(), stream_dts, stream_dts / 90, muxer->sequence_no(), muxer->ts_url().c_str(), 1214 pprint->age(), stream_dts, stream_dts / 90, muxer->sequence_no(), muxer->ts_url().c_str(),
1208 - muxer->duration(), muxer->deviation()); 1215 + muxer->duration(), muxer->deviation(), muxer->absolute_deviation());
1209 } 1216 }
1210 } 1217 }
1211 1218
@@ -237,6 +237,7 @@ public: @@ -237,6 +237,7 @@ public:
237 virtual std::string ts_url(); 237 virtual std::string ts_url();
238 virtual double duration(); 238 virtual double duration();
239 virtual double deviation(); 239 virtual double deviation();
  240 + virtual int absolute_deviation();
240 public: 241 public:
241 /** 242 /**
242 * initialize the hls muxer. 243 * initialize the hls muxer.