1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-12 19:31:53 +00:00

When reopening segment, never update the duration. (#2717). v4.0.219

This commit is contained in:
winlin 2022-01-05 08:29:20 +08:00
parent fbb6d9464c
commit 4d09b8caae
4 changed files with 16 additions and 3 deletions

View file

@ -8,6 +8,7 @@ The changelog for SRS.
## SRS 4.0 Changelog
* v4.0, 2021-01-05, For [#2717](https://github.com/ossrs/srs/issues/2717): When reopening segment, never update the duration. (#2717). v4.0.219
* v4.0, 2021-01-04, Discover api server and ip as candidates. v4.0.218
* v4.0, 2021-01-04, Install test-on self-sign certificate. v4.0.217
* v4.0, 2021-01-03, For [#2824](https://github.com/ossrs/srs/issues/2824): Support config in_docker to fix the detect fail. (#2824). v4.0.216

View file

@ -745,6 +745,7 @@ SrsDvrSegmentPlan::SrsDvrSegmentPlan()
{
cduration = 0;
wait_keyframe = false;
reopening_segment_ = false;
}
SrsDvrSegmentPlan::~SrsDvrSegmentPlan()
@ -845,6 +846,12 @@ srs_error_t SrsDvrSegmentPlan::on_video(SrsSharedPtrMessage* shared_video, SrsFo
srs_error_t SrsDvrSegmentPlan::update_duration(SrsSharedPtrMessage* msg)
{
srs_error_t err = srs_success;
// When reopening the segment, never update the duration, because there is actually no media data.
// @see https://github.com/ossrs/srs/issues/2717
if (reopening_segment_) {
return err;
}
srs_assert(segment);
@ -879,8 +886,11 @@ srs_error_t SrsDvrSegmentPlan::update_duration(SrsSharedPtrMessage* msg)
return srs_error_wrap(err, "segment open");
}
// update sequence header
if ((err = hub->on_dvr_request_sh()) != srs_success) {
// When update sequence header, set the reopening state to prevent infinitely recursive call.
reopening_segment_ = true;
err = hub->on_dvr_request_sh();
reopening_segment_ = false;
if (err != srs_success) {
return srs_error_wrap(err, "request sh");
}

View file

@ -198,6 +198,8 @@ private:
// in config, in srs_utime_t
srs_utime_t cduration;
bool wait_keyframe;
// Whether reopening the DVR file.
bool reopening_segment_;
public:
SrsDvrSegmentPlan();
virtual ~SrsDvrSegmentPlan();

View file

@ -9,6 +9,6 @@
#define VERSION_MAJOR 4
#define VERSION_MINOR 0
#define VERSION_REVISION 218
#define VERSION_REVISION 219
#endif