diff --git a/src/MediaFile/MP4Recorder.cpp b/src/MediaFile/MP4Recorder.cpp index 658243c9..0f36561c 100644 --- a/src/MediaFile/MP4Recorder.cpp +++ b/src/MediaFile/MP4Recorder.cpp @@ -153,6 +153,14 @@ void MP4Recorder::onTrackReady(const Track::Ptr & track){ } } +void MP4Recorder::resetTracks() { + closeFile(); + _tracks.clear(); + _haveVideo = false; + _createFileTicker.resetTime(); + MediaSink::resetTracks(); +} + } /* namespace mediakit */ diff --git a/src/MediaFile/MP4Recorder.h b/src/MediaFile/MP4Recorder.h index ca97cb3f..0c619461 100644 --- a/src/MediaFile/MP4Recorder.h +++ b/src/MediaFile/MP4Recorder.h @@ -63,6 +63,11 @@ public: const string &strApp, const string &strStreamId); virtual ~MP4Recorder(); + + /** + * 重置所有Track + */ + void resetTracks() override; private: /** * 某Track输出frame,在onAllTrackReady触发后才会调用此方法