winlin

support chnvideo hss streaming

@@ -783,7 +783,7 @@ int SrsDvrHssPlan::update_duration(SrsSharedPtrMessage* msg) @@ -783,7 +783,7 @@ int SrsDvrHssPlan::update_duration(SrsSharedPtrMessage* msg)
783 783
784 // reap if exceed atc expect time. 784 // reap if exceed atc expect time.
785 if (segment->stream_starttime + segment->stream_duration > expect_reap_time) { 785 if (segment->stream_starttime + segment->stream_duration > expect_reap_time) {
786 - srs_warn("hss reap start=%"PRId64", duration=%"PRId64", expect=%"PRId64 786 + srs_verbose("hss reap start=%"PRId64", duration=%"PRId64", expect=%"PRId64
787 ", segment(start=%"PRId64", adjust=%"PRId64", duration=%"PRId64", file=%s", 787 ", segment(start=%"PRId64", adjust=%"PRId64", duration=%"PRId64", file=%s",
788 segment->stream_starttime, segment->stream_duration, expect_reap_time, 788 segment->stream_starttime, segment->stream_duration, expect_reap_time,
789 segment->stream_starttime + segment->starttime, 789 segment->stream_starttime + segment->starttime,
@@ -37,6 +37,7 @@ using namespace std; @@ -37,6 +37,7 @@ using namespace std;
37 #include <srs_app_http.hpp> 37 #include <srs_app_http.hpp>
38 #include <srs_app_json.hpp> 38 #include <srs_app_json.hpp>
39 #include <srs_app_dvr.hpp> 39 #include <srs_app_dvr.hpp>
  40 +#include <srs_app_config.hpp>
40 41
41 #define SRS_HTTP_RESPONSE_OK "0" 42 #define SRS_HTTP_RESPONSE_OK "0"
42 43
@@ -463,7 +464,7 @@ void SrsHttpHooks::on_dvr_keyframe(string url, SrsRequest* req, SrsFlvSegment* s @@ -463,7 +464,7 @@ void SrsHttpHooks::on_dvr_keyframe(string url, SrsRequest* req, SrsFlvSegment* s
463 int ret = ERROR_SUCCESS; 464 int ret = ERROR_SUCCESS;
464 465
465 srs_assert(segment); 466 srs_assert(segment);
466 - srs_trace("flv segment %s, atc_start=%"PRId64", " 467 + srs_verbose("flv segment %s, atc_start=%"PRId64", "
467 "has_key=%d, starttime=%"PRId64", duration=%d", 468 "has_key=%d, starttime=%"PRId64", duration=%d",
468 segment->path.c_str(), segment->stream_starttime, 469 segment->path.c_str(), segment->stream_starttime,
469 segment->has_keyframe, segment->starttime, (int)segment->duration); 470 segment->has_keyframe, segment->starttime, (int)segment->duration);
@@ -480,7 +481,14 @@ void SrsHttpHooks::on_dvr_keyframe(string url, SrsRequest* req, SrsFlvSegment* s @@ -480,7 +481,14 @@ void SrsHttpHooks::on_dvr_keyframe(string url, SrsRequest* req, SrsFlvSegment* s
480 << JFIELD_STR("action", "on_dvr_keyframe") << JFIELD_CONT 481 << JFIELD_STR("action", "on_dvr_keyframe") << JFIELD_CONT
481 << JFIELD_STR("vhost", req->vhost) << JFIELD_CONT 482 << JFIELD_STR("vhost", req->vhost) << JFIELD_CONT
482 << JFIELD_STR("app", req->app) << JFIELD_CONT 483 << JFIELD_STR("app", req->app) << JFIELD_CONT
483 - << JFIELD_STR("stream", req->stream) 484 + << JFIELD_STR("stream", req->stream) << JFIELD_CONT
  485 + << JFIELD_NAME("segment") << JOBJECT_START
  486 + << JFIELD_STR("cwd", _srs_config->get_cwd()) << JFIELD_CONT
  487 + << JFIELD_STR("path", segment->path) << JFIELD_CONT
  488 + << JFIELD_ORG("pts", segment->stream_starttime + segment->starttime) << JFIELD_CONT
  489 + << JFIELD_ORG("duration", segment->duration) << JFIELD_CONT
  490 + << JFIELD_ORG("offset", 0)
  491 + << JOBJECT_END
484 << JOBJECT_END; 492 << JOBJECT_END;
485 std::string data = ss.str(); 493 std::string data = ss.str();
486 std::string res; 494 std::string res;
@@ -500,7 +508,7 @@ void SrsHttpHooks::on_dvr_keyframe(string url, SrsRequest* req, SrsFlvSegment* s @@ -500,7 +508,7 @@ void SrsHttpHooks::on_dvr_keyframe(string url, SrsRequest* req, SrsFlvSegment* s
500 return; 508 return;
501 } 509 }
502 510
503 - srs_trace("http hook on_dvr_keyframe success. " 511 + srs_info("http hook on_dvr_keyframe success. "
504 "url=%s, request=%s, response=%s, ret=%d", 512 "url=%s, request=%s, response=%s, ret=%d",
505 url.c_str(), data.c_str(), res.c_str(), ret); 513 url.c_str(), data.c_str(), res.c_str(), ret);
506 514
@@ -31,6 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,6 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 31
32 // json encode macros 32 // json encode macros
33 #define JOBJECT_START "{" 33 #define JOBJECT_START "{"
  34 +#define JFIELD_NAME(k) "\"" << k << "\":"
34 #define JFIELD_STR(k, v) "\"" << k << "\":\"" << v << "\"" 35 #define JFIELD_STR(k, v) "\"" << k << "\":\"" << v << "\""
35 #define JFIELD_ORG(k, v) "\"" << k << "\":" << std::dec << v 36 #define JFIELD_ORG(k, v) "\"" << k << "\":" << std::dec << v
36 #define JFIELD_ERROR(ret) "\"" << "code" << "\":" << ret 37 #define JFIELD_ERROR(ret) "\"" << "code" << "\":" << ret