mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refine SrsRtmpConn.duration in time unit.
This commit is contained in:
parent
f6f49c68da
commit
5af572ab50
3 changed files with 9 additions and 14 deletions
|
@ -101,7 +101,7 @@ protected:
|
||||||
srs_utime_t timeout;
|
srs_utime_t timeout;
|
||||||
public:
|
public:
|
||||||
// Constructor.
|
// Constructor.
|
||||||
// @param tm The receive timeout in ms.
|
// @param tm The receive timeout in srs_utime_t.
|
||||||
SrsRecvThread(ISrsMessagePumper* p, SrsRtmpServer* r, srs_utime_t tm, int parent_cid);
|
SrsRecvThread(ISrsMessagePumper* p, SrsRtmpServer* r, srs_utime_t tm, int parent_cid);
|
||||||
virtual ~SrsRecvThread();
|
virtual ~SrsRecvThread();
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -57,18 +57,13 @@ using namespace std;
|
||||||
#include <srs_protocol_json.hpp>
|
#include <srs_protocol_json.hpp>
|
||||||
#include <srs_app_kafka.hpp>
|
#include <srs_app_kafka.hpp>
|
||||||
|
|
||||||
// when stream is busy, for example, streaming is already
|
// the timeout in srs_utime_t to wait encoder to republish
|
||||||
// publishing, when a new client to request to publish,
|
|
||||||
// sleep a while and close the connection.
|
|
||||||
#define SRS_STREAM_BUSY_CIMS (3000)
|
|
||||||
|
|
||||||
// the timeout in ms to wait encoder to republish
|
|
||||||
// if timeout, close the connection.
|
// if timeout, close the connection.
|
||||||
#define SRS_REPUBLISH_SEND_TIMEOUT (3 * SRS_UTIME_MINUTES)
|
#define SRS_REPUBLISH_SEND_TIMEOUT (3 * SRS_UTIME_MINUTES)
|
||||||
// if timeout, close the connection.
|
// if timeout, close the connection.
|
||||||
#define SRS_REPUBLISH_RECV_TIMEOUT (3 * SRS_UTIME_MINUTES)
|
#define SRS_REPUBLISH_RECV_TIMEOUT (3 * SRS_UTIME_MINUTES)
|
||||||
|
|
||||||
// the timeout in ms to wait client data, when client paused
|
// the timeout in srs_utime_t to wait client data, when client paused
|
||||||
// if timeout, close the connection.
|
// if timeout, close the connection.
|
||||||
#define SRS_PAUSED_SEND_TIMEOUT (3 * SRS_UTIME_MINUTES)
|
#define SRS_PAUSED_SEND_TIMEOUT (3 * SRS_UTIME_MINUTES)
|
||||||
// if timeout, close the connection.
|
// if timeout, close the connection.
|
||||||
|
@ -767,7 +762,7 @@ srs_error_t SrsRtmpConn::do_playing(SrsSource* source, SrsConsumer* consumer, Sr
|
||||||
if (starttime < 0 || starttime > msg->timestamp) {
|
if (starttime < 0 || starttime > msg->timestamp) {
|
||||||
starttime = msg->timestamp;
|
starttime = msg->timestamp;
|
||||||
}
|
}
|
||||||
duration += msg->timestamp - starttime;
|
duration += (msg->timestamp - starttime) * SRS_UTIME_MILLISECONDS;
|
||||||
starttime = msg->timestamp;
|
starttime = msg->timestamp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -781,12 +776,12 @@ srs_error_t SrsRtmpConn::do_playing(SrsSource* source, SrsConsumer* consumer, Sr
|
||||||
// if duration specified, and exceed it, stop play live.
|
// if duration specified, and exceed it, stop play live.
|
||||||
// @see: https://github.com/ossrs/srs/issues/45
|
// @see: https://github.com/ossrs/srs/issues/45
|
||||||
if (user_specified_duration_to_stop) {
|
if (user_specified_duration_to_stop) {
|
||||||
if (duration >= (int64_t)req->duration) {
|
if (srsu2ms(duration) >= (int64_t)req->duration) {
|
||||||
return srs_error_new(ERROR_RTMP_DURATION_EXCEED, "rtmp: time %d up %d", (int)duration, (int)req->duration);
|
return srs_error_new(ERROR_RTMP_DURATION_EXCEED, "rtmp: time %d up %d", srsu2msi(duration), (int)req->duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply the minimal interval for delivery stream in ms.
|
// apply the minimal interval for delivery stream in srs_utime_t.
|
||||||
if (send_min_interval > 0) {
|
if (send_min_interval > 0) {
|
||||||
srs_usleep(send_min_interval);
|
srs_usleep(send_min_interval);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,10 +105,10 @@ private:
|
||||||
// the wakable handler, maybe NULL.
|
// the wakable handler, maybe NULL.
|
||||||
// TODO: FIXME: Should refine the state for receiving thread.
|
// TODO: FIXME: Should refine the state for receiving thread.
|
||||||
ISrsWakable* wakable;
|
ISrsWakable* wakable;
|
||||||
// elapse duration in ms
|
// elapse duration in srs_utime_t
|
||||||
// for live play duration, for instance, rtmpdump to record.
|
// for live play duration, for instance, rtmpdump to record.
|
||||||
// @see https://github.com/ossrs/srs/issues/47
|
// @see https://github.com/ossrs/srs/issues/47
|
||||||
int64_t duration;
|
srs_utime_t duration;
|
||||||
// the MR(merged-write) sleep time in ms.
|
// the MR(merged-write) sleep time in ms.
|
||||||
srs_utime_t mw_sleep;
|
srs_utime_t mw_sleep;
|
||||||
// the MR(merged-write) only enabled for play.
|
// the MR(merged-write) only enabled for play.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue