1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #299, use fragment for dvr FLV/MP4

This commit is contained in:
winlin 2017-03-18 21:41:01 +08:00
parent da4c390d69
commit 8d679a6f9a
5 changed files with 44 additions and 60 deletions

View file

@ -45,6 +45,7 @@ class SrsJsonAny;
class SrsJsonObject;
class SrsThread;
class SrsMp4Encoder;
class SrsFragment;
#include <srs_app_source.hpp>
#include <srs_app_reload.hpp>
@ -60,33 +61,22 @@ protected:
SrsFileWriter* fs;
// Whether wait keyframe to reap segment.
bool wait_keyframe;
// The duration in ms of current segment.
int64_t duration;
private:
// The path of current segment flv file path.
std::string path;
std::string tmp_dvr_file;
// The FLV/MP4 fragment file.
SrsFragment* fragment;
private:
SrsRequest* req;
SrsDvrPlan* plan;
private:
SrsRtmpJitter* jitter;
SrsRtmpJitterAlgorithm jitter_algorithm;
private:
// The previous stream RTMP pkt time in ms, used to calc the duration.
// for the RTMP timestamp will overflow.
// TODO: FIXME: Use utility object to calc it.
int64_t stream_previous_pkt_time;
public:
SrsDvrSegmenter();
virtual ~SrsDvrSegmenter();
public:
// Initialize the segment.
virtual int initialize(SrsDvrPlan* p, SrsRequest* r);
// Get the current dvr path.
virtual std::string get_path();
// Get the duration in ms of segment.
virtual int64_t get_duration();
// Get the current framgnet.
virtual SrsFragment* current();
// Open new segment file.
// @param use_tmp_file Whether use tmp file for DVR, and rename when close.
// @remark Ignore when file is already open.