winlin

support chnvideo hss streaming

... ... @@ -783,7 +783,7 @@ int SrsDvrHssPlan::update_duration(SrsSharedPtrMessage* msg)
// reap if exceed atc expect time.
if (segment->stream_starttime + segment->stream_duration > expect_reap_time) {
srs_warn("hss reap start=%"PRId64", duration=%"PRId64", expect=%"PRId64
srs_verbose("hss reap start=%"PRId64", duration=%"PRId64", expect=%"PRId64
", segment(start=%"PRId64", adjust=%"PRId64", duration=%"PRId64", file=%s",
segment->stream_starttime, segment->stream_duration, expect_reap_time,
segment->stream_starttime + segment->starttime,
... ...
... ... @@ -37,6 +37,7 @@ using namespace std;
#include <srs_app_http.hpp>
#include <srs_app_json.hpp>
#include <srs_app_dvr.hpp>
#include <srs_app_config.hpp>
#define SRS_HTTP_RESPONSE_OK "0"
... ... @@ -463,7 +464,7 @@ void SrsHttpHooks::on_dvr_keyframe(string url, SrsRequest* req, SrsFlvSegment* s
int ret = ERROR_SUCCESS;
srs_assert(segment);
srs_trace("flv segment %s, atc_start=%"PRId64", "
srs_verbose("flv segment %s, atc_start=%"PRId64", "
"has_key=%d, starttime=%"PRId64", duration=%d",
segment->path.c_str(), segment->stream_starttime,
segment->has_keyframe, segment->starttime, (int)segment->duration);
... ... @@ -480,7 +481,14 @@ void SrsHttpHooks::on_dvr_keyframe(string url, SrsRequest* req, SrsFlvSegment* s
<< JFIELD_STR("action", "on_dvr_keyframe") << JFIELD_CONT
<< JFIELD_STR("vhost", req->vhost) << JFIELD_CONT
<< JFIELD_STR("app", req->app) << JFIELD_CONT
<< JFIELD_STR("stream", req->stream)
<< JFIELD_STR("stream", req->stream) << JFIELD_CONT
<< JFIELD_NAME("segment") << JOBJECT_START
<< JFIELD_STR("cwd", _srs_config->get_cwd()) << JFIELD_CONT
<< JFIELD_STR("path", segment->path) << JFIELD_CONT
<< JFIELD_ORG("pts", segment->stream_starttime + segment->starttime) << JFIELD_CONT
<< JFIELD_ORG("duration", segment->duration) << JFIELD_CONT
<< JFIELD_ORG("offset", 0)
<< JOBJECT_END
<< JOBJECT_END;
std::string data = ss.str();
std::string res;
... ... @@ -500,7 +508,7 @@ void SrsHttpHooks::on_dvr_keyframe(string url, SrsRequest* req, SrsFlvSegment* s
return;
}
srs_trace("http hook on_dvr_keyframe success. "
srs_info("http hook on_dvr_keyframe success. "
"url=%s, request=%s, response=%s, ret=%d",
url.c_str(), data.c_str(), res.c_str(), ret);
... ...
... ... @@ -31,6 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// json encode macros
#define JOBJECT_START "{"
#define JFIELD_NAME(k) "\"" << k << "\":"
#define JFIELD_STR(k, v) "\"" << k << "\":\"" << v << "\""
#define JFIELD_ORG(k, v) "\"" << k << "\":" << std::dec << v
#define JFIELD_ERROR(ret) "\"" << "code" << "\":" << ret
... ...