winlin

fix #177, dvr segment add config dvr_wait_keyframe. 0.9.213.

@@ -208,6 +208,7 @@ Supported operating systems and hardware: @@ -208,6 +208,7 @@ Supported operating systems and hardware:
208 * 2013-10-17, Created.<br/> 208 * 2013-10-17, Created.<br/>
209 209
210 ## History 210 ## History
  211 +* v1.0, 2014-09-25, fix [#177](https://github.com/winlinvip/simple-rtmp-server/issues/177), dvr segment add config dvr_wait_keyframe. 0.9.213.
211 * v1.0, 2014-08-28, fix [#167](https://github.com/winlinvip/simple-rtmp-server/issues/167), add openssl includes to utest. 0.9.209. 212 * v1.0, 2014-08-28, fix [#167](https://github.com/winlinvip/simple-rtmp-server/issues/167), add openssl includes to utest. 0.9.209.
212 * v1.0, 2014-08-27, max connections is 32756, for st use mmap default. 0.9.209 213 * v1.0, 2014-08-27, max connections is 32756, for st use mmap default. 0.9.209
213 * v1.0, 2014-08-24, fix [#150](https://github.com/winlinvip/simple-rtmp-server/issues/150), forward should forward the sequence header when retry. 0.9.208. 214 * v1.0, 2014-08-24, fix [#150](https://github.com/winlinvip/simple-rtmp-server/issues/150), forward should forward the sequence header when retry. 0.9.208.
@@ -10,5 +10,6 @@ vhost __defaultVhost__ { @@ -10,5 +10,6 @@ vhost __defaultVhost__ {
10 dvr_path ./objs/nginx/html; 10 dvr_path ./objs/nginx/html;
11 dvr_plan segment; 11 dvr_plan segment;
12 dvr_duration 30; 12 dvr_duration 30;
  13 + dvr_wait_keyframe on;
13 } 14 }
14 } 15 }
@@ -192,6 +192,12 @@ vhost dvr.srs.com { @@ -192,6 +192,12 @@ vhost dvr.srs.com {
192 # the param for plan(segment), in seconds. 192 # the param for plan(segment), in seconds.
193 # default: 30 193 # default: 30
194 dvr_duration 30; 194 dvr_duration 30;
  195 + # the param for plan(segment),
  196 + # whether wait keyframe to reap segment,
  197 + # if off, reap segment when duration exceed the dvr_duration,
  198 + # if on, reap segment when duration exceed and got keyframe.
  199 + # default: on
  200 + dvr_wait_keyframe on;
195 # about the stream monotonically increasing: 201 # about the stream monotonically increasing:
196 # 1. video timestamp is monotonically increasing, 202 # 1. video timestamp is monotonically increasing,
197 # 2. audio timestamp is monotonically increasing, 203 # 2. audio timestamp is monotonically increasing,
@@ -1301,7 +1301,7 @@ int SrsConfig::check_config() @@ -1301,7 +1301,7 @@ int SrsConfig::check_config()
1301 for (int j = 0; j < (int)conf->directives.size(); j++) { 1301 for (int j = 0; j < (int)conf->directives.size(); j++) {
1302 string m = conf->at(j)->name.c_str(); 1302 string m = conf->at(j)->name.c_str();
1303 if (m != "enabled" && m != "dvr_path" && m != "dvr_plan" 1303 if (m != "enabled" && m != "dvr_path" && m != "dvr_plan"
1304 - && m != "dvr_duration" && m != "time_jitter" 1304 + && m != "dvr_duration" && m != "dvr_wait_keyframe" && m != "time_jitter"
1305 ) { 1305 ) {
1306 ret = ERROR_SYSTEM_CONFIG_INVALID; 1306 ret = ERROR_SYSTEM_CONFIG_INVALID;
1307 srs_error("unsupported vhost dvr directive %s, ret=%d", m.c_str(), ret); 1307 srs_error("unsupported vhost dvr directive %s, ret=%d", m.c_str(), ret);
@@ -2968,6 +2968,23 @@ int SrsConfig::get_dvr_duration(string vhost) @@ -2968,6 +2968,23 @@ int SrsConfig::get_dvr_duration(string vhost)
2968 return ::atoi(conf->arg0().c_str()); 2968 return ::atoi(conf->arg0().c_str());
2969 } 2969 }
2970 2970
  2971 +bool SrsConfig::get_dvr_wait_keyframe(string vhost)
  2972 +{
  2973 + SrsConfDirective* dvr = get_dvr(vhost);
  2974 +
  2975 + if (!dvr) {
  2976 + return true;
  2977 + }
  2978 +
  2979 + SrsConfDirective* conf = dvr->get("dvr_wait_keyframe");
  2980 +
  2981 + if (!conf || conf->arg0() != "off") {
  2982 + return true;
  2983 + }
  2984 +
  2985 + return false;
  2986 +}
  2987 +
2971 int SrsConfig::get_dvr_time_jitter(string vhost) 2988 int SrsConfig::get_dvr_time_jitter(string vhost)
2972 { 2989 {
2973 SrsConfDirective* dvr = get_dvr(vhost); 2990 SrsConfDirective* dvr = get_dvr(vhost);
@@ -850,6 +850,10 @@ public: @@ -850,6 +850,10 @@ public:
850 */ 850 */
851 virtual int get_dvr_duration(std::string vhost); 851 virtual int get_dvr_duration(std::string vhost);
852 /** 852 /**
  853 + * whether wait keyframe to reap segment, for segment plan.
  854 + */
  855 + virtual bool get_dvr_wait_keyframe(std::string vhost);
  856 + /**
853 * get the time_jitter algorithm for dvr. 857 * get the time_jitter algorithm for dvr.
854 */ 858 */
855 virtual int get_dvr_time_jitter(std::string vhost); 859 virtual int get_dvr_time_jitter(std::string vhost);
@@ -256,12 +256,14 @@ int SrsDvrPlan::on_video(SrsSharedPtrMessage* video) @@ -256,12 +256,14 @@ int SrsDvrPlan::on_video(SrsSharedPtrMessage* video)
256 return ret; 256 return ret;
257 } 257 }
258 258
259 - int32_t timestamp = filter_timestamp(video->header.timestamp);  
260 - if ((ret = enc->write_video(timestamp, payload, size)) != ERROR_SUCCESS) { 259 + // update segment duration, session plan just update the duration,
  260 + // the segment plan will reap segment if exceed, this video will write to next segment.
  261 + if ((ret = update_duration(video)) != ERROR_SUCCESS) {
261 return ret; 262 return ret;
262 } 263 }
263 264
264 - if ((ret = update_duration(video)) != ERROR_SUCCESS) { 265 + int32_t timestamp = filter_timestamp(video->header.timestamp);
  266 + if ((ret = enc->write_video(timestamp, payload, size)) != ERROR_SUCCESS) {
265 return ret; 267 return ret;
266 } 268 }
267 269
@@ -478,28 +480,48 @@ int SrsDvrSegmentPlan::update_duration(SrsSharedPtrMessage* msg) @@ -478,28 +480,48 @@ int SrsDvrSegmentPlan::update_duration(SrsSharedPtrMessage* msg)
478 480
479 srs_assert(segment); 481 srs_assert(segment);
480 482
481 - // reap if exceed duration.  
482 - if (segment_duration > 0 && segment->duration > segment_duration) {  
483 - if ((ret = flv_close()) != ERROR_SUCCESS) {  
484 - segment->reset();  
485 - return ret;  
486 - }  
487 - on_unpublish();  
488 -  
489 - // open new flv file  
490 - if ((ret = open_new_segment()) != ERROR_SUCCESS) { 483 + // ignore if duration ok.
  484 + if (segment_duration <= 0 || segment->duration < segment_duration) {
  485 + return ret;
  486 + }
  487 +
  488 + // when wait keyframe, ignore if no frame arrived.
  489 + // @see https://github.com/winlinvip/simple-rtmp-server/issues/177
  490 + if (_srs_config->get_dvr_wait_keyframe(_req->vhost)) {
  491 + if (!msg->header.is_video()) {
491 return ret; 492 return ret;
492 } 493 }
493 494
494 - // update sequence header  
495 - if (sh_video && (ret = SrsDvrPlan::on_video(sh_video)) != ERROR_SUCCESS) {  
496 - return ret;  
497 - }  
498 - if (sh_audio && (ret = SrsDvrPlan::on_audio(sh_audio)) != ERROR_SUCCESS) { 495 + char* payload = (char*)msg->payload;
  496 + int size = (int)msg->size;
  497 + bool is_key_frame = SrsFlvCodec::video_is_h264(payload, size)
  498 + && SrsFlvCodec::video_is_keyframe(payload, size)
  499 + && !SrsFlvCodec::video_is_sequence_header(payload, size);
  500 + if (!is_key_frame) {
499 return ret; 501 return ret;
500 } 502 }
501 } 503 }
502 504
  505 + // reap segment
  506 + if ((ret = flv_close()) != ERROR_SUCCESS) {
  507 + segment->reset();
  508 + return ret;
  509 + }
  510 + on_unpublish();
  511 +
  512 + // open new flv file
  513 + if ((ret = open_new_segment()) != ERROR_SUCCESS) {
  514 + return ret;
  515 + }
  516 +
  517 + // update sequence header
  518 + if (sh_video && (ret = SrsDvrPlan::on_video(sh_video)) != ERROR_SUCCESS) {
  519 + return ret;
  520 + }
  521 + if (sh_audio && (ret = SrsDvrPlan::on_audio(sh_audio)) != ERROR_SUCCESS) {
  522 + return ret;
  523 + }
  524 +
503 return ret; 525 return ret;
504 } 526 }
505 527
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR "0" 32 #define VERSION_MAJOR "0"
33 #define VERSION_MINOR "9" 33 #define VERSION_MINOR "9"
34 -#define VERSION_REVISION "212" 34 +#define VERSION_REVISION "213"
35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION 35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"
@@ -271,6 +271,7 @@ std::string __full_conf = "" @@ -271,6 +271,7 @@ std::string __full_conf = ""
271 " # the param for plan(segment), in seconds. \n" 271 " # the param for plan(segment), in seconds. \n"
272 " # default: 30 \n" 272 " # default: 30 \n"
273 " dvr_duration 30; \n" 273 " dvr_duration 30; \n"
  274 + " dvr_wait_keyframe on; \n"
274 " # about the stream monotonically increasing: \n" 275 " # about the stream monotonically increasing: \n"
275 " # 1. video timestamp is monotonically increasing, \n" 276 " # 1. video timestamp is monotonically increasing, \n"
276 " # 2. audio timestamp is monotonically increasing, \n" 277 " # 2. audio timestamp is monotonically increasing, \n"
@@ -1937,6 +1938,7 @@ VOID TEST(ConfigMainTest, ParseFullConf) @@ -1937,6 +1938,7 @@ VOID TEST(ConfigMainTest, ParseFullConf)
1937 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 1938 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
1938 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 1939 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
1939 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 1940 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  1941 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
1940 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 1942 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
1941 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 1943 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
1942 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 1944 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -2022,6 +2024,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_same_edge) @@ -2022,6 +2024,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_same_edge)
2022 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 2024 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
2023 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 2025 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
2024 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 2026 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  2027 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
2025 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 2028 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
2026 } 2029 }
2027 2030
@@ -2097,6 +2100,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_change_edge) @@ -2097,6 +2100,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_change_edge)
2097 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 2100 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
2098 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 2101 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
2099 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 2102 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  2103 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
2100 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));*/ 2104 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));*/
2101 } 2105 }
2102 2106
@@ -2171,6 +2175,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_dvr) @@ -2171,6 +2175,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_dvr)
2171 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 2175 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
2172 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 2176 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
2173 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 2177 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  2178 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
2174 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 2179 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
2175 } 2180 }
2176 2181
@@ -2266,6 +2271,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_ingest) @@ -2266,6 +2271,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_ingest)
2266 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 2271 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
2267 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 2272 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
2268 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 2273 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  2274 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
2269 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 2275 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
2270 } 2276 }
2271 2277
@@ -2340,6 +2346,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_http) @@ -2340,6 +2346,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_http)
2340 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 2346 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
2341 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 2347 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
2342 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 2348 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  2349 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
2343 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 2350 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
2344 EXPECT_TRUE(conf.get_vhost_http_enabled(vhost)); 2351 EXPECT_TRUE(conf.get_vhost_http_enabled(vhost));
2345 EXPECT_STREQ("/hls", conf.get_vhost_http_mount(vhost).c_str()); 2352 EXPECT_STREQ("/hls", conf.get_vhost_http_mount(vhost).c_str());
@@ -2417,6 +2424,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_hls_enabled) @@ -2417,6 +2424,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_hls_enabled)
2417 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 2424 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
2418 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 2425 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
2419 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 2426 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  2427 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
2420 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 2428 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
2421 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 2429 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
2422 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 2430 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -2494,6 +2502,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_hls_disabled) @@ -2494,6 +2502,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_hls_disabled)
2494 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 2502 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
2495 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 2503 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
2496 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 2504 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  2505 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
2497 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 2506 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
2498 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 2507 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
2499 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 2508 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -2602,6 +2611,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_http_hooks) @@ -2602,6 +2611,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_http_hooks)
2602 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 2611 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
2603 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 2612 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
2604 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 2613 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  2614 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
2605 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 2615 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
2606 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 2616 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
2607 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 2617 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -2680,6 +2690,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_min_delay) @@ -2680,6 +2690,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_min_delay)
2680 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 2690 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
2681 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 2691 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
2682 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 2692 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  2693 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
2683 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 2694 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
2684 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 2695 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
2685 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 2696 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -2773,6 +2784,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_refer_anti_suck) @@ -2773,6 +2784,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_refer_anti_suck)
2773 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 2784 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
2774 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 2785 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
2775 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 2786 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  2787 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
2776 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 2788 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
2777 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 2789 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
2778 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 2790 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -2856,6 +2868,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_forward_same_vhost) @@ -2856,6 +2868,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_forward_same_vhost)
2856 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 2868 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
2857 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 2869 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
2858 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 2870 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  2871 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
2859 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 2872 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
2860 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 2873 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
2861 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 2874 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -2935,6 +2948,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_forward_change_vhost) @@ -2935,6 +2948,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_forward_change_vhost)
2935 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 2948 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
2936 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 2949 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
2937 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 2950 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  2951 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
2938 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 2952 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
2939 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 2953 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
2940 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 2954 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -3024,6 +3038,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_mirror) @@ -3024,6 +3038,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_mirror)
3024 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 3038 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
3025 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 3039 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
3026 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 3040 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  3041 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
3027 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 3042 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
3028 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 3043 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
3029 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 3044 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -3113,6 +3128,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_crop) @@ -3113,6 +3128,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_crop)
3113 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 3128 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
3114 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 3129 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
3115 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 3130 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  3131 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
3116 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 3132 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
3117 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 3133 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
3118 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 3134 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -3202,6 +3218,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_logo) @@ -3202,6 +3218,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_logo)
3202 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 3218 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
3203 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 3219 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
3204 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 3220 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  3221 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
3205 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 3222 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
3206 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 3223 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
3207 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 3224 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -3285,6 +3302,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_audio) @@ -3285,6 +3302,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_audio)
3285 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 3302 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
3286 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 3303 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
3287 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 3304 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  3305 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
3288 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 3306 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
3289 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 3307 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
3290 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 3308 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -3368,6 +3386,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_vn) @@ -3368,6 +3386,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_vn)
3368 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 3386 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
3369 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 3387 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
3370 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 3388 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  3389 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
3371 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 3390 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
3372 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 3391 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
3373 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 3392 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -3447,6 +3466,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_copy) @@ -3447,6 +3466,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_copy)
3447 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 3466 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
3448 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 3467 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
3449 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 3468 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  3469 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
3450 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 3470 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
3451 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 3471 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
3452 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 3472 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -3664,6 +3684,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_all) @@ -3664,6 +3684,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_all)
3664 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 3684 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
3665 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 3685 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
3666 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 3686 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  3687 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
3667 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 3688 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
3668 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 3689 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
3669 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 3690 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -3753,6 +3774,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_ffempty) @@ -3753,6 +3774,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_ffempty)
3753 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 3774 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
3754 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 3775 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
3755 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 3776 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  3777 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
3756 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 3778 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
3757 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 3779 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
3758 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 3780 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -3842,6 +3864,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_app) @@ -3842,6 +3864,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_app)
3842 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 3864 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
3843 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 3865 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
3844 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 3866 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  3867 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
3845 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 3868 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
3846 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 3869 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
3847 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 3870 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -3931,6 +3954,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_stream) @@ -3931,6 +3954,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_stream)
3931 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 3954 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
3932 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 3955 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
3933 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 3956 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  3957 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
3934 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 3958 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
3935 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 3959 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
3936 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 3960 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -4009,6 +4033,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_bandcheck) @@ -4009,6 +4033,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_bandcheck)
4009 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 4033 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
4010 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 4034 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
4011 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 4035 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  4036 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
4012 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 4037 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
4013 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 4038 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
4014 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 4039 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -4087,6 +4112,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_chunksize) @@ -4087,6 +4112,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_chunksize)
4087 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 4112 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
4088 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 4113 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
4089 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 4114 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  4115 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
4090 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 4116 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
4091 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 4117 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
4092 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 4118 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -4165,6 +4191,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_jitter) @@ -4165,6 +4191,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_jitter)
4165 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 4191 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
4166 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 4192 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
4167 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 4193 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  4194 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
4168 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 4195 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
4169 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 4196 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
4170 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 4197 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -4243,6 +4270,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_atc) @@ -4243,6 +4270,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_atc)
4243 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 4270 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
4244 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 4271 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
4245 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 4272 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  4273 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
4246 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 4274 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
4247 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 4275 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
4248 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 4276 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -4321,6 +4349,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_removed) @@ -4321,6 +4349,7 @@ VOID TEST(ConfigMainTest, ParseFullConf_removed)
4321 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str()); 4349 EXPECT_STREQ("./objs/nginx/html", conf.get_dvr_path(vhost).c_str());
4322 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str()); 4350 EXPECT_STREQ("session", conf.get_dvr_plan(vhost).c_str());
4323 EXPECT_EQ(30, conf.get_dvr_duration(vhost)); 4351 EXPECT_EQ(30, conf.get_dvr_duration(vhost));
  4352 + EXPECT_TRUE(conf.get_dvr_wait_keyframe(vhost));
4324 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost)); 4353 EXPECT_TRUE(SrsRtmpJitterAlgorithmFULL == conf.get_dvr_time_jitter(vhost));
4325 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost)); 4354 EXPECT_FALSE(conf.get_vhost_http_enabled(vhost));
4326 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str()); 4355 EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
@@ -4748,6 +4777,16 @@ VOID TEST(ConfigMainTest, CheckConf_vhost_dvr) @@ -4748,6 +4777,16 @@ VOID TEST(ConfigMainTest, CheckConf_vhost_dvr)
4748 4777
4749 if (true) { 4778 if (true) {
4750 MockSrsConfig conf; 4779 MockSrsConfig conf;
  4780 + EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost v{dvr{dvr_wait_keyframe on;}}"));
  4781 + }
  4782 +
  4783 + if (true) {
  4784 + MockSrsConfig conf;
  4785 + EXPECT_TRUE(ERROR_SUCCESS != conf.parse(_MIN_OK_CONF"vhost v{dvr{dvr_wait_keyframes on;}}"));
  4786 + }
  4787 +
  4788 + if (true) {
  4789 + MockSrsConfig conf;
4751 EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost v{dvr{time_jitter full;}}")); 4790 EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost v{dvr{time_jitter full;}}"));
4752 } 4791 }
4753 4792