mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refine SrsRequest.duration in time unit.
This commit is contained in:
parent
cfab73b552
commit
c6dcc76fea
3 changed files with 13 additions and 13 deletions
|
@ -446,8 +446,8 @@ srs_error_t SrsRtmpConn::stream_service_cycle()
|
|||
|
||||
srs_discovery_tc_url(req->tcUrl, req->schema, req->host, req->vhost, req->app, req->stream, req->port, req->param);
|
||||
req->strip();
|
||||
srs_trace("client identified, type=%s, vhost=%s, app=%s, stream=%s, param=%s, duration=%.2f",
|
||||
srs_client_type_string(info->type).c_str(), req->vhost.c_str(), req->app.c_str(), req->stream.c_str(), req->param.c_str(), req->duration);
|
||||
srs_trace("client identified, type=%s, vhost=%s, app=%s, stream=%s, param=%s, duration=%dms",
|
||||
srs_client_type_string(info->type).c_str(), req->vhost.c_str(), req->app.c_str(), req->stream.c_str(), req->param.c_str(), srsu2msi(req->duration));
|
||||
|
||||
// discovery vhost, resolve the vhost from config
|
||||
SrsConfDirective* parsed_vhost = _srs_config->get_vhost(req->vhost);
|
||||
|
@ -776,8 +776,8 @@ srs_error_t SrsRtmpConn::do_playing(SrsSource* source, SrsConsumer* consumer, Sr
|
|||
// if duration specified, and exceed it, stop play live.
|
||||
// @see: https://github.com/ossrs/srs/issues/45
|
||||
if (user_specified_duration_to_stop) {
|
||||
if (srsu2ms(duration) >= (int64_t)req->duration) {
|
||||
return srs_error_new(ERROR_RTMP_DURATION_EXCEED, "rtmp: time %d up %d", srsu2msi(duration), (int)req->duration);
|
||||
if (duration >= req->duration) {
|
||||
return srs_error_new(ERROR_RTMP_DURATION_EXCEED, "rtmp: time %d up %d", srsu2msi(duration), srsu2msi(req->duration));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2485,7 +2485,7 @@ srs_error_t SrsRtmpServer::on_bw_done()
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtmpServer::identify_client(int stream_id, SrsRtmpConnType& type, string& stream_name, double& duration)
|
||||
srs_error_t SrsRtmpServer::identify_client(int stream_id, SrsRtmpConnType& type, string& stream_name, srs_utime_t& duration)
|
||||
{
|
||||
type = SrsRtmpConnUnknown;
|
||||
srs_error_t err = srs_success;
|
||||
|
@ -2887,7 +2887,7 @@ srs_error_t SrsRtmpServer::start_flash_publish(int stream_id)
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtmpServer::identify_create_stream_client(SrsCreateStreamPacket* req, int stream_id, SrsRtmpConnType& type, string& stream_name, double& duration)
|
||||
srs_error_t SrsRtmpServer::identify_create_stream_client(SrsCreateStreamPacket* req, int stream_id, SrsRtmpConnType& type, string& stream_name, srs_utime_t& duration)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -2986,11 +2986,11 @@ srs_error_t SrsRtmpServer::identify_flash_publish_client(SrsPublishPacket* req,
|
|||
return srs_success;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtmpServer::identify_play_client(SrsPlayPacket* req, SrsRtmpConnType& type, string& stream_name, double& duration)
|
||||
srs_error_t SrsRtmpServer::identify_play_client(SrsPlayPacket* req, SrsRtmpConnType& type, string& stream_name, srs_utime_t& duration)
|
||||
{
|
||||
type = SrsRtmpConnPlay;
|
||||
stream_name = req->stream_name;
|
||||
duration = req->duration;
|
||||
duration = srs_utime_t(req->duration) * SRS_UTIME_MILLISECONDS;
|
||||
|
||||
return srs_success;
|
||||
}
|
||||
|
|
|
@ -566,8 +566,8 @@ public:
|
|||
// for play live stream,
|
||||
// used to specified the stop when exceed the duration.
|
||||
// @see https://github.com/ossrs/srs/issues/45
|
||||
// in ms.
|
||||
double duration;
|
||||
// in srs_utime_t.
|
||||
srs_utime_t duration;
|
||||
// the token in the connect request,
|
||||
// used for edge traverse to origin authentication,
|
||||
// @see https://github.com/ossrs/srs/issues/104
|
||||
|
@ -911,7 +911,7 @@ public:
|
|||
* @stream_name, output the client publish/play stream name. @see: SrsRequest.stream
|
||||
* @duration, output the play client duration. @see: SrsRequest.duration
|
||||
*/
|
||||
virtual srs_error_t identify_client(int stream_id, SrsRtmpConnType& type, std::string& stream_name, double& duration);
|
||||
virtual srs_error_t identify_client(int stream_id, SrsRtmpConnType& type, std::string& stream_name, srs_utime_t& duration);
|
||||
/**
|
||||
* set the chunk size when client type identified.
|
||||
*/
|
||||
|
@ -983,12 +983,12 @@ public:
|
|||
return protocol->expect_message<T>(pmsg, ppacket);
|
||||
}
|
||||
private:
|
||||
virtual srs_error_t identify_create_stream_client(SrsCreateStreamPacket* req, int stream_id, SrsRtmpConnType& type, std::string& stream_name, double& duration);
|
||||
virtual srs_error_t identify_create_stream_client(SrsCreateStreamPacket* req, int stream_id, SrsRtmpConnType& type, std::string& stream_name, srs_utime_t& duration);
|
||||
virtual srs_error_t identify_fmle_publish_client(SrsFMLEStartPacket* req, SrsRtmpConnType& type, std::string& stream_name);
|
||||
virtual srs_error_t identify_haivision_publish_client(SrsFMLEStartPacket* req, SrsRtmpConnType& type, std::string& stream_name);
|
||||
virtual srs_error_t identify_flash_publish_client(SrsPublishPacket* req, SrsRtmpConnType& type, std::string& stream_name);
|
||||
private:
|
||||
virtual srs_error_t identify_play_client(SrsPlayPacket* req, SrsRtmpConnType& type, std::string& stream_name, double& duration);
|
||||
virtual srs_error_t identify_play_client(SrsPlayPacket* req, SrsRtmpConnType& type, std::string& stream_name, srs_utime_t& duration);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue