winlin

use atc for ingest hls aac time.

@@ -657,7 +657,7 @@ public: @@ -657,7 +657,7 @@ public:
657 SrsIngestSrsOutput(SrsHttpUri* rtmp) { 657 SrsIngestSrsOutput(SrsHttpUri* rtmp) {
658 out_rtmp = rtmp; 658 out_rtmp = rtmp;
659 disconnected = false; 659 disconnected = false;
660 - raw_aac_dts = 0; 660 + raw_aac_dts = srs_update_system_time_ms();
661 661
662 req = NULL; 662 req = NULL;
663 io = NULL; 663 io = NULL;
@@ -807,12 +807,14 @@ int SrsIngestSrsOutput::do_on_aac_frame(SrsStream* avs, double duration) @@ -807,12 +807,14 @@ int SrsIngestSrsOutput::do_on_aac_frame(SrsStream* avs, double duration)
807 { 807 {
808 int ret = ERROR_SUCCESS; 808 int ret = ERROR_SUCCESS;
809 809
  810 + u_int32_t duration_ms = (u_int32_t)(duration * 1000);
  811 +
810 // ts tbn to flv tbn. 812 // ts tbn to flv tbn.
811 u_int32_t dts = (u_int32_t)raw_aac_dts; 813 u_int32_t dts = (u_int32_t)raw_aac_dts;
812 - raw_aac_dts += (int64_t)(duration * 1000); 814 + raw_aac_dts += duration_ms;
813 815
814 // got the next msg to calc the delta duration for each audio. 816 // got the next msg to calc the delta duration for each audio.
815 - u_int32_t max_dts = dts + (u_int32_t)(duration * 1000); 817 + u_int32_t max_dts = dts + duration_ms;
816 818
817 // send each frame. 819 // send each frame.
818 while (!avs->empty()) { 820 while (!avs->empty()) {
@@ -852,7 +854,7 @@ int SrsIngestSrsOutput::do_on_aac_frame(SrsStream* avs, double duration) @@ -852,7 +854,7 @@ int SrsIngestSrsOutput::do_on_aac_frame(SrsStream* avs, double duration)
852 } 854 }
853 855
854 // calc the delta of dts, when previous frame output. 856 // calc the delta of dts, when previous frame output.
855 - u_int32_t delta = (duration * 1000) / (avs->size() / frame_size); 857 + u_int32_t delta = duration_ms / (avs->size() / frame_size);
856 dts = (u_int32_t)(srs_min(max_dts, dts + delta)); 858 dts = (u_int32_t)(srs_min(max_dts, dts + delta));
857 } 859 }
858 860