@@ -65,17 +65,15 @@ SrsDvrSegmenter::~SrsDvrSegmenter()
65
65
srs_freep (fs);
66
66
}
67
67
68
- int SrsDvrSegmenter::initialize (SrsDvrPlan* p, SrsRequest* r)
68
+ srs_error_t SrsDvrSegmenter::initialize (SrsDvrPlan* p, SrsRequest* r)
69
69
{
70
- int ret = ERROR_SUCCESS;
71
-
72
70
req = r;
73
71
plan = p;
74
72
75
73
jitter_algorithm = (SrsRtmpJitterAlgorithm)_srs_config->get_dvr_time_jitter (req->vhost );
76
74
wait_keyframe = _srs_config->get_dvr_wait_keyframe (req->vhost );
77
75
78
- return ret ;
76
+ return srs_success ;
79
77
}
80
78
81
79
SrsFragment* SrsDvrSegmenter::current ()
@@ -612,23 +610,24 @@ SrsDvrPlan::~SrsDvrPlan()
612
610
srs_freep (async);
613
611
}
614
612
615
- int SrsDvrPlan::initialize (SrsOriginHub* h, SrsDvrSegmenter* s, SrsRequest* r)
613
+ srs_error_t SrsDvrPlan::initialize (SrsOriginHub* h, SrsDvrSegmenter* s, SrsRequest* r)
616
614
{
617
615
int ret = ERROR_SUCCESS;
616
+ srs_error_t err = srs_success;
618
617
619
618
hub = h;
620
619
req = r;
621
620
segment = s;
622
621
623
- if ((ret = segment->initialize (this , r)) != ERROR_SUCCESS ) {
624
- return ret ;
622
+ if ((err = segment->initialize (this , r)) != srs_success ) {
623
+ return srs_error_wrap (err, " segmenter " ) ;
625
624
}
626
625
627
626
if ((ret = async->start ()) != ERROR_SUCCESS) {
628
- return ret;
627
+ return srs_error_new ( ret, " async " ) ;
629
628
}
630
629
631
- return ret ;
630
+ return err ;
632
631
}
633
632
634
633
int SrsDvrPlan::on_meta_data (SrsSharedPtrMessage* shared_metadata)
@@ -688,22 +687,19 @@ int SrsDvrPlan::on_reap_segment()
688
687
return ret;
689
688
}
690
689
691
- int SrsDvrPlan::create_plan (string vhost, SrsDvrPlan** pplan)
690
+ srs_error_t SrsDvrPlan::create_plan (string vhost, SrsDvrPlan** pplan)
692
691
{
693
- int ret = ERROR_SUCCESS;
694
-
695
692
std::string plan = _srs_config->get_dvr_plan (vhost);
696
693
if (srs_config_dvr_is_plan_segment (plan)) {
697
694
*pplan = new SrsDvrSegmentPlan ();
698
695
} else if (srs_config_dvr_is_plan_session (plan)) {
699
696
*pplan = new SrsDvrSessionPlan ();
700
697
} else {
701
- ret = ERROR_DVR_ILLEGAL_PLAN;
702
- srs_error (" DVR illegal plan=%s, vhost=%s. ret=%d" , plan.c_str (), vhost.c_str (), ret);
703
- return ret;
698
+ return srs_error_new (ERROR_DVR_ILLEGAL_PLAN, " illegal plan=%s, vhost=%s" ,
699
+ plan.c_str (), vhost.c_str ());
704
700
}
705
701
706
- return ret ;
702
+ return srs_success ;
707
703
}
708
704
709
705
SrsDvrSessionPlan::SrsDvrSessionPlan ()
@@ -766,12 +762,12 @@ SrsDvrSegmentPlan::~SrsDvrSegmentPlan()
766
762
{
767
763
}
768
764
769
- int SrsDvrSegmentPlan::initialize (SrsOriginHub* h, SrsDvrSegmenter* s, SrsRequest* r)
765
+ srs_error_t SrsDvrSegmentPlan::initialize (SrsOriginHub* h, SrsDvrSegmenter* s, SrsRequest* r)
770
766
{
771
- int ret = ERROR_SUCCESS ;
767
+ srs_error_t err = srs_success ;
772
768
773
- if ((ret = SrsDvrPlan::initialize (h, s, r)) != ERROR_SUCCESS ) {
774
- return ret ;
769
+ if ((err = SrsDvrPlan::initialize (h, s, r)) != srs_success ) {
770
+ return srs_error_wrap (err, " segment plan " ) ;
775
771
}
776
772
777
773
wait_keyframe = _srs_config->get_dvr_wait_keyframe (req->vhost );
@@ -780,7 +776,7 @@ int SrsDvrSegmentPlan::initialize(SrsOriginHub* h, SrsDvrSegmenter* s, SrsReques
780
776
// to ms
781
777
cduration *= 1000 ;
782
778
783
- return ret ;
779
+ return srs_success ;
784
780
}
785
781
786
782
int SrsDvrSegmentPlan::on_publish ()
@@ -924,9 +920,9 @@ SrsDvr::~SrsDvr()
924
920
srs_freep (plan);
925
921
}
926
922
927
- int SrsDvr::initialize (SrsOriginHub* h, SrsRequest* r)
923
+ srs_error_t SrsDvr::initialize (SrsOriginHub* h, SrsRequest* r)
928
924
{
929
- int ret = ERROR_SUCCESS ;
925
+ srs_error_t err = srs_success ;
930
926
931
927
req = r;
932
928
hub = h;
@@ -935,8 +931,8 @@ int SrsDvr::initialize(SrsOriginHub* h, SrsRequest* r)
935
931
actived = srs_config_apply_filter (conf, r);
936
932
937
933
srs_freep (plan);
938
- if ((ret = SrsDvrPlan::create_plan (r->vhost , &plan)) != ERROR_SUCCESS ) {
939
- return ret ;
934
+ if ((err = SrsDvrPlan::create_plan (r->vhost , &plan)) != srs_success ) {
935
+ return srs_error_wrap (err, " create plan " ) ;
940
936
}
941
937
942
938
std::string path = _srs_config->get_dvr_path (r->vhost );
@@ -947,11 +943,11 @@ int SrsDvr::initialize(SrsOriginHub* h, SrsRequest* r)
947
943
segmenter = new SrsDvrFlvSegmenter ();
948
944
}
949
945
950
- if ((ret = plan->initialize (hub, segmenter, r)) != ERROR_SUCCESS ) {
951
- return ret ;
946
+ if ((err = plan->initialize (hub, segmenter, r)) != srs_success ) {
947
+ return srs_error_wrap (err, " plan initialize " ) ;
952
948
}
953
949
954
- return ret ;
950
+ return err ;
955
951
}
956
952
957
953
int SrsDvr::on_publish ()
0 commit comments