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:
parent
fbb6d9464c
commit
4d09b8caae
4 changed files with 16 additions and 3 deletions
|
@ -8,6 +8,7 @@ The changelog for SRS.
|
||||||
|
|
||||||
## SRS 4.0 Changelog
|
## 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, 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-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
|
* 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
|
||||||
|
|
|
@ -745,6 +745,7 @@ SrsDvrSegmentPlan::SrsDvrSegmentPlan()
|
||||||
{
|
{
|
||||||
cduration = 0;
|
cduration = 0;
|
||||||
wait_keyframe = false;
|
wait_keyframe = false;
|
||||||
|
reopening_segment_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsDvrSegmentPlan::~SrsDvrSegmentPlan()
|
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 SrsDvrSegmentPlan::update_duration(SrsSharedPtrMessage* msg)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
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);
|
srs_assert(segment);
|
||||||
|
|
||||||
|
@ -879,8 +886,11 @@ srs_error_t SrsDvrSegmentPlan::update_duration(SrsSharedPtrMessage* msg)
|
||||||
return srs_error_wrap(err, "segment open");
|
return srs_error_wrap(err, "segment open");
|
||||||
}
|
}
|
||||||
|
|
||||||
// update sequence header
|
// When update sequence header, set the reopening state to prevent infinitely recursive call.
|
||||||
if ((err = hub->on_dvr_request_sh()) != srs_success) {
|
reopening_segment_ = true;
|
||||||
|
err = hub->on_dvr_request_sh();
|
||||||
|
reopening_segment_ = false;
|
||||||
|
if (err != srs_success) {
|
||||||
return srs_error_wrap(err, "request sh");
|
return srs_error_wrap(err, "request sh");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,6 +198,8 @@ private:
|
||||||
// in config, in srs_utime_t
|
// in config, in srs_utime_t
|
||||||
srs_utime_t cduration;
|
srs_utime_t cduration;
|
||||||
bool wait_keyframe;
|
bool wait_keyframe;
|
||||||
|
// Whether reopening the DVR file.
|
||||||
|
bool reopening_segment_;
|
||||||
public:
|
public:
|
||||||
SrsDvrSegmentPlan();
|
SrsDvrSegmentPlan();
|
||||||
virtual ~SrsDvrSegmentPlan();
|
virtual ~SrsDvrSegmentPlan();
|
||||||
|
|
|
@ -9,6 +9,6 @@
|
||||||
|
|
||||||
#define VERSION_MAJOR 4
|
#define VERSION_MAJOR 4
|
||||||
#define VERSION_MINOR 0
|
#define VERSION_MINOR 0
|
||||||
#define VERSION_REVISION 218
|
#define VERSION_REVISION 219
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue