完善写mp4文件

This commit is contained in:
xiongziliang 2019-08-01 22:07:40 +08:00
parent 6c0d89f417
commit 13a6d3ac16
2 changed files with 11 additions and 8 deletions

View File

@ -147,11 +147,12 @@ void Mp4Maker::onTrackFrame(const Frame::Ptr &frame) {
} }
} }
void Mp4Maker::onAllTrackReady() { void Mp4Maker::onTrackReady(const Track::Ptr & track){
//保存所有的track为创建MP4MuxerFile做准备 //保存所有的track为创建MP4MuxerFile做准备
_tracks.emplace_back(getTrack(TrackVideo)); _tracks.emplace_back(track);
_tracks.emplace_back(getTrack(TrackAudio)); if(track->getTrackType() == TrackVideo){
_haveVideo = getTrack(TrackVideo).operator bool(); _haveVideo = true;
}
} }
} /* namespace mediakit */ } /* namespace mediakit */

View File

@ -70,10 +70,12 @@ private:
*/ */
void onTrackFrame(const Frame::Ptr &frame) override ; void onTrackFrame(const Frame::Ptr &frame) override ;
/** /**
* Track准备好了 * track已经准备好ready()true
*/ * sps pps等相关信息了
void onAllTrackReady() override; * @param track
*/
void onTrackReady(const Track::Ptr & track) override;
private: private:
void createFile(); void createFile();
void closeFile(); void closeFile();