合并#106

This commit is contained in:
xiongziliang 2019-10-11 17:51:46 +08:00
parent d6e60e0919
commit f1ed019437
4 changed files with 18 additions and 27 deletions

View File

@ -61,7 +61,8 @@ void MediaSink::addTrack(const Track::Ptr &track_in) {
}
void MediaSink::resetTracks() {
_anyTrackUnReady = true;
lock_guard<recursive_mutex> lck(_mtx);
_anyTrackUnReady = false;
_allTrackReady = false;
_track_map.clear();
_trackReadyCallback.clear();

View File

@ -85,13 +85,10 @@ void HlsMaker::inputData(void *data, uint32_t len, uint32_t timestamp) {
if (data && len) {
addNewFile(timestamp);
onWriteFile((char *) data, len);
}
else {
_noData = true;
_stampInc = _ticker.elapsedTime();
_seg_dur_list.push_back(std::make_tuple(_stampInc, _last_file_name));
delOldFile();
makeIndexFile();
} else {
//调用resetTracks触发这个时候生成直播hls被中断
//我们记录为点播,等待下次拉流再恢复为直播。
makeIndexFile(true);
}
}
@ -112,12 +109,6 @@ void HlsMaker::delOldFile() {
}
void HlsMaker::addNewFile(uint32_t) {
//上次分片数据中断结束,重置时间避免中途的等待
if (_noData) {
_ticker.resetTime();
_last_file_name = onOpenFile(_file_index++);
_noData = false;
}
_stampInc = _ticker.elapsedTime();
if (_file_index == 0 || _stampInc >= _seg_duration * 1000) {
_ticker.resetTime();

View File

@ -92,7 +92,6 @@ protected:
protected:
uint32_t _seg_number = 0;
private:
bool _noData = false;
int _stampInc = 0;
float _seg_duration = 0;
uint64_t _file_index = 0;

View File

@ -48,22 +48,22 @@ public:
virtual ~MediaRecorder();
/**
* frame
* @param frame
*/
* frame
* @param frame
*/
void inputFrame(const Frame::Ptr &frame) override;
/**
* trackTrack的clone方法
* sps pps这些信息 Delegate相关关系
* @param track
*/
void addTrack(const Track::Ptr & track) override;
* trackTrack的clone方法
* sps pps这些信息 Delegate相关关系
* @param track
*/
void addTrack(const Track::Ptr &track) override;
/**
* track
*/
void resetTracks() override;
/**
* track
*/
void resetTracks() override;
private:
#if defined(ENABLE_HLS)
std::shared_ptr<HlsRecorder> _hlsRecorder;