Commit 728fd55e by xiongziliang

修复无法延后录制的bug

parent ae230bc1
...@@ -97,8 +97,7 @@ public: ...@@ -97,8 +97,7 @@ public:
RecorderHelper(const MediaSinkInterface::Ptr &recorder, vector<Track::Ptr> &&tracks , bool bContinueRecord, const string &schema) { RecorderHelper(const MediaSinkInterface::Ptr &recorder, vector<Track::Ptr> &&tracks , bool bContinueRecord, const string &schema) {
_recorder = recorder; _recorder = recorder;
_continueRecord = bContinueRecord; _continueRecord = bContinueRecord;
_schema = schema; attachTracks(std::move(tracks),schema);
attachTracks(std::move(tracks));
} }
~RecorderHelper() { ~RecorderHelper() {
...@@ -106,12 +105,13 @@ public: ...@@ -106,12 +105,13 @@ public:
} }
// 附则于track上 // 附则于track上
void attachTracks(vector<Track::Ptr> &&tracks){ void attachTracks(vector<Track::Ptr> &&tracks, const string &schema){
if(isTracksSame(tracks)){ if(isTracksSame(tracks)){
return; return;
} }
resetTracks(); resetTracks();
_tracks = std::move(tracks); _tracks = std::move(tracks);
_schema = schema;
for (auto &track : _tracks) { for (auto &track : _tracks) {
_recorder->addTrack(track); _recorder->addTrack(track);
track->addDelegate(_recorder); track->addDelegate(_recorder);
...@@ -240,9 +240,9 @@ private: ...@@ -240,9 +240,9 @@ private:
return; return;
} }
if(it->second->getSchema() == schema){ if(!it->second->isRecording() || it->second->getSchema() == schema){
// 绑定的协议一致,替换tracks // 绑定的协议一致,替换tracks
it->second->attachTracks(std::move(tracks)); it->second->attachTracks(std::move(tracks),schema);
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论