修复死锁的问题

This commit is contained in:
xiongziliang 2020-01-21 11:05:51 +08:00
parent f5187e8b0d
commit ac33592319

View File

@ -266,6 +266,7 @@ private:
} }
void addRecorder(MediaSource &sender){ void addRecorder(MediaSource &sender){
auto tracks = sender.getTracks(needTrackReady());
auto key = getRecorderKey(sender.getVhost(),sender.getApp(),sender.getId()); auto key = getRecorderKey(sender.getVhost(),sender.getApp(),sender.getId());
lock_guard<decltype(_recorder_mtx)> lck(_recorder_mtx); lock_guard<decltype(_recorder_mtx)> lck(_recorder_mtx);
auto it = _recorder_map.find(key); auto it = _recorder_map.find(key);
@ -276,7 +277,6 @@ private:
if(!it->second->isRecording() || it->second->getSchema() == sender.getSchema()){ if(!it->second->isRecording() || it->second->getSchema() == sender.getSchema()){
// 绑定的协议一致或者并未正在录制则替换tracks // 绑定的协议一致或者并未正在录制则替换tracks
auto tracks = sender.getTracks(needTrackReady());
if (!tracks.empty()) { if (!tracks.empty()) {
it->second->attachTracks(std::move(tracks),sender.getSchema()); it->second->attachTracks(std::move(tracks),sender.getSchema());
} }