基本废弃 AsyncTaskThread的代码

This commit is contained in:
xiongziliang
2019-01-30 18:11:00 +08:00
parent bf974d5b0c
commit 3f2137db8a
43 changed files with 25 additions and 4776 deletions

View File

@@ -152,9 +152,10 @@ void MediaReader::startReadMP4() {
auto strongSelf = shared_from_this();
GET_CONFIG_AND_REGISTER(uint32_t,sampleMS,Record::kSampleMS);
AsyncTaskThread::Instance().DoTaskDelay(reinterpret_cast<uint64_t>(this), sampleMS, [strongSelf](){
_timer = std::make_shared<Timer>(sampleMS / 1000.0f,[strongSelf](){
return strongSelf->readSample(0,false);
});
}, nullptr);
//先读sampleMS毫秒的数据用于产生MediaSouce
readSample(sampleMS, false);
_mediaMuxer->setListener(strongSelf);
@@ -164,7 +165,7 @@ void MediaReader::startReadMP4() {
return true;
}
bool MediaReader::close(){
AsyncTaskThread::Instance().CancelTask(reinterpret_cast<uint64_t>(this));
_timer.reset();
return true;
}
@@ -292,7 +293,7 @@ void MediaReader::seek(uint32_t iSeekTime,bool bReStart){
_mediaMuxer->setTimeStamp(_iSeekTime);
if(bReStart){
AsyncTaskThread::Instance().CancelTask(reinterpret_cast<uint64_t>(this));
_timer.reset();
startReadMP4();
}
}

View File

@@ -93,6 +93,7 @@ private:
Ticker _ticker;
Ticker _alive;
recursive_mutex _mtx;
Timer::Ptr _timer;
#endif //ENABLE_MP4V2
};