HLS: 加速track就绪速度 (#1286)

* 加速track的准备速度

* 重命名为isAllTrackReady

* 无须缓冲帧时,暂不用转换为可缓存帧

Co-authored-by: 夏楚 <771730766@qq.com>
This commit is contained in:
alexliyu7352 2021-12-17 14:47:17 +08:00 committed by GitHub
parent f27893ffa5
commit 0b2e55429d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -108,6 +108,13 @@ public:
*/ */
vector<Track::Ptr> getTracks(bool trackReady = true) const override; vector<Track::Ptr> getTracks(bool trackReady = true) const override;
/**
* track已经准备完成
*/
bool isAllTrackReady() const {
return _all_track_ready;
}
/** /**
* aac静音轨道 * aac静音轨道
*/ */

View File

@ -316,6 +316,12 @@ void HlsDemuxer::start(const EventPoller::Ptr &poller, TrackListener *listener)
} }
bool HlsDemuxer::inputFrame(const Frame::Ptr &frame) { bool HlsDemuxer::inputFrame(const Frame::Ptr &frame) {
//为了避免track准备时间过长, 因此在没准备好之前, 直接消费掉所有的帧
if (!_delegate.isAllTrackReady()) {
_delegate.inputFrame(frame);
return true;
}
//计算相对时间戳 //计算相对时间戳
int64_t dts, pts; int64_t dts, pts;
_stamp[frame->getTrackType()].revise(frame->dts(), frame->pts(), dts, pts); _stamp[frame->getTrackType()].revise(frame->dts(), frame->pts(), dts, pts);