mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
support dvr to hss. change to 0.9.74
This commit is contained in:
parent
e271cb607f
commit
35f3a93239
5 changed files with 185 additions and 24 deletions
|
@ -114,22 +114,34 @@ class SrsFlvSegment
|
|||
{
|
||||
public:
|
||||
/**
|
||||
* current flv file path.
|
||||
* current segment flv file path.
|
||||
*/
|
||||
std::string current_flv_path;
|
||||
std::string path;
|
||||
/**
|
||||
* whether current segment has keyframe.
|
||||
*/
|
||||
bool segment_has_keyframe;
|
||||
bool has_keyframe;
|
||||
/**
|
||||
* current segment duration and starttime.
|
||||
* current segment starttime, RTMP pkt time.
|
||||
*/
|
||||
int64_t duration;
|
||||
int64_t starttime;
|
||||
/**
|
||||
* stream start time, to generate atc pts.
|
||||
* current segment duration
|
||||
*/
|
||||
int64_t duration;
|
||||
/**
|
||||
* stream start time, to generate atc pts. abs time.
|
||||
*/
|
||||
int64_t stream_starttime;
|
||||
/**
|
||||
* stream duration, to generate atc segment.
|
||||
*/
|
||||
int64_t stream_duration;
|
||||
/**
|
||||
* previous stream RTMP pkt time, used to calc the duration.
|
||||
* for the RTMP timestamp will overflow.
|
||||
*/
|
||||
int64_t stream_previous_pkt_time;
|
||||
public:
|
||||
SrsFlvSegment();
|
||||
virtual void reset();
|
||||
|
@ -213,6 +225,28 @@ private:
|
|||
virtual int update_duration(SrsSharedPtrMessage* msg);
|
||||
};
|
||||
|
||||
/**
|
||||
* hss plan: use atc time to reap flv segment
|
||||
*/
|
||||
class SrsDvrHssPlan : public SrsDvrPlan
|
||||
{
|
||||
private:
|
||||
// in config, in ms
|
||||
int segment_duration;
|
||||
// the deviation of starttime of the nature clock time.
|
||||
int start_deviation;
|
||||
int64_t expect_reap_time;
|
||||
public:
|
||||
SrsDvrHssPlan();
|
||||
virtual ~SrsDvrHssPlan();
|
||||
public:
|
||||
virtual int initialize(SrsSource* source, SrsRequest* req);
|
||||
virtual int on_publish();
|
||||
virtual void on_unpublish();
|
||||
private:
|
||||
virtual int update_duration(SrsSharedPtrMessage* msg);
|
||||
};
|
||||
|
||||
/**
|
||||
* dvr(digital video recorder) to record RTMP stream to flv file.
|
||||
* TODO: FIXME: add utest for it.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue